I want to use this variable in a SQL statement and store it in a variable called $sql.
The following is a code segment that is producing a syntax error:
I am pretty sure the error is being caused by the where statement where I am trying to concatenate the $name variable into my sql statement.
$name = $_GET['name'];
$sql = "
select Coffee_SKU, Coffee_Name, category_name, coffee_details, coffee_price,
coffee_roast, coffee_grind, coffee_picture, coffee_weight, coffee_price,
coffee_shop_name
from coffee, coffee_shops, categories
where coffee_category_id = category_id and coffee_name like \'%" . $name . "%\'
";
$rs = mysqli_query($conn, $sql);


Sign In
Create Account


Back to top









