class MailAuthGen{
var $mail='[email protected]';
var $findUid = "SELECT uid from 'accounts' where email='$mail'";
function abc() {
echo $this->findUid;
}
}
when I load this page, the page shows
Parse error: syntax error, unexpected '"'
Even
$findUid = "SELECT uid from 'accounts' where email='".$mail."'";
didn't work.
But, when I didn't use 'class', it executed well.
What's the problem?
The error is with this line. You can't evaluate any variables when declaring properties.
var $findUid = "SELECT uid from 'accounts' where email='$mail'";
// You can't do this ------^
A common workaround is something like:
var $findUid = "SELECT uid from 'accounts' where email='%s'";
Where you can interpolate the value later.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With