Code: Select all
$row['id'];Database is called and is told to give a list of all stores related to a college. It spits em out. Then, the user should be able to click on the store's name which by doing so, says: "Hey, I'm 7-Eleven and my Unique ID is 5. Carry over 5 to the next page so that all the items related to store 5 (that's me!) are displayed."
That's the best I can explain it. Here's the code:
university.php
Code: Select all
<?php
///Connection Stuff
$host = "localhost";
$user = "user";
$pass = "pass";
$db = "food";
$table = "places";
mysql_connect ($host,$user,$pass) or die ( mysql_error ());
mysql_select_db ($db)or die ( mysql_error ());
$query = "select places.* from schools, places where places.pid = '$school' AND places.pid = schools.pid";
$result = mysql_query($query)
or die(mysql_error());
?>
<table cellspacing="2" cellpadding="2">
<tr> <td>Name</td> <td>Address</td> <td>Hours</td><td>PID</td></tr>
<?php
while($row = mysql_fetch_array( $result )) {
echo "<tr><td>";
echo $row['name'];
echo "</td><td>";
echo $row['address'];
echo "</td><td>";
echo $row['hours'];
echo "</td><td>";
echo $row['id'];
echo "</td></tr>";
}
echo "</table>";
?>Code: Select all
<?php
echo "$store";
///Connection Stuff
$host = "localhost";
$user = "user";
$pass = "pass";
$db = "food";
$table = "items";
mysql_connect ($host,$user,$pass) or die ( mysql_error ());
mysql_select_db ($db)or die ( mysql_error ());
$query = "select items.* from places, items where items.pid = $store";
$result = mysql_query($query)
or die(mysql_error());
?>
<table cellspacing="2" cellpadding="2">
<tr> <td>Item</td> <td>Category</td></tr>
<?php
while($row = mysql_fetch_array( $result )) {
echo "<tr><td>";
echo $row['name'];
echo "</td><td>";
echo $row['category'];
echo "</td></tr>";
}
echo "</table>";
?>Thanks for all help in advance.