class DeleteClass{
public function deleteSomething($item2,$uniqueField2,$table2){
$query = mysql_query("DELETE FROM '$table2' WHERE '$uniqueField2' = '$item2'");
if(!query){
echo mysql_error();
}
}
}
class DeleteClass{
public function deleteSomething($item2,$uniqueField2,$table2){
$query = mysql_query("DELETE FROM `$table2` WHERE '$uniqueField2' = '$item2'");
if(!query){
echo mysql_error();
}
}
}
Don't be afraid to use Google for questions like these:
http://www.google.com/search?hl=en&q=mysql+single+quote+in+query&cts=1242734304962&aq=6&oq=mysql+singl e+

$query = mysql_query("DELETE FROM '".$table2."' WHERE '".$uniqueField2."' = '".$item2."'");
$post_this_val_instead = mysql_real_escape_string($_POST['some_field_name']);
in my block of code
class DeleteClass{
public function deleteSomething($item2,$uniqueField2,$table2){
$query = mysql_query("DELETE FROM '$table2' WHERE '$uniqueField2' = '$item2'");
if(!query){
echo mysql_error();
}
}
}
this returns an error... but if i remove the single quotes from the php variables in the query.. it works.. why??? i thought you were supposed to add single quotes to php variables in querys?
class DeleteClass{
public function deleteSomething($item2,$uniqueField2,$table2){
$query = mysql_query("DELETE FROM `" . $table2 . "` WHERE `" . $uniqueField2 . "` = `" . $item2 . "`");
if(!query){
echo mysql_error();
}
}
}
"SELECT * FROM `" . $tablename . "` WHERE....."
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Top 21 PHP Programming mistakes | thexchord | PHP | 18 | Yesterday 09:52 AM |
| Help: expand/collapse menu with php and mysql | ChiDao | PHP | 1 | February 2 '06 01:54 PM |
| Getting apache, mySQL, and PHP to run.. | web_designers | Linux, Apache, MySQL, PHP (LAMP) Server Help | 0 | June 28 '05 01:22 PM |
| Php print & highlighting problem | japaja | PHP | 0 | April 14 '03 02:34 PM |
| Basic PHP Uploads Tutorial | thexchord | Coding Articles & Tutorials | 2 | May 2 '02 09:28 PM |