RE: [PHP] Shorting code
| From: | Lawrence dot Sheed at dfait-maeci dot gc dot ca | Date: | Thu, 26 Oct 2000 02:46:21 +0000 |
| Subject: | RE: [PHP] Shorting code | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-22022@lists.php.net to get a copy of this message | ||
Why not
print "<tr><td>". $myrow["id"] . "</td>" etc?
It will treat everything as a string anyhow, you don't explicitly have to do
a printf ("%s");
-----Original Message-----
From: David Robley [mailto:huntsman@hermes.nisu.flinders.edu.au]
Sent: October 26, 2000 10:39 AM
To: Gary; php-general@lists.php.net
Subject: Re: [PHP] Shorting code
On Thu, 26 Oct 2000, Gary wrote:
> Hi,
> There has to be a way of making these two line less verbose?
>
> echo
>
"<tr><td>ID</td><td>Accepted</td><td>Username</td><td>Password</td><td>Email
</td></tr>\n";
>
>
printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s<td>/td><td>%s</tr>\n",$m
yrow["id"],$myrow["accepted"],$myrow["username"],$myrow["password"],$myrow["
email"]);
>
> Thanks
> Gary
echo will make your second line a bit easier to understand, and if you
combine that with extract() to get your field names direct from the result
of mysql_fetch_Array it should be a bit tidier.
--
David Robley | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
AusEinet | http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA
--
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