First Record Missing???

Hello All, Im sure this is a very simple task but i have only been learning PHP for roughly 3 days and this seems to be beyond me. I have currently created a page which allows me to upload data and images to a mysql database and then i created another page which shows the data. At present there are 3 records in the database but only the 2nd and 3rd are showing? I have looked around online but i am struggling with the solution and would be grateful for any help. Be gentle with me if ive made any obvious mistakes.

[php]<?php
require(“db_con.php”);

$selected = mysql_select_db(“chaletpa_personals”,$dbhandle)
or die(“Could not select personals”);

//execute the SQL query and return records
$query = “SELECT * FROM details”;
$result = mysql_query($query) or die(“Could not select from table”);
?>[/php]

The above is shown before the tag and the below is used in the section

[php]<?php
//fetch tha data from the database

while ($row = mysql_fetch_array($result)) {
echo
"

";

while($row = mysql_fetch_array($result))
{
echo “

”;
echo “”;
echo “”;
echo “”;
echo “”;
echo “”;
echo “”;
echo “";
echo “”;
echo “”;
}
echo “
Name Age Email Telephone No. Sex Image
” . $row[‘name’] . “” . $row[‘age’] . “” . $row[‘email’] . “” . $row[‘tel’] . “” . $row[‘sex’] . “<img src=“customer_images/”. $row[‘image’] .”"/>
”;
}

//close the connection
mysql_close($dbhandle);

?>[/php]

Sorry again for any obvious mistakes :smiley:

why the two loops? Answer that question, and you will see why it’s always skipping record 1 :slight_smile:

Now i see. Thanks for all you help. Working perfect now. ;D

It’s good when someone learning to code can spot the problem area with just a helpful hint.
And the person learning to code the routine gets a sense of accomplishment.

Gratz :slight_smile:

Sponsor our Newsletter | Privacy Policy | Terms of Service