I have a mysqli_query
like this:
SELECT a.* FROM (SELECT `id` as `id`, `age` as `age` FROM `register` WHERE `age` !="") as a INNER JOIN (SELECT `one` as `f1` FROM `friends` WHERE `two`='".$my_id."' UNION SELECT `two` as `f2` FROM `friends` WHERE `one` = '".$my_id."') as b ON a.id=b.f1
When I run this in my SQL
it gives no error and shows a successful query but if I run it in my browser I get this error
( ! ) Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in C:\wamp\www\functions.php on line 585
Please anyone with an idea on how I can fix this?
This is my entire code
<?php
$con = mysqli_connect('localhost','root','');
mysqli_select_db($con, 'qings');
$my_id = '1';
// the line below is my line 585
$query = mysqli_query($con, "SELECT a.* FROM (SELECT `id` as `id`, `age` as `age` FROM `register` WHERE `age` !="") as a INNER JOIN (SELECT `one` as `f1` FROM `friends` WHERE `two`='".$my_id."' UNION SELECT `two` as `f2` FROM `friends` WHERE `one` = '".$my_id."') as b ON a.id=b.f1");
?>