Re: printing php variable into html > print $result; ?

From: Date: Thu, 03 Jan 2002 20:57:29 +0000
Subject: Re: printing php variable into html > print $result; ?
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-15364@lists.php.net to get a copy of this message
Oh YEAH!! it work!! YEHEY!! yahoo!!! thanks rick! =) louie ----- Original Message ----- From: "Rick Emery" <remery@excel.com> To: "'louie miranda'" <louie@chikka.com>; <php-db@lists.php.net> Sent: Friday, January 04, 2002 4:51 AM Subject: RE: [PHP-DB] printing php variable into html > print $result; ? > You must extract the results of the query row-by-row. > > while( $row = mysql_fetch_array($result) ) > { > print "ircname:".$row['ircname']."<BR>"; > print "email:".$row['email']."<BR>"; > print "realname:".$row['realname'].".<BR>"; > print "asl:".$row['asl']."<BR>"; > print "info:".$row['info']."<BR>"; > } > > -----Original Message----- > From: louie miranda [mailto:louie@chikka.com] > Sent: Thursday, January 03, 2002 2:46 PM > To: php-db@lists.php.net; php-general@lists.php.net > Subject: [PHP-DB] printing php variable into html > print $result; ? > > > Hi, is it possible to print the sql query? i mean > i want to print the output of the command "SELECT * FROM members;" > and output it into html, i tried > > print $result; -- it gives me different output.. > > > Resource id #2 > > > ty, > louie... > > # PHP SCRIPT ############################################### > > <html> > <body> > > <?php > > $db = mysql_connect("my_db_host", "my_db_user", "my_db_pass") > or die("Could not connect"); > > mysql_select_db("cavite",$db); > > $result = mysql_query("SELECT * FROM members",$db) or > die("Error:".mysql_error() > ); > > printf("ircname: %s<br>", mysql_result($result,0,"ircname")); > printf("email: %s<br>", mysql_result($result,0,"email")); > printf("realname: %s<br>", mysql_result($result,0,"realname")); > printf("asl: %s<br>", mysql_result($result,0,"asl")); > printf("info: %s<br>", mysql_result($result,0,"info")); > > print "<br><br>"; > > ?> > > </body> > > </html> > > # PHP SCRIPT ############################################### > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.db (#15364) next »