While I was coding my online store I got this strange error message that I never saw it before!
Fatal error: Can't use function return value in write context on line 5
Here's my code
<?php
if (isset($_GET['pro_id'])){
$product_id = $_GET['pro_id'];
$query = $con->query("SELECT * FROM viewcounter WHERE productcode='$product_id'");
if(mysqli_num_rows($query) = 0){
$insert_id = "insert into viewcounter (productcode) values ('$product_id')";
$insert_id = mysqli_query($con, $insert_id);
mysql_query("UPDATE viewcounter SET `views`=`views`+1 WHERE productcode='$product_id'")
}
$get_pro = "select * from products where product_id='$product_id'";
$run_pro = mysqli_query($con,$get_pro);
while($row_pro = mysqli_fetch_array($run_pro)){
$_SESSION['pro_id'] = $row_pro['product_id'];
$_SESSION['pro_cat'] = $row_pro['product_cat'];
$_SESSION['pro_brand'] = $row_pro['product_brand'];
$_SESSION['pro_title'] = $row_pro['product_title'];
$_SESSION['pro_price'] = $row_pro['product_price'];
echo '....';
";}}?>
And this is line 5 that I get the error message:
if(mysqli_num_rows($query) = 0){
Note: I skipped writing the code that connects my database here cause it's already alright!