MySQL Select
Posted: Tue May 12, 2009 12:32 pm
Hi, can anyone help me out with the following code?
It's meant to slelect each row from the 2 specified cloumns and output it to the web page. all I get is a blank web page.
i don't know whats happening, is the loop breaking before the first result is being displayed?
Thee is data in the rows I have specified and the db and table names are correct.
Many thanks in advance.
Regards,
Paul.
It's meant to slelect each row from the 2 specified cloumns and output it to the web page. all I get is a blank web page.
i don't know whats happening, is the loop breaking before the first result is being displayed?
Thee is data in the rows I have specified and the db and table names are correct.
Many thanks in advance.
Code: Select all
<?
mysql_connect("localhost", "root", "****") or die(mysql_error());
mysql_select_db("tackle_shops") or die(mysql_error());
$result = mysql_query("SELECT * FROM shops")
or die(mysql_error());
$row = mysql_fetch_array();
while($row = mysql_fetch_array($result)){
echo $row['name']. " - ". $row['town'];
echo "<br />";
or die(mysql_error));
?>Paul.