Forum Moderators: coopster

Message Too Old, No Replies

adding an update option for users.

         

shezzey

8:25 pm on May 15, 2009 (gmt 0)

10+ Year Member



I have this so far
if($_REQUEST['Title']!="")
{
if($year=="")$year="NULL";
$Title=htmlentities($_REQUEST['Title']);
$ArtistFirstName=htmlentities($_REQUEST['ArtistFirstName']);
$ArtistLastName=htmlentities($_REQUEST['ArtistLastName']);
$year=htmlentities($_REQUEST['year']);
mysql_query("INSERT INTO cds (Title,ArtistFirstName,ArtistLastName,year)
VALUES('$Title','$ArtistFirstName', '$ArtistLastName','$year');");
}

if($_REQUEST['action']=="del")
{
mysql_query("DELETE FROM cds WHERE id={$_REQUEST['id']};");
}

not sure how to create an update option off of the action

abidshahzad4u

1:36 pm on May 16, 2009 (gmt 0)

10+ Year Member



Simple use the ID to update the table like

UPDATE cds set Title='$Title', ArtistFirstName='$ArtistFirstName', ArtistLastName='$ArtistLastName', year = '$year' where id=$_REQUEST['id'];

Put this in appropriate setions like del statment. You can check this through as

if(isset($_REQUEST['id']))
{
//Your Query will be here
}