MySQL Forums
Forum List  »  PHP

How 2 use PHP variable in WHERE clause ?
Posted by: Fran Lee
Date: March 01, 2018 07:16PM

1 - I thought I had seen both thebelow work but tonight only the first example one works... correct?


$query_account = "SELECT * from accounts WHERE crm_accounts.acct_id='".$acct_id."'"; // example 1 works

$query_account = "SELECT * from accounts WHERE crm_accounts.acct_id=$acct_id"; // example 2 no working

2 - And, is there an alternate syntax when the WHERE clause is equals a PHP string or variable?

Thanks for any help.

Options: ReplyQuote


Subject
Written By
Posted
How 2 use PHP variable in WHERE clause ?
March 01, 2018 07:16PM


Sorry, only registered users may post in this forum.

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.