Re: Re: can't get printf() to work
| From: | Gary | Date: | Mon, 30 Oct 2000 03:56:32 +0000 |
| Subject: | Re: Re: can't get printf() to work | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-22604@lists.php.net to get a copy of this message | ||
Hi Michael,
No, below is not a an exact copy of printf. I use a code snippet to write the
post and didn't have wrap turned on in the editor, screwed up by not change the
myrow calls, to correct ones. The echo's are printing, the printf stuff is
showing empty cells when you view source.
In the morning i am going to check the SQL again. I have checked it twice and it
was ok, but who know, with all the changing I may have a typ0 since i last
checked.
Thanks
Gary
Michael wrote:
> 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
--
The sad thing about artificial intelligence is that it lacks artifice and
therefore intelligence.Jean Baudrillard (1929), French semiologist.