Hello, I am new to php code (month or so) and mysql, I am pretty much teaching myself, I am good with HTML, CSS, JS, etc...
I am trying to create a DB for a client that is fairly simple; Add members (got that done); Verify member and post data below form when queried (Got that done) But the update process has been giving me MAJOR headaches...
The database is as follows:
Set up a test DB on my local server...
the DB = 'cannameds
the table = 'members'
right now I am only testing the first name field which = "first_name" but also have in the table "members":
Here is the field info on the table...
id: int(11) - - - no null - no default - auto_increment
first_name: varchar(25) - utf8-general_ci
last_name: varchar(25) - utf8-general_ci
dob_month: varchar(10) - utf8-general_ci
dob_day: varchar(10) - utf8-general_ci
dob_year: varchar(10) - utf8-general_ci
id_number: varchar(50) - utf8-general_ci
exp_month: varchar(10) - utf8-general_ci
exp_day: varchar(10) - utf8-general_ci
exp_year: varchar(10) - utf8-general_ci
notes: varchar(200) - utf8-general_ci
Here is the code I was trying but it does not update but also returns no errors, also when I put the raw data into the query UPDATE line it works but when I use the variables I have assigned it does not update...
I'm sure I have this all wrong as I am so new to php:
// "UPDATE `cannameds`.`members` SET `first_name` = \'Dale\' WHERE `members`.`id` = 1;";
mysql_query("UPDATE `cannameds`.`members` SET `first_name` = '$new_name' WHERE first_name='$old_name';") or die("ERROR:".mysql_error());
echo "You have updated $new_name's information. <a href='verify.php' title='go back to the verification page!'>Click here</a> to return to the verification page!";
Any help would be thoroughly appreciated, any suggestions for better code or heck a complete rebuild of the entire structure, I just need to get this code finished 3 days banging head against the wall ARGGGGHHHHH!