Lets print out the first row in the result set:

"; printf("First Name: %s
\n", mysql_result($result,0,"first")); printf("Last Name: %s
\n", mysql_result($result,0,"last")); printf("Address: %s
\n", mysql_result($result,0,"address")); printf("Position: %s
\n", mysql_result($result,0,"position")); echo "
"; //reset result counter if(mysql_data_seek($result, 0)) { echo "Now lets loop through all of the rows in the table\n"; // Loop through the results and print in a table echo "\n"; while ($myrow = mysql_fetch_row($result)) { printf("\n", $myrow[1], $myrow[2], $myrow[3]); } echo "
Name
%s %s%s
\n"; } echo "
"; // define variables $first = 'Charlie'; $last = 'Watts'; $address = "Miami, USA"; $position = "drummer"; // Add some data into the database $sql = "INSERT INTO employees (id,first,last,address,position) VALUES (NULL, '$first', '$last', '$address', '$position')"; //$sql = "INSERT INTO employees (id,first,last,address,position) VALUES (NULL, 'blah', 'blah','blah', 'drum')"; $new_result = mysql_query($sql); if (!$new_result) { die("Couldn't Add Information: " . mysql_error()); } else { echo "Thank you! Information entered."; } ?>