Page 1 of 1
[SOLVED] Update Table Value Where
Posted: Fri Jul 10, 2009 4:48 pm
by radium35
want to update the table with the image name 06.jpg and add new info on the table
mysql_query ("UPDATE image_details SET caption, location , copyright, uploaded, credits, mature VALUES '$_POST[caption] ' , '$_POST[location]','$_POST[copyright]','$today','$_POST[credits]','$_POST[mature]' WHERE image_name = '$newimage' ");

Re: Table Value
Posted: Fri Jul 10, 2009 4:54 pm
by andyhoneycutt
your syntax for the update statement is all confused:
Check the manual.
p.s. nice imagenames for id's 5 & 6

Re: Table Value
Posted: Fri Jul 10, 2009 5:05 pm
by radium35
i have checked it still need help, i never post unless a go thru the manual.
Re: Table Value
Posted: Fri Jul 10, 2009 5:08 pm
by andyhoneycutt
radium35 wrote:i have checked it still need help, i never post unless a go thru the manual.
Had you gone through the manual you'd realize that UPDATE statements require a set a=b, c=d format, not a, b = c, d as you have in your logic.
Re: Table Value
Posted: Fri Jul 10, 2009 5:12 pm
by radium35
solved $result = mysql_query("UPDATE image_details SET location='$_POST[location]' WHERE image_name='$newimage' AND username='$username' ") or die(mysql_error());
Re: [SOLVED] Update Table Value Where
Posted: Sat Jul 11, 2009 12:26 am
by McInfo
Tell me what happens if I submit a form with this input to your script.
Code: Select all
<input type="text" name="location" value="nowhere', username='injector" />
PHP Manual:
SQL Injection
Edit: This post was recovered from search engine cache.
Re: [SOLVED] Update Table Value Where
Posted: Sun Jul 12, 2009 9:27 am
by radium35
hmm ah yes "Form Validation"! Wee
McInfo wrote:Tell me what happens if I submit a form with this input to your script.
Code: Select all
<input type="text" name="location" value="nowhere', username='injector" />
PHP Manual:
SQL Injection