mysql - I have a php error. But I don't understand why -
i have problem in code. i'm trying make private chat. using php , mysql. have error: "fatal error: uncaught exception 'mysqli_sql_exception' message 'table 'b7_19757973_4hfbroup.asdfannedegraaff' doesn't exist" , know means table not exist. use code if table exist:
$query = mysqli_query($con, "select * `".$_session['senderreceiver']."`"); if(!$query) echo "the s not exists"; $query2 = mysqli_query($con, "select * `".$_session['receiversender']."`"); if(!$query2) echo "the f not exists";
but still error, how can fix this?
btw session made this:
$sender = $_session['username']; $receiver = $_post["name"]; $senderreceiver = $sender . $receiver; $receiversender = $receiver . $sender; $_session['senderreceiver'] = $senderreceiver; $_session['receiversender'] = $receiversender;
i'm sorry bad english , bad explanation. hope can me..
if table not exist, mysqli throw error.
try instead show tables 'tablename';
but 1 further concern: not save database table names inside session. it's bad practice , in 99% of cases not needed
Comments
Post a Comment