Hi there wondering if anyone can help me, I new to mysql and php and in really stuck...
Basically I have created a profile system that you have to register your account details eg username and password. These then go onto a database in MySQL. Once you have registered you then get the opportunity to then complete a profile form. This form has details like name, passport info, frequent flyer info etc.
This will then save into another separate MySQL database. Once the data is entered you then get taken back to the main screen.
The main screen has an option to amend the details you just entered and this is where my problem begins.
I would like to show just the record you have entered into the database but my coding displays all the other records in the database. I cannot figure out how to just display the ‘id’ I have just created.
I have attached my coding below, any help would be really appreciated as I’m beginning to pull out whatever hair I have left!
Thanks
James
include("connect.php");
$query = "SELECT * FROM profile ";
$result = mysql_query($query);
$num = mysql_num_rows ($result);
mysql_close();
if ($num > 0 ) {
$i=0;
while ($i < $num) {
$first_name = mysql_result($result,$i,"first_name");
$surname = mysql_result($result,$i,"surname");
$company_email = mysql_result($result,$i,"company_email");
$mobile_number = mysql_result($result,$i,"mobile_number");
$ba_number = mysql_result($result,$i,"ba_number");
$id = mysql_result($result,$i,"id");
echo "<b>first name:</b> $first_name<br>";
echo "<b>surname:</b> $surname<br>";
echo "<b>company email:</b> $company_email<br>";
echo "<b>mobile number:</b> $mobile_number<br>";
echo "<b>ba number:</b> $ba_number<br>";
echo "<a href=\"update.php?id=$id\">Update</a> - <a href=\"delete.php?id=$id\">Delete</a>";
echo "<br><br>";
++$i; } } else { echo "The database is empty"; }?>