Jump to content

Recommended Posts

hello

When iam trying to update a record on the db it update ALL the records their, i don't know where is the erorr !

 

 

 

Here is the action file.

$select="UPDATE dir_all SET wbname='$sitename', wbdisc='$sitedisc', wblink='$sitelink' WHERE id='$id'";
mysql_query($select) or die($select);
?>

Link to comment
https://forums.phpfreaks.com/topic/64953-update-data-problem/
Share on other sites

I have post the $id into another file called editdel.php, i know it doesn't make any sense to put the $id into the last code, but it works when i make a button for delete.

 

 

<?

//Delete.php

$del="DELETE FROM dir_all WHERE id='$id'";

 

//edit_action.php

$update="UPDATE dir_all SET wbname='$sitename', wbdisc='$sitedisc', wblink='$sitelink' WHERE id='$id'";

mysql_query($update) or die(error);

 

//editdel.php

 

<td bgcolor="#FBFBFB"><div align="center"><span class="style4"><span class="style4"></span></span><a href="edit_site.php?id=<? echo $row['id']; ?>">Edit</a></div></td>

     

<td bgcolor="#FBFBFB"><div align="center"><span class="style4"><span class="style4"></span></span><a href="delete.php?id=<? echo $row['id']; ?>">Delete</a></div></td>

 

may be the problem that the ?id= doesn't refer directly to edit_action.php, first its going to edit_site.php file . if this is true, how can i solve this problem !

Link to comment
https://forums.phpfreaks.com/topic/64953-update-data-problem/#findComment-324154
Share on other sites

IT seems that the query is ok.But if u are frequntly getting the problem,then repair the table using flush() command.

I too had the problem,in my case the new update affects some values of already existing data.But when I created the new table, the problem was ok.As far as I am concerned it is ok now.

Link to comment
https://forums.phpfreaks.com/topic/64953-update-data-problem/#findComment-324332
Share on other sites

Dont know if flush or repair or whatever will fix your problem, but from what i can see the only logical thing is that id isnt getting any value, but u should have a syntax error i guess. Try echoing $id before making the query to check if its getting a value.

Link to comment
https://forums.phpfreaks.com/topic/64953-update-data-problem/#findComment-324340
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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