Re: Need some quick help!
| From: | Tim Sawyer | Date: | Sat, 28 Oct 2000 21:23:29 +0000 |
| Subject: | Re: Need some quick help! | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-22496@lists.php.net to get a copy of this message | ||
I'm new to PHP but one of the things I see PHP people do it is over use printf.
There's no need to use it for simple %s (string) formats. Use a straight print
or echo instead. I didn't spent a lot of time looking at your code, bit it looks
like you might have more strings than you have %s in the printf statement.
Alex Behrens wrote:
> Hey Guys,
>
> I'm pretty new to php and mysql but I need some quick help, I'm making a
> very, very easy script that outputs review names and urls from a database. I
> got it to work but for some reason it says:
>
> Name (Written By: Author) (Written By: )
>
> I can't figure out why it repeats the Written By line without the author,
> here is the code I'm using:
>
> <?php
> $db = mysql_connect("localhost", "", "");
> mysql_select_db("networkarticles",$db);
> $r = mysql_query("SELECT * FROM hwureviews");
> while($a=mysql_fetch_array($r)) {
> printf("<a href=\"%s\">%s</a> (Written by: <a
> href=\"mailto:%s\"
>>%s</a>\n)",$a["url"],$a["name"],$a["email"],$a["author"])
> ;
> }
> ?>
>
> Any help is greatly appreciated!
>
> Thanks!
> --------------------------------------------
> -Alex "Big Al" Behrens
> E-mail: bigal@3d-unlimited.com
> Phone: 651-482-8779
> Fax: 651-482-1391
> Pager: 612-740-2162
> ICQ: 3969599
> Owner of the 3D-Unlimited Network:
> http://www.3d-unlimited.com
> Send News:
> news@3d-unlimited.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
--
Tim Sawyer
:wq