I have a simple select statement with a where clause on my php file like so:
$con=mysqli_connect("hostname", "user", "pw", "db");
if (mysqli_connect_errno($con))
{
echo "Failed to connect to mySQL: " . mysqli_connect_error();
}
$getTitle = mysqli_query($con, "SELECT title FROM tblTitle WHERE category='" .$col."'") or die("ERROR: ". mysqli_error($con));
I've changed my code as suggested and added the quotation mark on my variable but now I'm getting an internal server error at the $getTitle line. Am I doing something wrong here? I can't print the error so I can't point out what's going on.
UPDATE: As suggested, I've used var dump on $getTitle and here's the message I got.
object(mysqli_result)#5 (5) { ["current_field"]=> int(0) ["field_count"]=> int(1) ["lengths"]=> NULL ["num_rows"]=> int(1) ["type"]=> int(0) }
No comments:
Post a Comment