468,306 Members | 1,277 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,306 developers. It's quick & easy.

mysql_num_fields to PEAR

Anyone know how to handle the while and for loops with PEAR in the code
below??

// ----------------------------------------------------------------

$result = mysql_query("SELECT bus_price FROM cf where name='$name'",
$connect);

while ($row = mysql_fetch_row($result)) {
for ($i = 0; $i < mysql_num_fields($result); $i++) {

/*
Hunt down instances of newline breaks and text spaces in blob field of
database and replace with HTML linebreak and HTML spaces...
*/

$replace = str_replace(" ", "&nbsp;", $row[$i]);
$replace = nl2br($replace);
echo
"<font face = \"arial, helvetica, sans-serif\" size =\"2\">
<b>Price:</b>
<br>" . $replace . " ";

}
}
// ----------------------------------------------------------------

Jul 17 '05 #1
1 1389
juray wrote:
Anyone know how to handle the while and for loops with PEAR in the code
below??

// ----------------------------------------------------------------

$result = mysql_query("SELECT bus_price FROM cf where name='$name'",
$connect);

while ($row = mysql_fetch_row($result)) {
for ($i = 0; $i < mysql_num_fields($result); $i++) {

/*
Hunt down instances of newline breaks and text spaces in blob field of
database and replace with HTML linebreak and HTML spaces...
*/

$replace = str_replace(" ", "&nbsp;", $row[$i]);
$replace = nl2br($replace);


How about the same was as presented in the documentation for PEAR::DB
--> http://pear.php.net/manual/en/packag...ntro-fetch.php

/Marcin
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Sandro Dentella | last post: by
3 posts views Thread by junkmail | last post: by
1 post views Thread by DJ Majestik | last post: by
2 posts views Thread by Alan Prescott | last post: by
5 posts views Thread by Jim Michaels | last post: by
reply views Thread by bwhitehd | last post: by
1 post views Thread by IchBin | last post: by
1 post views Thread by CSTechie | last post: by
1 post views Thread by IchBin | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.