in my tables like most i have an index no which is automaticaly created for each record, i label and reffer to this as 'ID'.
However what i want is to be able to find the 'ID' for the record i have just created.
The only way i have managed to do this is when creating a new record i set one of the labels with a marker value (tracer). Then once created i then do a rountine to pull the record for the marker i left, then providing me with the record 'ID'.
Is there an easier way for this.
// Create new record and drop marker..
$query1 = "INSERT INTO newsevents VALUES (
'',
'marker',
'',
'',
'',
''
)";
mysql_query($query1);
// Find new record, buy searching for marker
$result = mysql_query("SELECT * FROM newsevents WHERE title='marker'",$db);
while ($row = mysql_fetch_array ($result)) {
$newsevents_id = $row['id'];
}
the process i follow is i create a new record for a new news-article, then have that record pulled and opened for inputting data into it.
I know in some cases, it might be easyier to collect the data first then create a new record with that data there and then, however there is some work which i have many pages so i find saving the data collected as i go along better for me, hence the need to know the 'ID' for the new record i have created.