Jump to content

reading from 2 tables


piet

Recommended Posts

Hi, i am pretty new at this and would appreciate any help.

i need to read info from 2 tables. first table holds info about events and the second one holds venue details. the "venue_name" in the first table will determine the 2nd query. i suspect the problem is in this line. "$venue_name=$venue_name;"

i get output for the first query fine, but not the second.can anyone please tell me what i am doin wrong?

mysql_connect($server,$username,$password);
@mysql_select_db($database) or die ("Unable to connect to the database");

$id=$_POST['id'];
$do=mysql_query ("SELECT id,venue_name,event_date FROM calendar_events WHERE id='$id' ");
$x=mysql_num_rows($do);
if ($x>0) {
while ($row = mysql_fetch_array($do, MYSQL_ASSOC)) {
  $venue_name.=$row["venue_name"];
  $event_date.=$row["event_date"];
  $id.=$row["id"];
}
;}
echo "&total=".$x."&venue_name=".$venue_name."&event_date=".$event_date."&id=".$id;

$venue_name=$venue_name;
$do=mysql_query ("SELECT venue,street,town FROM venues WHERE venue='$venue_name' ");
$x=mysql_num_rows($do);
if ($x>0) {
while ($row = mysql_fetch_array($do, MYSQL_ASSOC)) {
  $venue.=$row["venue"];
  $street.=$row["street"];
  $town.=$row["town"];
}
;}
echo "&venue=".$venue."&street=".$street."&town=".$town;
?>

Link to comment
Share on other sites

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.