+ 2
Warning: mysqli_query() expects parameter 1 to be mysqli, bool given i.... WHY THIS ERROR ARRIVE BASICALLY I WHAT TO KNOW
can I know what is the problem with this code? I got this error every time with this query function. <?php $con = mysqli_connect("localhost","root","","voting") || die("not connected"); echo "connected"; if(isset($_POST['ele'])){ global $con; $vote_ele = "update votes set ele = ele + 1"; $run = mysqli_query($con,$vote_ele); if($run){ echo "voted to electronics"; } else{ echo mysqli_error($run); } } ?>
5 Respuestas
+ 3
thank you Drax
+ 1
Remove || die(... )
It cast the whole expression to a boolean, whilst con needs to be a mysqli object
0
yeah i did it
so finally i understood that after confirming dbs is connected we should remove die().Because i effects on mysqli_query()
0
while define
global $conn now its working thanks
0
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in /storage/ssd1/839/12482839/public_html/login.php on line 17