By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,374 Members | 1,773 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,374 IT Pros & Developers. It's quick & easy.

mysql_num_fields to PEAR

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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.