Hello qazs,
Do you use the option AUTO_INCREMENT for the id column ? Perhaps that he can explain the result ...
The option AUTO_INCREMENT is very nice. When you use it isn't necessary to count the number of rows, an counter increment automaticaly.
fpepito
example:
id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT
here your code with modification:
[PHP]
$link = mysql_connect('localhost', '', '');
$db_list = mysql_list_dbs($link);
mysql_select_db('test');
// $result = mysql_query('SELECT * FROM myTable);
if(isset($_POST['submit']) && $_POST["submit"] == "Insert"){
// $rowCount = mysql_num_rows($result)+1;
$sql = "Insert into myTable (id, Name, Gender, Age, Year)
values (NULL, 'John', 'Male', 12, 1999)";
mysql_query($sql);
header("location:data.php");
}
echo printResult($result);
mysql_free_result($result);
mysql_close($link);
[/PHP]