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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.