Re: How can I display data in web after mysql_query() ??

From: Date: Sun, 03 Dec 2000 17:32:21 +0000
Subject: Re: How can I display data in web after mysql_query() ??
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-28451@lists.php.net to get a copy of this message
Sire: You're on the right track... > while ($row =mysql_fetch_arrary($result)) { > > $cname =$row["cname"]; > $email =$row["email"]; > $ename =$row["ename"]; > $location=$row["location"]; > $userid=$row["userid"]; You don't need this step. It just increases the length of time it takes to execute your code and the memory required. Just call the $row array directly in the <td>'s like this echo "<tr><td>". $row["cname"] ."</td><td>". $row["email"] ."</td>...etc... > echo > "<tr><TD>$cname</TD><TD>$email/TD><TD>$ename</TD>"; > echo "<TD>$location</TD><TD>$userid</TD>"; You forgot to put on a "</tr>" at the end to close the row. > and i got earr about this..... > > Henry Chan from Hong Kong ^_^ > echo "</table>"; Huh? I'm confused what you're saying here. If you want this to be visible in the table, you need to put it in a row and cell too: echo "<tr><td colsapan=\"5\">Henry Chan...</td></tr></table>"; You might want to take a look at my SQL Solution class, http://www.analysisandsolutions.com/code/sql/. It generates HTML tables from any query results by writing one statement. Enjoy, --Dan -- PHP scripts that make your job easier http://www.analysisandsolutions.com/code/ SQL Solution | Layout Solution | Form Solution T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Ave, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409

« previous php.general (#28451) next »