You can only have one auto_increment column per table, which is why they had it the way it was (now that i see the table, i realise that).
So, what you can do is use mysql to handle the inserting of the id for you. Just change:
$query = "INSERT INTO prints
(artist_id, print_name, price,
size, description, image_name)
VALUES ('$a', '$pn', $p, '$s',
'$d', '$i')";
if ($result = @mysql_query ($query)) {
echo '<p>The print has been added.</p>';
} else {
echo '<p><font color="red"> Your submission could not be processed due to a system error.</font></p>';
}
// To
if(mysql_query("INSERT INTO prints (print_name, price, size, description, image_name) VALUES ('$pn', $p, '$s', '$d', '$i')")){
if(mysql_query("INSERT INTO prints (artist_id) VALUES (LAST_INSERT_ID())")){
echo '<p>The print has been added.</p>';
}else{
echo '<p><span style="color:red;">Your submission could not be processed due to a system error.</span><br>'.mysql_error().'</p>';
}
}else{
echo '<p><span style="color:red;"> Your submission could not be processed due to a system error.</span><br>'.mysql_error().'</p>';
}
It's not the cleanest example, and i'm not 100% sure it will work (as i've never dealt with last_insert_id), but you can find more info here:
http://dev.mysql.com...-unique-id.html
Edited by rc69, 08 March 2006 - 11:21 AM.