Jump to content

mysql code displaying no data on echo


hance2105
Go to solution Solved by 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
Share on other sites

  • 3 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.