Jump to content

SQL UPDATE FROM LINK


detox

Recommended Posts

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

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";	}

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.