thedigicraft / Atom.CMS

Atom.CMS
56 stars 50 forks source link

Video -19 Creating a settings table in the MySQL Databace #185

Open Someshojha opened 8 years ago

Someshojha commented 8 years ago

Hi,

I am getting below error after pasting the code on data.php from setup.php:

Fatal error: Uncaught Error: Call to undefined function mysql_fetch_assoc() in C:\xampp\htdocs\project\Dynamic\AtomCMS\Functions\data.php:8 Stack trace: #0 C:\xampp\htdocs\project\Dynamic\AtomCMS\Config\setup.php(15): data_setting_value(Object(mysqli), 'debug-status') #1 C:\xampp\htdocs\project\Dynamic\AtomCMS\index.php(1): include('C:\xampp\htdocs...') #2 {main} thrown in C:\xampp\htdocs\project\Dynamic\AtomCMS\Functions\data.php on line 8

This the code on data.php: function data_setting_value($dbc, $id){ $q = "SELECT * FROM settings WHERE id = '$id'"; $r = mysqli_query($dbc, $q);

$data = mysql_fetch_assoc($r);

return $data['value'];

}

and this the code on setup.php:

$debug = data_setting_value($dbc, 'debug-status');

Why it is not taking $r variable? Please help, i am stuck.

creptor commented 8 years ago

You have to use mysqli, and not mysql. Code:

$data = mysqli_fetch_assoc($r);