Re: Re: can't get printf() to work

From: Date: Mon, 30 Oct 2000 03:30:48 +0000
Subject: Re: Re: can't get printf() to work
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-22601@lists.php.net to get a copy of this message
Hi Gary, Well the only thing I can think of is that you're not using the right column names in the printf statement. Is it printing anything at all (as in, empty table cells?) If that's the case then that's the problem. Otherwise, I'm stumped. Maybe try adding: print_r ($myrow); just after the do { - and see what PHP thinks $myrow is. Also, if that below is a verbatim copy, you're missing the final </td>. If you're viewing it with netscape, it might simply refuse to render the row at all (not sure, but Netscape is pretty picky about correct HTML) Also you're giving printf more things to print then it needs, but that didn't cause any problems when I checked it. Anyway, the code looks fine, so my guess is either the column names aren't the same as in the db (PHP is case sensitive - "name" != "Name") or the browser is simply not rendering it. Have you tried doing a view source to see what if anything is being sent? On Sun, 29 Oct 2000, Gary wrote: > This is the original snip of script i used. I was getting the same results. > if ($myrow=mysql_fetch_array($result)) { > > echo "<table border=1>\n"; > > echo > > "<tr><td>ID</td><td>Username</td><td>Password</td><td>Email</td></tr>\n"; > > do{ > > > > printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</tr>\n", > > $myrow["name"],$myrow["email"],$myrow["phone"],$myrow["company"], > > $myrow["standard"],$myrow["ecommerce"],$myrow["message"]); > > } while($myrow = mysql_fetch_array($result)); > > echo "</table>\n"; > } > -- Michael

« previous php.general (#22601) next »