Reply to Re: I have a weird database problem: it is returning spurious rows with all the fields concatenated into one

Your name:

Reply:


Posted by Janwillem Borleffs on 11/04/78 11:41

Jeff Silverman" <""\"Remove the letters in all caps\" <jeff\ wrote:
> I have a PHP program that almost works. I'm running it from the
> command line and simulating a form using a GET method. That part is
> working, but I get spurious records with all of the fields concatenated
> into a
> single field.
>
[...]
> <small>This document last modified
> <script>document.writeln(document.lastModified)</script>.</small>
>

You are using PHP, no use for JS here:

<small> This document last modified
<?php print date("F d Y H:i:s.", getlastmod()) ?></small>

> $sql = "SELECT name, location, kernel, distribution, sysadmin, ip,
> mac, vendor_sn, real_num
> FROM computers WHERE name LIKE '".$hostname."%' ORDER BY name
> ASC";

You are selecting 9 fields from each row...

> print(" <tr>\n");
> for ($field=0; $field<4; $field++ ) {
> print(" <td>$row[$field] </td>\n");
> };
> print(" </tr>\n");
>

....but are only using the 4 first fields from each row?

Why not doing something like:

print "<tr>\n\t<td>";
print implode("</td>\n\t<td>", $row);
print "</td>\n</tr>";


JW

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация