MySQL Forums
Forum List  »  PHP

Re: Input Query string from a file
Posted by: Peter Brawley
Date: September 17, 2017 01:57PM

$result = mysqli_query ($dbLink, 'SELECT fname, lname FROM ticket_tbl WHERE lname = $qfile ') ;

To get variable values to substitute for their names inside PHP strings, PHP needs double quotes round the strings. Read about strings and variables in the PHP manual.

SQL needs quotes round string values like $gfile.

So the query string needs to be:

"SELECT fname, lname FROM ticket_tbl WHERE lname = '$qfile' "

or

"SELECT fname, lname FROM ticket_tbl WHERE lname = \"$qfile\" "

(About the second alternative, read about the escape character in the PHP manual.)

But $gfile is a file name, not a person's name, so I can't make sense of that query.

Options: ReplyQuote


Subject
Written By
Posted
September 15, 2017 07:40PM
Re: Input Query string from a file
September 17, 2017 01:57PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.