MYSQL and PHP - Quick Question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
azylka
Forum Commoner
Posts: 40
Joined: Sat Dec 06, 2008 9:11 pm

MYSQL and PHP - Quick Question

Post by azylka »

How can you specify multiple requirements so I can delete a specific record in my database? Would I just list with a comma like:

Code: Select all

<?php
// GET variables
$email = $_GET['email'];
$file = $_GET['file'];
$folder = $_GET['folder'];
// Connect to MySQL
CONNECTION HERE
// Specify req's for delete
mysql_query("DELETE FROM uploads WHERE email=$email, file=$file, folder=$folder");
or die(mysql_error());  
?>
Thanks,
Alex
User avatar
Mirge
Forum Contributor
Posts: 298
Joined: Thu Sep 03, 2009 11:39 pm

Re: MYSQL and PHP - Quick Question

Post by Mirge »

mysql_query("DELETE FROM uploads WHERE email='$email' AND file='$file' AND folder='$folder'") or die(mysql_error());

Also see: http://www.php.net/mysql_real_escape_string/
azylka
Forum Commoner
Posts: 40
Joined: Sat Dec 06, 2008 9:11 pm

Re: MYSQL and PHP - Quick Question

Post by azylka »

That works well! Thank you SO much!
:drunk: :D
Post Reply