Breana Posted February 7, 2009 Share Posted February 7, 2009 Ok, i bought this script SE and for the last 2 weeks they have not given me support or help so i am seeking help outside I am trying to make my own plugin, and it's 99% done. I can call the info, save the info by user id. everything but i am stuck at adding the row to the DB! If i ad it maually it works fine but i cant add someone each time they sign up i have a life here lol. I made the id of the row auto_increment. > gametag_id And added the insert code to the php page. but it just wont add a new row no error nothing. Here is my code from the new plugin for SE if($task == "create_new_id") { $database->database_query("INSERT INTO `se_gametags` (`gametag_id`, `gametag_user_id`, `gametag_note`, `gametag_active`) VALUES ( '', '".$user->user_info[user_id]."', 'No Personal Note Set!', 1)"); } How do i get it to add a new row in the table?? Link to comment https://forums.phpfreaks.com/topic/144221-add-a-new-row-in-table/ Share on other sites More sharing options...
wizardry Posted February 7, 2009 Share Posted February 7, 2009 do you have a connection to the database? echo your statement to see what is going on if (!$con) { die ('could not connect: ' . mysql_error()); echo mysql_errno($con) . " : " . mysql_error($con). "\n"; } // in your case change $sql to your sql string name, and $con to your connect name if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } hope this helps Link to comment https://forums.phpfreaks.com/topic/144221-add-a-new-row-in-table/#findComment-756958 Share on other sites More sharing options...
Breana Posted February 7, 2009 Author Share Posted February 7, 2009 Yes i have a connect to DB, $database->database_query I have one default in the table all ready id 1, i can update it delete it read it. It's just not letting me add a new row... I am at my wits end here... Link to comment https://forums.phpfreaks.com/topic/144221-add-a-new-row-in-table/#findComment-757066 Share on other sites More sharing options...
peranha Posted February 7, 2009 Share Posted February 7, 2009 Try this and see what it does. if($task == "create_new_id") { $database->database_query("INSERT INTO se_gametags (gametag_user_id, gametag_note, gametag_active) VALUES ('{$user->user_info['user_id']}', 'No Personal Note Set!', '1')"); } Assuming $user->user_info['user_id'] is set. Do yo have any errors? Link to comment https://forums.phpfreaks.com/topic/144221-add-a-new-row-in-table/#findComment-757069 Share on other sites More sharing options...
Breana Posted February 7, 2009 Author Share Posted February 7, 2009 Lol at first no it did not work... As i was getting ready to break my keyboard i realized i forgot to add. $new_id = $_POST['my_id']; lol. It works now my bad... Link to comment https://forums.phpfreaks.com/topic/144221-add-a-new-row-in-table/#findComment-757072 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.