Jump to content

help me. mysql update problem!


flashmonkey

Recommended Posts

Hi Fellows!

mysql update via form is not working. Here is the code:

 

$id=$_GET['id'];

if(isset($_POST['now']) && !empty($_POST['update'])){

$update=$_POST['update'];

$query="UPDATE achv_tbl SET achv_desc='$update' WHERE achv_id='$id';";

$result=mysql_query($query)or die(mysql_error());

 

I have granted all priviledges to the username. I am using mysql version 5.0.45. I have also tried copying the update sql code from phpmyadmin but still it is not working. Any help/suggestions will be highly appreciated. Thankz in advance! :)

 

EDIT:

Changed subject to conform to forum policy.

 

Link to comment
https://forums.phpfreaks.com/topic/90253-help-me-mysql-update-problem/
Share on other sites

I think you have an extra semicolon at the end of the query. It should end achv_id='$id'";, I'm pretty sure.

 

Well, I was wrong apparently. But remember to escape what's sent with the query with mysql_real_escape_string(), to avoid SQL injections.

No error appears on the mysql_error();. I have debugged the entire page multiple times and everything outputs correctly when i use echo "";. Entry/delete forms are working smoothly. I have also tried removing the extra ; but it still doesn't work. :'(

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.