mysql_fetch_assoc error
-
hi, i am having a problem with a php code with mysql_fetch_assoc, the plugin is blocked the script if you can help me:
$servername = “*****”;
$username = “*****”;
$password = “******”;
$dbname = “*******”;
$conn = new mysqli($servername, $username, $password, $dbname);if ($conn->connect_error) {
die(“Connection failed: ” . $conn->connect_error);
}$id = $_GET[‘id’];
$sql = “SELECT * FROM students WHERE id = {$id}”;
$rst = mysql_query($sql);
$a_row = mysql_fetch_assoc($rst);
echo”<table id=’keywords’ cellspacing=’0′ cellpadding=’0′>”;
echo”<thead>”;
echo “<tr><th>Id</th>”;
echo “<th>Nume</th>”;
echo “<th>Localitate</th>”;
echo “<th>Judet</th>”;
echo “<th>Sector Financiar</th></tr>”;
echo”</thead>”;
echo “<tr><td class=’lalign’>{$a_row[‘id’]}</td>” ;
echo “<td class=’lalign’>{$a_row[‘nume’]}</td>” ;
echo “<td class=’lalign’>{$a_row[‘localitate’]}</td>” ;
echo “<td class=’lalign’>{$a_row[‘judet’]}</td>” ;
echo “<td class=’lalign’>{$a_row[‘sector_financiar’]}</td></tr>” ;
echo”</table>”;
$conn->close();my error: Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in apache-tomcat-7.0.54/exec-php-class.php(895) : eval()’d code on line 18
- The topic ‘mysql_fetch_assoc error’ is closed to new replies.