PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Hi all, I am trying to display the results of a SQL query and for some reason nothing is being returned, this is driving me nuts but as I am fairly new to PHP im sure its something simple
here is my code, I hve omitted the username and password but I know that they are correct.
<?php
$Host="localhost";
$Username="";
$Password="";
$DBName="welladorned";
$TableName="Simplified Spreadsheet";
$link = mysql_connect ($Host, $Username, $Password) or die('Could not connect: ' . mysql_error());
mysql_select_db($DBName) or die('Could not select database');
$query="SELECT `Product Code` FROM `Simplified Spreadsheet' GROUP BY `Product Code` ORDER BY `Product Code` LIMIT 0 , 30";
$result=mysql_query($query);
if (!result){
die ("Could not query the database: <br />". mysql_error());
}
array mysql_fetch_row ( resource $result);
mysql_close();
?>
$row is an array, $result is a resource. Make sense?
I have tried that among other things, the problem is that quite literally nothing is showing up whatsoever even when I change the mysql connection variables to something that I know is not correct I am not getting a cannot connect return. I have tried to restart apache. I even tried to add in a simple echo of text and that is not appearing.