Ben bir tabloya bazı bilgiler eklemek için gereken bir form var. Sonra bu ovülden otomatik artış id kapmak ve sonraki insert deyiminde kullanabilirsiniz. Ben tüm son id kapma dışında işe almak. mysql_insert_id (?)
include("config.inc.php");
$link = mysql_connect($db_host,$db_user,$db_pass);
if(!$link) die ('Could not connect to database: '.mysql_error());
mysql_select_db($db_name,$link);
$query = "INSERT into `".$db_table."` (title_id,seg_ordering,seg_name,seg_description,seg_duration) VALUES ('" . $_POST['title_id'] . "','" . $_POST['seg_ordering'] . "','" . $_POST['seg_name'] . "','" . $_POST['seg_description'] . "','" . $_POST['seg_duration'] . "')";
mysql_query($query);
mysql_close($link);
include("config.inc.php");
$link = mysql_connect($db_host,$db_user,$db_pass);
if(!$link) die ('Could not connect to database: '.mysql_error());
mysql_select_db($db_name,$link);
function select_max_id($id="id",$my_table="jos_mad_segments")
{
$SQL = "SELECT MAX($seg_id) FROM ".$my_table;
$db->query($SQL);
if ($db->next_record())
{
$max_id = $db->f(0);
}
$db->close();
return $max_id;
}
//data insert 2 //
include("config2.inc.php");
$link = mysql_connect($db_host,$db_user,$db_pass);
if(!$link) die ('Could not connect to database: '.mysql_error());
mysql_select_db($db_name,$link);
$query = "INSERT into `".$db_table."` (seg_id,file_video_UNC,file_video_URL) VALUES ('" . '$max_id' . "','" . $_POST['file_video_UNC'] . "','" . $_POST['file_video_URL'] . "')";
mysql_query($query);
mysql_close($link);