Jump to content

problem with SELECT on multiple tables / Variables. Help!


patheticsam

Recommended Posts

Hi! I'm a little bit new to php and I'm having a little issue here.

 

Here' a little bit of my code so that I can explain :

 

<?php
require_once('auth.php');
?>
<?php

session_start();
?>
<?php 

$member = $_SESSION['SESS_MEMBER_ID'];

mysql_connect("localhost", "login", "pass") or die(mysql_error()); 
mysql_select_db("DB") or die(mysql_error()); 

$data = mysql_query("SELECT * FROM `order` WHERE member_id='$member'") 
or die(mysql_error());

while($info = mysql_fetch_array( $data ))

     {

$data2 = mysql_query("SELECT * FROM `inventory` WHERE item_id='$info['item_id']'") 
or die(mysql_error());

while($specs = mysql_fetch_array( $data2 ))

     {


echo "
order : ".$info['order_id']."<br />
item : ".$info['item_id']."<br />
status : ".$info['status']."<br />
payment : ".$info['payment']."<br />

    ";
    }
   }
mysql_close(); 
?>

 

 

As you can see I have the first select script wich will SELECT some data in "table1(order)" WHERE the member_id = $_SESSION['SESS_MEMBER_ID'] and after that I have to SELECT some other data into "table2(inventory)" but the thing is that it has to be WHERE = item_id='$info['item_id']'"  (So it depends on the data that has been select in the first select command.....)

 

Unfortunatly it's not working and can't seem to get it done.

 

Here's the error I'm getting :

 

 

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/content/m/a/z/mazemontana/html/login/members/shopping_cart.php on line 30

 

 

Please Help!

 

Thanks!!

 

 

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.