Ok guys, I am building a prototype ticket system where I have user profiles
<li><a href="profile.php?user=<?php echo escape($user->data()->username); ?>">Profile</a></li>
a users details are stored in `users table in my database.
I also have a gig table called bands
. I show the bands with this code
Band code
<?php
require 'core/init.php';
$Band_id = $_GET['id'];
$result = mysql_query("SELECT * FROM bands WHERE Band_id = $Band_id");
echo "<table border = '1'>
<tr>
<th>Band Name</th>
<th>Venue</th>
<th>Category</th>
<th>Stock</th>
<th>Add</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" .$row['Name']. "</td>";
echo "<td>" .$row['Venue']. "</td>";
echo "<td>" .$row['Category']. "</td>";
echo "<td>" .$row['Stock']. "</td>";
echo "<td><button>Buy Ticket</button></td>";
echo "</tr>";
}
echo "</table>";
?>
I have just made a new table called orders
. with two rows, band_id and user_id.
question
how can I build a query that would insert the band id from the current band and the current logged in user to the table order
so I can use it later? (insert on button click)
Any help will be fantastic as I am rather stuck, Thank you.
Im thinking Insert `$Band_id` and `$user` in to `order` table.