Hi all,

Having a rather annoying problem with this lot of code.

Here is the function i've written that I am trying to use:

function deletewebpagefromdb($webid){
         dbconnect();
         $q = "DELETE FROM weblist WHERE websiteid = '$webid'";
         $result = mysql_query($query) or die("<b>A fatal MySQL error occured</b>.\n<br />Query: " . $q . "<br />\nError: (" . mysql_errno() . ") " . mysql_error());
         return $result;
}

When i run the query this is what is outputted:

Website ID: 299

A fatal MySQL error occured. 
Query: DELETE FROM weblist WHERE websiteid = '299'
Error: (1065) Query was empty

At the top i have echo'd out the websiteid, which is correct, so theres no problems with that.

Can anyone see any problem with this code?

    Because you define the query as $q and use $query in the mysql_query()

      HalfaBee;10888710 wrote:

      Because you define the query as $q and use $query in the mysql_query()

      Oh dear..

      takes knife to wrists

      Well spotted, thansk a lot 🙂

        Write a Reply...