Make the first record-id "1"
Posted: Sat Jan 24, 2009 9:16 am
I'm trying to get this to work:
The issue is the "MAX(linkid)+1".
It works like a charm if there is a record in my table with the current uid, but if the user don't have a record in the table it creates a new record but no linkid. How do I get passed this?
Code: Select all
$result = $db->sql_query("INSERT INTO ".$prefix."_link_names (linkid,uid,catid,name,url) "
."SELECT MAX(linkid)+1,'$uid','$category','$name','$link' FROM ".$prefix."_link_names WHERE uid=$uid");
It works like a charm if there is a record in my table with the current uid, but if the user don't have a record in the table it creates a new record but no linkid. How do I get passed this?