Re: help with script!!!

From: Date: Sun, 02 Feb 2003 14:22:17 +0000
Subject: Re: help with script!!!
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-133997@lists.php.net to get a copy of this message
?<php mysql_connect("hostname", "mysqluser", "mysqlpassword")||die(""db error msg..."); mysql_select_db("databaseName")||die("database error msg..."); $result=mysql_query("select * from table_name"); /*heres the trick*/ while($array=mysql_fetch_array($result)){ printf("| %s | %s | %s | %s | %s |<br />", $array[id], $array[username], $array[password], $array[status], $array[notes]); } and make sure that your array indexes are right they are case sensitive in mysql...so array[id] is different than array[Id] or array[ID]... ----- Original Message ----- From: "Karl James" <karl.james@verizon.net> To: "php" <php-general@lists.php.net> Sent: Saturday, February 01, 2003 1:37 AM Subject: [PHP] help with script!!! Hello guys and gals!!! can you tell me why i can't get this script to print my table.... thanks Karl please check out the code below obviously i left my username and passwords blank :-) ---------------------------------------------------------------------------- - -------------------------------------------------------- <? $sqlhost = "localhost"; $sqllogin = "login"; $sqlpw = "password"; $sqldb = "database table name"; (@!mysql_pconnect($sql[localhost], $sql[wedbd13], $sql[webdb13])) { die(mysql_error()); } (@!mysql_select_db($sql[wedbd13])) { die(mysql_error()); } $result = mysql_query("SELECT * FROM assignment_one"); while($array = mysql_fetch_array($result)) { echo("| %s | %s | %s | %s | %s |<br />", $array[id], $array[username], $array[password], $array[status], $array[notes]); } ?> ---------------------------------------------------------------------------- --------------------------------------------------------- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003

« previous php.general (#133997) next »