Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update syntax

Status
Not open for further replies.

gokeeffe

Programmer
Jan 11, 2005
170
IE
Greetings,

As you can see i'm an annoying newbie can anyone tell me

what is wrong with my code.

if ($j1 && $k1 && $l1 && $g1 && $h1 && $i1 && $a1)

{

// Insert Keys into table
$query = "UPDATE users SET contact_name = '$j1'
landline = '$k1'
mobile = '$l1'
county_id = '$g1'
town_region_name = '$h1'
extra_location_details = '$i1'
WHERE user_id = '$a1'";
$result = @mysql_query ($query); // Run the query

Tks in advance

Gaz
 
At the very least, you need commas between your assignment clauses:

UPDATE users SET contact_name = '$j1'[red],[/red]
landline = '$k1'[red],[/red]

etc.


However, if your script catches and reacts to errors, you can get some pretty good idea of what is wrong in your query. See FAQ434-2999

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Tks for the reply TANSTAAFL!!

I have inserted comma's but the data still won't enter my

mysql database. I've checked all of my variables are being

sent so it must be the update command somewhere.

any more ideas

Tks

Gaz
 
Are you getting any errors from your mysql_query() function?
Code:
$result = @mysql_query ($query);
if (!$result) echo 'Error in query: '.$query.'<br>'.mysql_error();

Ken
 
Sorry entered into the wrong forum

First time user
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top