mysql_query($query) does not work
mysql_error() shows Query was empty
mysql_query("$query") works
What could be the probable reason?
$query = "
SELECT 
    field1a, 
    field1b, 
    field1c
FROM 
( 
    {$obj1->p1->p2['sub']}.table1
) 
LEFT JOIN 
    {$obj1->p1->p2['sub']}.table2
    ON 
    (
        field2a = field1d 
    ) 
WHERE 
    field1e = '$variable' ";
This is what i get when i echo the variable $query... just before passing to mysql_query
SELECT 
    field1a, 
    field1b, 
    field1c
FROM 
( 
    db.table1
) 
LEFT JOIN 
    db.table2
    ON 
    (
        field2a = field1d 
    ) 
WHERE 
    field1e = 'data' "; 
The variable $query holds the same data even after executing the function call
I have enabled and checked mysql logs开发者_运维技巧 where i find the query data to be empty in the first case and ...
The query data is present in the second case when i used mysql_query("$query)
Probably your $query is an empty variable.
so when you:
mysql_query($query)
You're basically doing mysql_query(); and gives an error.
when you do
mysql_error();
It even says it was empty because it's an empty var.
and when you do:
mysql_query("$query");
You just give an empty string to the function and yes it works because it is correct syntax.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论