OK so iam having a issue getting mysql_query to connect into the data base inside php. i did a quick test to see if it would connect and this is what i did. to for warn you iam new to php so if there is mistakes please let me know.
<?php
require 'conect.php';
$query = "SELECT 'food', 'calories' FROM 'food' ORDER BY 'id'";
if($query_run = mysql_query($query)){
echo 'true';
}else{
mysql_error();
};
?>
Your query is incorrect. You only quote STRINGS in a query, not field names or values. Quoting them reduces them to strings, and they'll no longer be field/table names. Try
SELECT food, calories
FROM food
ORDER BY id
instead. Note the utter lack of quotes in there.
Use mysqli
instead.
$connection = mysqli_connect("server","db_user","db_pass","db_name") or die(mysqli_error());
$query = "SELECT food, calories
FROM food
ORDER BY id";
if($data_run = mysqli_query($connection, $query)){
echo "True";
}
else{
mysqli_error();
}
Hope this will help you.