i want to delete everything in the images database.

$sql = "DELETE * FROM images";
$sql_result = mysql_query($sql,$connection) or die ("Could not connect to database");
$rows = mysql_num_rows($sql_result);

comes up with couldnot connect to database,

but if i cange it to.

$sql = "SELECT * FROM images";
$sql_result = mysql_query($sql,$connection) or die ("Could not connect to database");
$rows = mysql_num_rows($sql_result);
it works fine.

cheers. aron.

    instead of delete * from images try "DELETE FROM IMAGES"

      And when you do

      DELETE FROM images without the *.

        If you're nuking a whole table use TRUNCATE TABLE table_name as it's quicker than delete. If you actually need to know how many rows were deleted then you still will have to use DELETE FROM table and the number will be found with mysql_affected_rows

          Write a Reply...