[RESOLVED] Inserting into Database with error Unknown Column in field List.
Well I have this really stupid issue. I am not sure as to what is going on, but here is my issue.
Once someone confirms their account, I am automatically taking the information from the first database, retreving it, and then sending it off to other databases to write information and create login info.
This leads me to belevie that it is having an issue with inserting the username into the username field.
Could it be that since the variable is named exactly like the feild entry it is having an issue?
Here is the code.
PHP Code:
//connects to picture database and writes your info in there. try { $wpdb = new PDO('mysql:host=localhost; dbname=harcerze_pictures', 'harcerze_super', 'Boeing07'); $wpdb->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
//Creates the SQL statement to write into the picture database $pictureUPDATE = $wpdb->prepare ("INSERT INTO pe_users ( username, password, groupID ) VALUES ( $username, $passmd5, $groupID )");
//Executes the writing into the picture database $pictureUPDATE->execute(); echo("<p>Your account to upload photos is now active!</p>"); } //catches any errors that might have come from updating the picture databse catch (PDOException $ex) { $msg = $ex->errorInfo; error_log(var_export($msg, true)); die("<p>Sorry, there was a unrecoverable database error with PICTURES. Debug data has been logged.</p>"); }
For want of a nail...the horseshoe was lost. For want of a horseshoe, the steed was lost. For want of a steed...the message was not delivered. For want of an undelivered message.....the war was lost.
The error message 'Unknown column \'myusername\' in \'field list\' clearly show that there is no myusername column in the target database table.
The following SQL statement suggests that its you should try "username" instead of myusername.
$pictureUPDATE = $wpdb->prepare ("INSERT INTO pe_users (username, password, groupID)
VALUES ($username, $passmd5, $groupID)
Well if you look at my code, thats exactly what I have written...the same SQL statement that you have.
For want of a nail...the horseshoe was lost. For want of a horseshoe, the steed was lost. For want of a steed...the message was not delivered. For want of an undelivered message.....the war was lost.
ZABI!!! Thats great! Thanks so much! Works like a charm, the moment I was typing it I saw the varibles lightup white and I knew it was going to work! THANKS!
For want of a nail...the horseshoe was lost. For want of a horseshoe, the steed was lost. For want of a steed...the message was not delivered. For want of an undelivered message.....the war was lost.
Bookmarks