thedigicraft / Atom.CMS

Atom.CMS
56 stars 52 forks source link

What problem is this ? #240

Open saweetha opened 6 years ago

saweetha commented 6 years ago

Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given in C:\xampp\htdocs\series\dynamic\AtomCMS\functions\data.php on line 8

creptor commented 6 years ago

I can't help you if I don't show me your code. Please post it here (please just copy the code and don't use an image) so I can understand what you're trying to do and try to fix your problem.

Because this has to do with your database it would be great if you could post an image of the tables you're trying to get information from.

saweetha commented 6 years ago

<?php

function data_setting_value($dbc, $id){

$q = "SELECT * FROM settings WHERE id = '$id'";
$r = mysqli_query($dbc, $q);

$data = mysqli_fetch_assoc($r);

return $data['value'];

}

function data_page($dbc, $id) {

$q = "SELECT * FROM pages WHERE id = $id";
$r = mysqli_query($dbc, $q);

$data = mysqli_fetch_assoc($r);

$data['body_nohtml'] = strip_tags($data['body']);

if($data['body'] == $data['body_nohtml']) {

    $data['body_formatted'] = '<p>'.$data['body'].'</p>';
} else {

    $data['body_formatted'] = $data['body'];
}

return $data;

}

?>

this is the code

creptor commented 6 years ago

I'm sorry, I wasn't very specific.

I actually need the code of the whole file, not just specific sections of it. Without this I'm unable to understand your logic, and the process that generates the error.

In this case I also need some database information, because the error reports that some value is invalid.

Please add that information to this thread for more help, and please try to use markdowns to make it more readable. Link here.