Question

I have a table called settings, when I would change or enter data into the form it did not change the data in the table. In addition on form an image upload file is not running, There may be the wrong code below.

(Solved by me)

Maybe someone can help me Related to this.

Was it helpful?

Solution

What you are doing here is tottaly in secure and your data can be hacked / manipulate really fast.
Why dont you use a framework like codeignighter there are about 100 easy frameworks that will help you manage database a lot easyer.

Are you sure that you are updating the wrond ID? where id = 1, seems to be not dynamic.

Please post your error http://www.w3schools.com/php/func_mysql_error.asp

I know it is not so related to your question, but you should see these light frameworks:

http://kohanaframework.org/
https://github.com/ElbertF/Swiftlet
http://ellislab.com/codeigniter

OTHER TIPS

You're not checking the return status of of your query, so if it's not working you wouldn't know. Do this:

mysql_query("UPDATE settings SET site='$name',keywords='$keys',descrp='$desc',email='$email',fbpage='$fbpage',twitter='$twitter',gplus='$gplus',disclaimer='$disclaimer',template='$template' WHERE id=1")
 or die(mysql_error());

Note: mysql_*() is deprecated: you shouldn't use it. Use mysqli_*() or PDO instead.

Also: You are susceptible to an SQL Injection attack. You should escape your input variables with mysql_real_escape_string() (or the equivalent if you switch to mysqli), or consider moving to prepared statements.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top