Jump to content

[SOLVED] Ezy question DROP TABLE help please


ccrevcypsys

Recommended Posts

I am trying to make it to where when someone clicks [delete] it will delete the data out of the database but i cant seem to get it to work. I know its a n00b question but it should be ez to figure out.

 

<?php
$deletetable = $db->select("DROP ".$glob['dbprefix']."CubeCart_inventory where productId=");

$artist_console->assign("VAL_DELETE_LINK",$deletetable);

?>

I could be confused about what you are doing here, but if you are just deleting a row, the correct command is DELETE.  DROP is for tables.  In fact, it is best if you mySQL user would not even have DROP priv. on the database at all. 

 

In fact, DELETE is dangerious, too, but you should get this working so you know what to do. 

 

DELETE FROM table WHERE condition

 

Once you get comfortable with that, make a field in a table called deleteme or whatever.  When somebody deletes something, mark it as 1.  If you don't have permission to DELETE anything, then if your site gets hacked somehow, at least no rows will be deleted.

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.