php - How to print a mysql query to view what's being sent -
i'm trying view (print or echo) on page actual query being sent following:
$req1 = mysql_query('select m1.id, m1.title, m1.date_time, count(m2.id) reps, users.username userid, users.username pm m1, pm m2,users ((m1.user1="'.$_session['username'].'" , m1.user1read="no" , users.id=m1.user2) or (m1.user2="'.$_session['username'].'" , m1.user2read="no" , users.id=m1.user1)) , m1.id2="1" , m2.id=m1.id group m1.id order m1.id desc');
i've tried looking on net way "echo $req1" returns resource id. wrong, username variable, , it's returning no records. please explain how actual query, it's running username variables, etc. print? can't figure out how it.
thank in advance genuis!!! :)
$sql = 'select m1.id, m1.title, m1.date_time, count(m2.id) reps, users.username userid, users.username pm m1, pm m2,users ((m1.user1="'.$_session['username'].'" , m1.user1read="no" , users.id=m1.user2) or (m1.user2="'.$_session['username'].'" , m1.user2read="no" , users.id=m1.user1)) , m1.id2="1" , m2.id=m1.id group m1.id order m1.id desc'; var_dump($sql); //then run $req1 = mysql_query($sql);
though mysql_*
functions deprecated - should using mysqli
or pdo
Comments
Post a Comment