[PHP] Re: [PHP-DB] Parsing Error From: Tom Carter (subs <email protected>)
Date: 07/08/01

To expand on that.. printf is short for print-formatted... its a function
inherited from c (I think) which basically allows your to format variable
for the display within the function, eg if you had $x=1.2243 then you could,
for example, use ptinf to only display it as 1.22

To cut a long story short, Larry was right in his advice.. just thought I'ld
stick my ha'penny's worth in too.. give you an idea why!

> I don't see why you are using printf there try print instead or echo ;)0
> -----Original Message-----
> From: Jeff Grossman [mailto:jeff <email protected>]
> Sent: Saturday, July 07, 2001 6:56 PM
> To: php-db <email protected>
> Subject: Re: [PHP-DB] Parsing Error
>
> Thanks Larry.
>
> Now I am getting a printf too few arguments error on this line:
>
> printf("<A
> HREF=\"mailto:test <email protected>?subject=$store\%20$jobdesc\">$jobdesc</A><BR
> >\n");
>
> Thanks,
> Jeff
> "Larry Rivera" <web <email protected>> wrote:
>
> >After a brief look it appears that your call to mysql_query is
> incorrect
> >" after the query then "," then the link resource
> >
> >-----Original Message-----
> >From: Jeff Grossman [mailto:jeff <email protected>]
> >Sent: Saturday, July 07, 2001 6:23 PM
> >To: php-db <email protected>
> >Subject: [PHP-DB] Parsing Error
> >
> >I keep getting the following error:
> >
> >Warning: Supplied argument is not a valid MySQL result resource in
> >/home/httpd/html/stats/jobs/listing.php on line 33
> >
> >Warning: Supplied argument is not a valid MySQL result resource in
> >/home/httpd/html/stats/jobs/listing.php on line 43
> >
> >when I try to display the following webpage. What am I doing wrong?
> >
> ><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
> > "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
> ><html>
> ><head>
> > <title>Title</title>
> ></head>
> ><body>
> ><?php
> >$hostName="localhost";
> >$userName="jeff";
> >$password="jeff";
> >$databaseName="jobs";
> >$tableName="listings";
> >
> >// connnect to the database
> >if (!($link=mysql_pconnect($hostName, $userName, $password))) {
> > DisplayErrMsg(sprintf("error connecting to host %s by user
> >%s", $hostName, $userName));
> > exit();
> >}
> >
> >// select the database
> >if (!mysql_select_db($databaseName, $link)) {
> > DisplayErrMsg(sprintf("Error in selecting %s database",
> >$databaseName));
> > DisplayErrMsg(sprintf("error:%d %s", mysql_errno($link),
> >mysql_error($link)));
> > exit();
> >}
> >
> >// send the SQL queries
> >
> >$result=mysql_query("SELECT * FROM listings WHERE store='West Covina',
> >$link");
> >
> >// return how many rows
> >$num_rows=mysql_num_rows($result);
> >// check if greater than zero
> >if($num_rows!=0) {
> > printf("<FONT SIZE=+3>West Covina</FONT> <FONT SIZE=-2><I><A
> >HREF=\"../test/stores.php#WC\">address</A></I></FONT><BR><BR>");
> > while ($row=mysql_fetch_array($result)) {
> > $store=$rowid["store"];
> > $jobdesc=$rowid["jobdesc"];
> > printf("<A
> >HREF=\"mailto:test <email protected>?subject=$store\%20$jobdesc\">$jobdesc</A><B
> R
> >>\n");
> > }
> >}
> >mysql_free_result($result);
> >
> >?>
> >
> ></body>
> ></html>
> >
> >
> >Thank you,
> >Jeff
> >---
> >Jeff Grossman (jeff <email protected>)
>
> ---
> Jeff Grossman (jeff <email protected>)
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe <email protected>
> For additional commands, e-mail: php-db-help <email protected>
> To contact the list administrators, e-mail: php-list-admin <email protected>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe <email protected>
> For additional commands, e-mail: php-db-help <email protected>
> To contact the list administrators, e-mail: php-list-admin <email protected>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe <email protected>
For additional commands, e-mail: php-general-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>