Jump to content

Cant Insert into DB


wenxi

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.