Jump to content

mysql code displaying no data on echo


hance2105

Recommended Posts

hello guys, i am selecting records from 3 tables (2 more to come later) but when i echo the result, no error messages are displayed and no records are being retrieved. please verify the code below and let me know where i erred.

 

<?php session_start(); include('db_connect.php'); $username = $_SESSION['username']; $user = mysql_fetch_assoc(mysql_query("select user_id from tbllogin where username = '{$username}'")); $sql = ("SELECT prod_id FROM tblfavourites WHERE user_id = '$user[user_id]'"); $sql1 = ("SELECT ret_id FROM tblfav_ret WHERE user_id = '$user[user_id]'"); $query = mysql_query("SELECT p.prod_name, rp.prod_price, r.ret_nameFROM tblproduct AS pLEFT JOIN tblretprod AS rp  ON (rp.prod_id = p.prod_id)LEFT JOIN tblretailer AS r ON (r.user_id = rp.user_id)WHERE p.prod_id IN ($sql) AND r.ret_id IN ($sql1)"); $row = mysql_fetch_row($query); echo $row['prod_name']; ?> 

Link to comment
https://forums.phpfreaks.com/topic/279996-mysql-code-displaying-no-data-on-echo/
Share on other sites

  • 3 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.