Maximilian Maximilian - 1 year ago 41
PHP Question

Get result of a mysql query

I have a pretty basic website connected to an database and I want to access the result of an SQL query

$connection = mysql_connect("localhost", "username", "password")
or die(mysql_error());
or die(mysql_error());

$query = mysql_query("SELECT path FROM db1 WHERE id > 4");
while($row = mysql_fetch_object($query))
echo $row->path;

On the website nothing shows not even an error
(The SQL code works for sure)


Since you stated in comments that there were no id greater than 4,

you could have just done WHERE id >= 4 which means greater than or equal to 4 and you would have had results.