Re: Probleme with MySQL queries

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> I have :
>
> array(2) { ["module"]=>  string(12) "sousdomaines" ["deleteid"]=>
> string(3) "134" }
>
> But the ID is not deleted in mysql.

That seems to be your var_dump($_GET), which means that either if
(isset($_GET['deleteid'])) evaluates to FALSE or your SELECT does not
return results. Let's check:

if (strlen($_GET["deleteid"])) {
        var_dump($_GET["deleteid"]);
        $var = mysql_real_escape_string($_GET["deleteid"]);
        $query = mysql_query("SELECT * FROM table WHERE id={$var};")
or die("select error: " . mysql_error());
        var_dump(mysql_num_rows($query));
        if ($row = mysql_fetch_assoc($query)) {
            var_dump ($row);
            mysql_query("DELETE FROM table WHERE id={$row['id']}") or
die("delete error: " . mysql_error());
        }
}

> In must be away for 2 or 3 hours, I return after to continue this.
French lunch I'm guessing :-) I'm jealous! You guys know how to do
that, with your perfect cheese and sausage! I'll be away myself from
half past 2.

Try to keep your replies on the list - it's useful for others.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux