I'm trying this code through which I'm getting the connection but I'm getting an error undefined variable.
Connected to MySQL
SELECT * FROM headcont;
Notice: Undefined variable: myQuery in C:\xampp\htdocs\Myweb\index.php on line 86
No database selected
require("connection.php");
if($con)
{
$qry="SELECT * FROM headcont;";
//mysql_select_db('content');
echo $qry;
$result=mysql_query($qry) or die($myQuery."<br/><br/>".mysql_error());
while($row=mysql_fetch_assoc($result))
{
$title=$row[title];
$desc=$row[description];
echo $title;
}
}
I don't know what the issue is, can someone please help me with this?
require("connection.php");
if($con)
{
$qry="SELECT * FROM headcont;";
mysql_select_db('content');
echo $qry;
$result=mysql_query($qry) or die($myQuery."<br/><br/>".mysql_error());
while($row=mysql_fetch_assoc($result))
{
$title=$row[title];
$desc=$row[description];
echo $title;
}
}
<?php
require("connection.php");
$query = mysql_query("SELECT * FROM `headcont` ") or die(mysql_error());
while ($row = mysql_fetch_array($query)) {
$title = $row['title'];
$desc = $row['description'];
echo $title;
}
?>