hi
i have a booking form online for bands to book a studio for rehearsing or recording. (php and mysql)
Once they submit the form, they receive a summary email with an activation link.
When they click on the activation link, it goes to a login area where they can login to see if their booking has been activated. no probs.
They can log in at a later date and check to see if management has confirmed the booking.
The database table “bookings” contains the usual columns “names, phone, email , dates, time wanted etc.,” and an activation column and a confirmation column.
The confirmation column is boolean, so when I confirm the booking it will display the number 1 in a display table (and an array of other stuff associated with the booking that I want to display to them).
My problem is that when the user is logged in, the persons booking data is displayed with every other users data.
For example if I log into my bank website i dont see everyone elses savings accounts.
How do i code the mysql command to display the current logged in user and NOT the other users data???
the activation page with most of the coding:
<?php
include 'includes/connect.inc.php';
$id = $_GET['id'];
$query = "SELECT * FROM bookings WHERE activated='1' AND confirmation='0' ";
$result = mysql_query($query) or die("Query failed robbo:".mysql_error());
$qProfile = "SELECT * FROM bookings WHERE id='$id' ";
$rsProfile = mysql_query($qProfile);
$row = mysql_fetch_array($rsProfile);
extract($row);
$username = stripslashes($username);
$day_contact = stripslashes($day_contact);
$date_contact = stripslashes($date_contact);
$month_contact = stripslashes($month_contact);
$year_contact = stripslashes($year_contact);
$start_contact = stripslashes($start_contact);
$hour_contact = stripslashes($hour_contact);
echo "<form method=\\"post\\" action=\\"layout\\" >\\r\
";
echo "<fieldset>\\r\
";
echo "<legend>Activated Bookings List</legend>\\r\
";
echo "<br />\\r\
";
echo "<p>Welcome ". $_SESSION['first_name'] ." of ". $_SESSION['band_name'] ."!<br />\\r\
";
echo "This page Only displays Activated Bookings. <br />\\r\
";
echo "Username: ". $_SESSION['username'] ."<br />Day: ". $_SESSION['day_contact'] ."<br />Date: ". $_SESSION['date_contact'] ." ". $_SESSION['month_contact'] ." ". $_SESSION['year_contact'] ."<br />Starting at: ". $_SESSION['start_contact'] ." for ". $_SESSION['hour_contact'] ." <br /><br />Please check information above with table below and verify if necessary with management.</p>\\r\
";
echo "<table class=\\"rates\\" summary=\\"layout\\" >\\r\
";
echo "<caption>Activated Bookings Database Table</caption>\\r\
";
echo "<thead>\\r\
";
echo "<tr>\\r\
";
echo "<td scope=\\"col\\" colspan=\\"6\\" class=\\"result\\" >Database List of Activated Only Bookings</td>\\r\
";
echo "</tr>\\r\
";
echo "</thead>\\r\
";
echo "<tbody>\\r\
";
echo "<tr>\\r\
";
echo "<td scope=\\"row\\" class=\\"wbordgr9l\\" >Day</td>\\r\
";
echo "<td scope=\\"row\\" class=\\"wbordgr9l\\" >Date / Month / Year </td>\\r\
";
echo "<td scope=\\"row\\" class=\\"wbordgr9l\\" >Start Time</td>\\r\
";
echo "<td scope=\\"row\\" class=\\"wbordgr9l\\" >Username</td>\\r\
";
echo "<td scope=\\"row\\" class=\\"wbordgr9l\\" >Booking Activated <br />[ Yes = 1 ] [ No = 0 ]</td>\\r\
";
echo "<td scope=\\"row\\" class=\\"wbordgr9l\\" >Confirmed by Management [ Yes = 1 ] [ No = 0 ]</td>\\r\
";
echo "</tr>\\r\
";
while($line = mysql_fetch_array($result,MYSQL_ASSOC)){
echo "<tr>\\r\
";
echo "<td scope=\\"row\\" class=\\"wbordgr9l\\" >".$line['day_contact']."</td>\\r\
";
echo "<td scope=\\"row\\" class=\\"wbordgr9l\\" >".$line['date_contact']." / ".$line['month_contact']." / ".$line['year_contact']." </td>\\r\
";
echo "<td scope=\\"row\\" class=\\"wbordgr9l\\" >".$line['start_contact']." for ".$line['hour_contact']."</td>\\r\
";
echo "<td scope=\\"row\\" class=\\"wbordgr9l\\" >".$line['username']."</td>\\r\
";
echo "<td scope=\\"row\\" class=\\"wbordgr9l\\" >".$line['activated']."</td>\\r\
";
echo "<td scope=\\"row\\" class=\\"wbordgr9l\\" >".$line['confirmation']."</td>\\r\
";
echo "</tr>\\r\
";
}
echo "</tbody>\\r\
";
echo "</table>\\r\
";
echo "</fieldset>\\r\
";
echo "</form>\\r\
";
mysql_free_result($result);
mysql_close();?>
The above script works great if ya want to show everyones data!
Any help greatly appreciated!