This is my first using php.  I trying to do something by creating file to
see the sql statement I am sending to my database.  I assuming php does not
have way throw up a simple message box. Anyway, if I could get this file to
create that would be great.  Any help would be appreciated.

function write_to_file($filename, $stringtowrite, $writetype)
{
$filesession = fopen($filename,$writetype);
fwrite($filesession,"$stringtowrite");
fclose($filesession);
}


function companiesByBusiness_ZipCode_BusinessOrContactName( $ctgyno,
$zipcode, $businessandcontactname ) {
 $sql = "select company_no, name, contact, business_phone, mobile_phone,
services_desc, brief_bio, pager, address, city, state, zipcode,
picture_file, case ifnull(picture_file, 'No Picture') when 'No Picture' then
'b' else 'a' end pic_ind from company";
 if( $ctgyno != "ALL") {
  $sql .= " where business_ctgy_no = $ctgyno";
  if( $zipcode != "" ) {
   $sql .= " and (zipcode like '".substr( $zipcode, 0, 3 )."%' and zipcode
!= '$zipcode')";
  }
  if( $businessandcontactname != "" ) {
   $sql .= " and name = gil";
   $sql .= " or contact = gil bryan";

  }
  $sql .= " order by pic_ind, name, company_no";
 }

 write_to_file("developement/indexcode/query.log",$sql,"aw");
 $fp=fopen("developement/indexcode/query.log","aw");
 fwrite($fp,$sql);
 $query = mysql_query( $sql ) or die( $sql."<p>".mysql_error() );

 //$numrows = mysql_num_rows( $query );
 while( $assoc = mysql_fetch_assoc( $query ) ) {
  $rows[] = $assoc;
 }

 return $rows;
}




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to