Answer the question
In order to leave comments, you need to log in
What function should mysql_result be changed to in order for the code to work?
I am learning PHP from Nixon's book, and while typing code from it, the IDE started highlighting some functions as obsolete for me, and I decided to try to rework the code to a more relevant one, but unfortunately I could not cope with the problem that is visible in the screenshot.
Answer the question
In order to leave comments, you need to log in
// You have mysql_result() call in the screenshot, and you are using MySQLi Get
a newer book and open the MySQLi documentation )
This is how it should work (simplified version):
<?php
$db = mysqli_connect('localhost', 'user', 'password', 'databaseName');
if ($db->connect_errno)
{
exit('Не получилось соеденится к MySQL серверу');
}
$query = mysqli_query($db, 'SELECT * FROM `classics`');
while ($row = mysqli_fetch_assoc($query))
{
echo 'Автор: ',$row['author'];
}
?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question