detox Posted January 28, 2010 Share Posted January 28, 2010 i HAVE THIS NEAT LITTLE BIT OF CODE the request data is sent from 1st page to second page with the action code if(isset($_REQUEST['555']) && $_REQUEST['555'] =="delete"){ @mysql_query("DELETE FROM frm_BSALE WHERE did=".$_REQUEST['delid']." and pidid ='".$_REQUEST['id']."'"); $_REQUEST['page'] = "protect"; } it gets the request data from: <a href="del.php?id=<? echo $row['pidid']; ?>&555=delete&delid=<? echo $row['delid']; ?>"> This setup works great and deletes the data. I tried to change this to UPDATE THE TABLE INSTEAD of delete BUT IT WONT WORK this is what i did: if(isset($_REQUEST['555']) && $_REQUEST['555'] =="delete"){ $query_add="UPDATE `frm_bfiles` SET `pidtwo`='".$_REQUEST['pidtwo']."' WHERE `did`='".$_REQUEST['delid']."' AND `pidid` =".$_REQUEST['id']; $result=mysql_query($query_add); $_REQUEST['page'] = "protect"; } <a href="del.php?id=<? echo $row['pidid']; ?>&555=delete&delid=<? echo $row['delid']; ?>&pidtwo=5"> Help please, also what is the @? in from of mysql_query used for? Thank you Link to comment https://forums.phpfreaks.com/topic/190072-sql-update-from-link/ Share on other sites More sharing options...
detox Posted January 28, 2010 Author Share Posted January 28, 2010 MY SQL version: 5.0.67 Link to comment https://forums.phpfreaks.com/topic/190072-sql-update-from-link/#findComment-1002833 Share on other sites More sharing options...
fenway Posted January 28, 2010 Share Posted January 28, 2010 Define "not work" -- and show us the actual query. Link to comment https://forums.phpfreaks.com/topic/190072-sql-update-from-link/#findComment-1002976 Share on other sites More sharing options...
detox Posted January 28, 2010 Author Share Posted January 28, 2010 NOT WORK = THE DATABASE IS'NT GETTING UPDATED, YET IT GETS UPDATED WHEN USING "DELETE FROM" BUT NOT WHEN I USE "UPDATE' PLEASE DEFINE "ACTUAL QUERY" :-\ Link to comment https://forums.phpfreaks.com/topic/190072-sql-update-from-link/#findComment-1002999 Share on other sites More sharing options...
detox Posted January 28, 2010 Author Share Posted January 28, 2010 I really wish i could edit my previous post instead of writing another reply!! I realize the difference between the two action queries, i sub'd BSALE for frm_bfiles but other than that, it is i beleive exact Link to comment https://forums.phpfreaks.com/topic/190072-sql-update-from-link/#findComment-1003004 Share on other sites More sharing options...
detox Posted January 29, 2010 Author Share Posted January 29, 2010 i used the original code below and substituted delete from with update and set i used a defined integer as value for update and it worked good night! if(isset($_REQUEST['555']) && $_REQUEST['555'] =="delete"){ @mysql_query("DELETE FROM frm_BSALE WHERE did=".$_REQUEST['delid']." and pidid ='".$_REQUEST['id']."'"); $_REQUEST['page'] = "protect"; } Link to comment https://forums.phpfreaks.com/topic/190072-sql-update-from-link/#findComment-1003470 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.