Page 1 of 1
DELETE * FROM
Posted: Tue Jul 11, 2006 1:50 pm
by SidewinderX
whats wrong with this?
Code: Select all
function DesignersDelete($designer, $site) {
global $prefix, $db;
$sql = mysql_query("DELETE * FROM ".$prefix."_theme_authors WHERE author='$designer'") or die("Error: ".mysql_error());
Header("Location: admin.php?op=ThemeSystem");
}
It dosnt delete the row, any ideas what is wrong with this?
Posted: Tue Jul 11, 2006 1:51 pm
by bdlang
You cannot specify a column, it's simply
Code: Select all
DELETE FROM sometable WHERE somecolumn= 1;
Posted: Tue Jul 11, 2006 2:33 pm
by SidewinderX
hm...im a little confused now
say i have the table named information, and the table is setup as follows
name address
John 350 PHP Lane
Bob 665 HTML Road
Jim 001 CSS Avenue
how would i design the query so it deletes
Bob 665 HTML Road
from the table?
it would be
Code: Select all
$sql = mysql_query("DELETE * FROM information WHERE name='Bob'") or die("Error: ".mysql_error());
wouldnt it?
Posted: Tue Jul 11, 2006 2:45 pm
by dull1554
Code: Select all
"DELETE * FROM information WHERE name='Bob'"
and maybe try this
Code: Select all
function DesignersDelete($designer, $site) {
global $prefix, $db;
$sql = "DELETE * FROM ". $prefix ."_theme_authors WHERE author='$designer'";
$query = mysql_query($sql) or Die("Error: " . mysql_error());
Header("Location: admin.php?op=ThemeSystem");
}
a query is nothing more then a string. what you had originally should have worked, but the code above should work... unless your colum names are different or something.
Posted: Tue Jul 11, 2006 2:46 pm
by bdlang
No, '*' is a column specifier.
Code: Select all
DELETE FROM information WHERE name='Bob';
MySQL Manual:
SQL syntax
MySQL Manual:
DELETE syntax
Posted: Tue Jul 11, 2006 2:49 pm
by dull1554
/////edit...im dumb
Posted: Tue Jul 11, 2006 2:49 pm
by SidewinderX
ohhhh that works like a charm
ty