Forgive me but I am very new to PHP and SQL.
I am simply trying to assign the results of an SQL query to a PHP variable ($num). The SQL query is counting how many times customer_id appears in a table. However when i use the code below i get the error :
Warning: mysql_result() expects parameter 1 to be resource, boolean given in ... line **
session_start(); is at the top of the page and {$_SESSION['userid']} is actually an integer value of the currently logged in user which corresponds to the customer_id in the bookings table. Database connection is the include/db_connection.php (which i know works). The code i am using currently is :
<?php
include 'include/db_connection.php'
$num = mysql_result(mysql_query("SELECT COUNT(*) FROM bookings WHERE customer_id={$_SESSION['userid']}"),0);
?>