wenxi Posted June 10, 2007 Share Posted June 10, 2007 if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "retrieved")) { $updateSQL = sprintf("UPDATE user SET first_name=%s, last_name=%s, `add`=%s, `date_of_ birth`=%s, contact_mobile=%s, contact_home=%s, date_join=%s, date_left=%s, uc_id=%s, course_id=%s, password=%s WHERE user_id=%s", GetSQLValueString($_POST['tffirstname'], "text"), mysql_select_db($database_conn, $conn); $Result1 = mysql_query($updateSQL, $conn) or die(mysql_error()); } ============================================================= from my table - textfield <td><input name="tffirstname" type="text" id="tffirstname" value="<?php echo $first; ?>" /></td> is it the correct way? Link to comment https://forums.phpfreaks.com/topic/54978-cant-insert-into-db/ Share on other sites More sharing options...
wenxi Posted June 11, 2007 Author Share Posted June 11, 2007 can anyone help? Link to comment https://forums.phpfreaks.com/topic/54978-cant-insert-into-db/#findComment-272120 Share on other sites More sharing options...
TEENFRONT Posted June 11, 2007 Share Posted June 11, 2007 you need to connect to the db before running a query..not after Link to comment https://forums.phpfreaks.com/topic/54978-cant-insert-into-db/#findComment-272147 Share on other sites More sharing options...
btherl Posted June 11, 2007 Share Posted June 11, 2007 I don't see a call to mysql_connect(). Is that your entire script? Link to comment https://forums.phpfreaks.com/topic/54978-cant-insert-into-db/#findComment-272155 Share on other sites More sharing options...
wenxi Posted June 11, 2007 Author Share Posted June 11, 2007 My codes are as attached [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/54978-cant-insert-into-db/#findComment-272166 Share on other sites More sharing options...
lewis987 Posted June 11, 2007 Share Posted June 11, 2007 you have multiple connections to the mysql database, how about moving it to the top of the page ike this: <?php $mysqlHost="localhost"; $mysqlUsername="root"; $mysqlPassword=""; mysql_connect($mysqlHost,$mysqlUsername,$mysqlPassword) require_once('Connections/conn.php'); ?> <?php //initialize the session if (!isset($_SESSION)) { session_start(); }.......................... rather than the script connecting multiple times Link to comment https://forums.phpfreaks.com/topic/54978-cant-insert-into-db/#findComment-272205 Share on other sites More sharing options...
wenxi Posted June 11, 2007 Author Share Posted June 11, 2007 okie already did what you said. wat is the method to update my database? It doesnt seems to work on my side still Link to comment https://forums.phpfreaks.com/topic/54978-cant-insert-into-db/#findComment-272308 Share on other sites More sharing options...
wenxi Posted June 11, 2007 Author Share Posted June 11, 2007 please help.... Link to comment https://forums.phpfreaks.com/topic/54978-cant-insert-into-db/#findComment-272562 Share on other sites More sharing options...
lewis987 Posted June 11, 2007 Share Posted June 11, 2007 how do you mean "update" as in instert a new row or update a previous row? Link to comment https://forums.phpfreaks.com/topic/54978-cant-insert-into-db/#findComment-272565 Share on other sites More sharing options...
wenxi Posted June 11, 2007 Author Share Posted June 11, 2007 update the previous Link to comment https://forums.phpfreaks.com/topic/54978-cant-insert-into-db/#findComment-272612 Share on other sites More sharing options...
lewis987 Posted June 11, 2007 Share Posted June 11, 2007 i guess you coded this software, i cant find a problem to be honest can you post your scripts? or email them to me on [email protected] (add me on msn if needs be) Link to comment https://forums.phpfreaks.com/topic/54978-cant-insert-into-db/#findComment-272630 Share on other sites More sharing options...
wenxi Posted June 11, 2007 Author Share Posted June 11, 2007 yes. emailed and added you on msn... Link to comment https://forums.phpfreaks.com/topic/54978-cant-insert-into-db/#findComment-272651 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.