How would i go about inserting the data below to a specific user only. for example, from the username Ben and his password "cardboard."
<?php
// Connects to your Database
mysql_connect("blank.blank.ac.uk", "", "") or die(mysql_error());
mysql_select_db("dbBolives") or die(mysql_error());
$data = mysql_query("SELECT * FROM bookings")
or die(mysql_error());
Print "<table border cellpadding=3>";
while($info = mysql_fetch_array( $data ))
{
Print "<tr>";
Print "<th>id:</th> <td>".$info['id'] . "</td> ";
Print "<th>date:</th> <td>".$info['date'] . " </td></tr>";
Print "<th>start:</th> <td>".$info['start'] . "</td> ";
Print "<th>name:</th> <td>".$info['name'] . " </td></tr>";
Print "<th>email:</th> <td>".$info['email'] . "</td> ";
Print "<th>phone:</th> <td>".$info['phone'] . " </td></tr>";
Print "<th>comments:</th> <td>".$info['comments'] . " </td></tr>";
}
Print "</table>";
Based on your name
column, you could use a WHERE
clause:
("SELECT * FROM bookings WHERE name='BOB'")
as an example.
Or use a variable:
$name = "BOB";
then do
("SELECT * FROM bookings WHERE name='$name'")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.