My function returns true but my code does not execute



Hi,

I must be missing something obvious.

I cannot get this function to run the update query on Line 6, although
the call to run the query evaluates true, and both update_cat_total
functions execute, while the function itself returns true.

A var_dump shows that all the variables are valid, and I can run the
exact same update query at the mysql command line without errors. I've
echoed mysql_error() before and after the call to mysql_query() and no
errors show up.

But the update itself never runs! Can anyone see why?

function new_category($category_id=null) {
global $category_id_new;

if (create_category($_SESSION['cat_name'])) {
// update this page with the new category_id
$query = "UPDATE
about
SET
category_id = $category_id_new
WHERE
about_id = $_SESSION[about_id]";

if ($result = mysql_query($query)) {
if (update_cat_total('add', $category_id_new) &&
update_cat_total('remove', $category_id)) {
return true;
}
else {
return false;
}
}
else {
return false;
}
}
else {
return false;
}
}

Thanks


J Moore
.



Relevant Pages

  • FPDB: Parameter Update Not Working When Non-Param Works
    ... I have an update query ... The first one gives an error message of: ... Database Results Wizard Error ... I do not get any message about a missing parameter (which you usually get if ...
    (microsoft.public.frontpage.client)
  • Re: brand new here
    ... Takeadoe wrote: ... I'm at the entry level right now, ... (it was missing in the source). ... update query to change the null values to 2005 ...
    (comp.databases.ms-access)
  • Re: SQL Error Help
    ... What you are missing is that an INSERT statement adds records. ... OR perhaps you want an UPDATE query and not an insert query? ... Run-time error 3137: ... Missing semicolon at end of SQL statement ...
    (microsoft.public.access.queries)
  • Re: How to run a Query from code
    ... I was missing the quotes ... "Dave" wrote in message ... trying to run an Update query in the on click event of a button ...
    (microsoft.public.access.queries)
  • Re: REPLACING BLANK FIELDS WITH DATA BASED ON ANOTHER FIELD
    ... Bear in mind: ... I'm sure an Update query ... will do the trick but can't begin to suggest how to create it. ... Prev by Date: ...
    (microsoft.public.access.tablesdbdesign)