Jump to content

[SOLVED] Error when updating database


scarlson

Recommended Posts

Your quotes are messed up at the end

 

mysql_query("UPDATE login SET lName = '$lName', fName = '$fName', address = '$address', zip = '$zip', phone = '$phone', start_date = '$start_date'")or die(mysql_error());

 

You do know you don't have a WHERE clause, right? That will update EVERY record in your DB.

Link to comment
Share on other sites

That took care of the error but my query is not updating my database.  I am also not getting any errors either.  What might be wrong?

 

if(isset($_SESSION['myusername'])){

include "dbconnect.php";

if($_POST['submit']) {

$username = $_SESSION['myusername'];
$logid_query = mysql_query("SELECT * FROM login WHERE username='$username'");
$logid_array = mysql_fetch_array($logid_query);
$logid = $logid_array['id'];


$fName = $_POST['fName'];
$lName = $_POST['lName'];
$address = $_POST['address'];
$zip = $_POST['zip'];
$phone = $_POST['phone'];
$start_date = $_POST['start_date'];

$tod_girls = $_POST['tod_girl_clothes'];
$tod_boy = $_POST['tod_boy_clothes'];
$kid_girl = $_POST['kid_girl_clothes'];
$kid_boy = $_POST['kid_boy_clothes'];
$women = $_POST['women_clothes'];
$men = $_POST['men_clothes'];
$furniture = $_POST['furniture'];
$games = $_POST['games'];
$sporting_goods = $_POST['sporting_goods'];
$sports_mem = $_POST['sports_mem'];
$cookware = $_POST['cookware'];
$tools = $_POST['tools'];
$hunting_fishing = $_POST['hunting_fishing'];
$exercise = $_POST['exercise_equip'];
$jewlery = $_POST['jewlery'];
$arts_crafts = $_POST['arts_crafts'];
$pictures = $_POST['pictures'];
$paintings = $_POST['paintings'];
$rugs = $_POST['rugs'];
$electronics = $_POST['electronics'];
$house_app = $_POST['house_appliances'];
$books = $_POST['books'];
$antiques = $_POST['antiques'];
$auto = $_POST['auto'];
$seasonal = $_POST['seasonal'];
$computers = $_POST['computers'];
$toys = $_POST['toys'];
$baby_items = $_POST['baby_items'];
$lawn_equip = $_POST['lawn_equip'];
$machinery = $_POST['machinery'];
$media = $_POST['media'];
$pets = $_POST['pets'];
$misc = $_POST['misc'];

mysql_query("UPDATE seller SET lName = '$lName', fName = '$fName', address = '$address', zip = '$zip', phone = '$phone', start_date = '$start_date' WHERE login_id = '$logid' "); 


}

}

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.