Re: mysql_fetch_array limit? - more details

From: Date: Tue, 30 Jul 2002 18:20:18 +0000
Subject: Re: mysql_fetch_array limit? - more details
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-20908@lists.php.net to get a copy of this message
Thanks for all your helpful suggestions. It turns out I was limiting the array myself by setting a temporary table column definition to varchar(255). I have been overlooking it all this time. I feel so stupid. Thanks again for trying to help me. Paul "Paul Burney" <paul.lists@burney.ws> wrote in message news:B96C4F4A.8A7A%paul.lists@burney.ws... > on 7/30/02 10:34 AM, Paul Worthington at prw@evolving.com 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++; > } > ?> > >

« previous php.db (#20908) next »