Can i pass variable as mysql table name in select statement?

Hi can i pass variable as mysql table name in select statement?
like as :
$note= “name_table”;

$rcount=“SELECT * FROM $note”;

i tried the above code but showing nothing, can anyone help me please.
Thanks in advance

Yes you can. Not sure why it is not working for you. But, it appears you are not using standard double-quotes. Test with this version which does work!

<?PHP
$note= "name_table";
$rcount="SELECT * FROM $note";
echo $rcount;
?>
1 Like

Thank you so much sir. My problem has been solved.

Sponsor our Newsletter | Privacy Policy | Terms of Service