ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> php-windows
php-windows
[PHP-WIN] create a file (simple)
by K. Lee other posts by this author
Aug 10 2002 11:18PM messages near this date
[PHP-WIN] [php-objects] RE: [PHP] Re: [PHP-DEV] [CROSS POST] PHP Meetup & Texas PHP Users | [PHP-WIN] DaDaBIK 2.1b beta released
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 Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Thread:
Martin Clifford
K. Lee

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved