Date: 07/30/02
- Next message: Terry Romine: "[PHP-DB] Comparison with formatted numbers"
- Previous message: Tony Harrison: "[PHP-DB] Re: Auto Increment Problems...."
- In reply to: Paul Worthington: "[PHP-DB] mysql_fetch_array limit? - more details"
- Next in thread: Paul Worthington: "Re: [PHP-DB] mysql_fetch_array limit? - more details"
- Reply: Paul Worthington: "Re: [PHP-DB] mysql_fetch_array limit? - more details"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
on 7/30/02 10:34 AM, Paul Worthington at prw <email protected> appended the
following bits to my mbox:
> I'm using this PHP code, very simple and straightforward, to select two
> columns into an array and then display the results in an HTML table:
> .............................................................................
> ...................................
> $db = mysql_connect("localhost", "user1");
> mysql_select_db("testdb",$db);
> $sql = "SELECT * FROM tmp ORDER BY Name";
> $result = mysql_query($sql,$db);
>
> echo "<TABLE>\n";
> echo "<TR>\n<TH>Place Name</TH>\n<TH>Description</TH>\n</TR>\n";
> while ($myrow = mysql_fetch_array($result)) {
> printf("<TR><TD>%s</TD><TD>%s</TD></TR>\n", $myrow[Name],
> $myrow[txtSWDesc1]);
> }
> echo "</TABLE>\n";
> .............................................................................
> ................................
> What happens is I'm only getting the first 256 characters of txtSWDesc1
> displayed in my table. I am assuming the problem is in
Are you sure that the printf() function can take more than 256 characters of
input? Since you are only outputting strings, printf isn't really necessary
so you can use the echo command instead.
Also, though this probably isn't the reason, you should quote your key
names.
while ($myrow = mysql_fetch_array($result)) {
echo '<tr><td>',$myrow['Name'],'</td>';
echo '<td>',$myrow['txtSWDesc1'],'</td></tr>';
}
HTH.
Sincerely,
Paul Burney
<http://paulburney.com/>
<?php
while ($self != "asleep") {
$sheep_count++;
}
?>
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
- Next message: Terry Romine: "[PHP-DB] Comparison with formatted numbers"
- Previous message: Tony Harrison: "[PHP-DB] Re: Auto Increment Problems...."
- In reply to: Paul Worthington: "[PHP-DB] mysql_fetch_array limit? - more details"
- Next in thread: Paul Worthington: "Re: [PHP-DB] mysql_fetch_array limit? - more details"
- Reply: Paul Worthington: "Re: [PHP-DB] mysql_fetch_array limit? - more details"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

