Difference between revisions of "Add, delete, modify mysql data with php"

From thelinuxwiki
Jump to: navigation, search
(Pushed from thelinuxwiki.com.)
 
 

Latest revision as of 22:19, 25 February 2013

insert example 1:

 $query = "INSERT INTO ineedlist VALUES (,'$name','$type','$user','$strikethrough')";
 mysql_query($query);

change example 1:

         $update=mysql_query("UPDATE ineedlist SET strikethrough='1' WHERE id='$astrikethrough[$i]'") 
         or die (mysql_error());

delete example 1:

         $update=mysql_query("DELETE FROM dbasename WHERE var='value'") 
         or die (mysql_error());

delete example 2:

         $update=mysql_query("DELETE FROM ineedlist WHERE id='$astrikethrough[$i]'") 
         or die (mysql_error());