Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am facing problem in this query.

$sql5="SELECT SUM(VAL) AS likes FROM like WHERE QNO='$question' AND CNO='$category'";
$result5=mysqli_query($db,$sql5) ;
$likes = mysqli_fetch_array($result5);     //line140

I is giving me the following warning

Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in C:\xampp1\htdocs\forum\question.php on line 140

i have tried everything, and nothing is working.

My Question is not duplicate as i have looked thoroughly in stackexchange.com too with no avail.

It gives the following error on doing mysqli_error($db);

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'like WHERE QNO='' AND CNO=''' at line 1

share|improve this question

marked as duplicate by Barmar Jan 2 at 4:31

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1  
You're getting an error from your query. Print mysqli_error($db) to see the error message. –  Barmar Jan 2 at 4:31
    
I think your problem is that your table name like –  Minh Quý Jan 2 at 4:31

1 Answer 1

You need to encapsulate your table name in acento (`) symbol.

For example like should be `like`

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.