Page 1 of 1

How to display result?

Posted: Thu Jun 23, 2005 10:36 am
by ianhull
Hi I am using this sql to select records from the db but how would I display these records when they have been selected?

Code: Select all

<?php 
		include_once("connect.php"); ?>
$sql = 'SELECT * FROM `customers` LIMIT 0, 30 ';


<?php echo  $customers ?>
Does not work, what should I do now?

Thanks

Posted: Thu Jun 23, 2005 10:40 am
by John Cartwright

Code: Select all

include_once("connect.php");
$result = mysql_query('SELECT * FROM `customers` LIMIT 0, 30 ')or die(mysql_error());  

while ($row = mysql_fetch_assoc($result)) {
   echo $row['customers'];
}
Should read up on

mysql_connect()
mysql_query()
mysql_error()
mysql_fetch_assoc() or mysql_fetch_array()

Posted: Thu Jun 23, 2005 10:40 am
by patrikG