?<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" <[EMAIL PROTECTED]> To: "php" <[EMAIL PROTECTED]> 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php