In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says... > I did that with this script and it works fine, but the reason I am doing it > is so I can then give the image which is uploaded the story ID. But for some > reason I can't get it to work... here is the auto_increment script any ideas > of how to add the ID to the image?????? I would be very great ful if you > could amend the script (as I am a newb I can work things out once they have > been done if that makes any sense) > > cheers will > <? > > $db_name = "main"; > > $table_name = "main"; > > $connection = @mysql_connect("www.main.net", "main", "main") or die > ("couldn't connect."); > > $db = @mysql_select_db($db_name, $connection) or die ("couldn't select > database."); > > $sql = "INSERT INTO $table_name (id, name, email, picture_name) > VALUES ('$id', '$name', '$email', '$picture_name') "; > > $result = @mysql_query($sql, $connection) or die ("couldn't execute query");
First, if you are having trouble with a particular mysql query, try using mysql_error after the mysql_query t ogive you useful feedback; you are currently suppressing any useful output. Second, if you want to provide your own sequence of IDs, that's fine, but make sure that the type of data you are providing matches the field type you are adding it to. Your code above has quotes around the value being provided for id which marks it as a char type, or string, but I suspect that you probably have a numeric type in your table? -- David Robley Temporary Kiwi! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]