Basically im getting this error:
arning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in C:\Users\Test\xampp\htdocs\prototype\administrator\new_promotion.php on line 73
This is the offended lines of code, the last being line 73:
$sql = "SELECT * FROM promotions WHERE order='$order'";
$result = mysqli_query($myconnection, $sql);
$count = mysqli_num_rows($result);
I used the following lines to help debug:
var_dump(mysqli_error($myconnection));
var_dump($result);
Which produces:
string(155) "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 'order='5'' at line 1"
bool(false)
I understand and have proved it is returning false, really what I want it to produce is 0 as I have an if condition which checks the value of $count, which is obviously currently null.
My biggest issue with all of this is I have this exact thing running elsewhere with no problems! I copied and pasted it, changed the variables and now somehow it doesnt work for this part of the site!
$sql = "SELECT * FROM songs WHERE position='$newposition'";
$result = mysqli_query($myconnection, $sql);
// Mysql_num_row is counting table row
$count = mysqli_num_rows($result);
Both order and newposition are ints yes, newposition works fine. both get their values the same way from a POST.
Anybody know whats going on
? Currently going mental
arning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in C:\Users\Test\xampp\htdocs\prototype\administrator\new_promotion.php on line 73
This is the offended lines of code, the last being line 73:
$sql = "SELECT * FROM promotions WHERE order='$order'";
$result = mysqli_query($myconnection, $sql);
$count = mysqli_num_rows($result);
I used the following lines to help debug:
var_dump(mysqli_error($myconnection));
var_dump($result);
Which produces:
string(155) "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 'order='5'' at line 1"
bool(false)
I understand and have proved it is returning false, really what I want it to produce is 0 as I have an if condition which checks the value of $count, which is obviously currently null.
My biggest issue with all of this is I have this exact thing running elsewhere with no problems! I copied and pasted it, changed the variables and now somehow it doesnt work for this part of the site!
$sql = "SELECT * FROM songs WHERE position='$newposition'";
$result = mysqli_query($myconnection, $sql);
// Mysql_num_row is counting table row
$count = mysqli_num_rows($result);
Both order and newposition are ints yes, newposition works fine. both get their values the same way from a POST.
Anybody know whats going on
