Jump to content

debugging assistance...


nueamin

Recommended Posts

Thank You in Advance. I am rather frustrated at this juncture. Ive spent hours trying to work this one out. I also apologize completely for any of my poor coding standards. I would say i am self taught but I am actually learning off of forums like these. I have checked and rechecked the user name and password and it has all permissions. The echo $query produces a line which runs in the MySQL query window flawlessly. Is there something I am doing wrong or something I should look into. Thank You everyone for your time and help. Oh yea. What is wrong? The data that was input via form is not being input into the database, although the query echo shows the data in the string.

 

$db_username="nottelling";

$db_password="reallynottelling";

$database="realmof2_profiles";

 

$cfirst_name=$_POST['ud_first_name'];

$cmiddle_init=$_POST['ud_middle_init'];

$clast_name=$_POST['ud_last_name'];

$ce_mail=$_POST['ud_e_mail'];

$cphone=$_POST['ud_phone'];

$cstreet_ad=$_POST['ud_street_ad'];

$ccity=$_POST['ud_city'];

$cstate=$_POST['ud_state'];

$czipcode=$_POST['ud_zipcode'];

 

mysql_connect(localhost,$db_username,$db_password);

$query = sprintf("UPDATE contactinfo SET first_name='$cfirst_name', middle_init='$cmiddle_init', last_name='$clast_name', e_mail='$ce_mail',phone='$cphone', street_ad='$cstreet_ad', city='$ccity', state='$cstate', zipcode='$czipcode' WHERE user_id='$userid'");

echo $query;

mysql_query($query);

mysql_close();

echo '  </div>';

Link to comment
Share on other sites

Try adding the mysql_error() function like I've written below. It will print a database error in your web browser when you try to run the code.

$db_username="nottelling";
$db_password="reallynottelling";
$database="realmof2_profiles";

$cfirst_name=$_POST['ud_first_name'];
$cmiddle_init=$_POST['ud_middle_init'];
$clast_name=$_POST['ud_last_name'];
$ce_mail=$_POST['ud_e_mail'];
$cphone=$_POST['ud_phone'];
$cstreet_ad=$_POST['ud_street_ad'];
$ccity=$_POST['ud_city'];
$cstate=$_POST['ud_state'];
$czipcode=$_POST['ud_zipcode'];

$link = mysql_connect(localhost,$db_username,$db_password);
$query = sprintf("UPDATE contactinfo SET first_name='$cfirst_name', middle_init='$cmiddle_init', last_name='$clast_name', e_mail='$ce_mail',phone='$cphone', street_ad='$cstreet_ad', city='$ccity', state='$cstate', zipcode='$czipcode' WHERE user_id='$userid'");
echo $query;
mysql_query($query) or die mysql_error($link);
mysql_close();
echo '   </div>';

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.