Re: My function returns true but my code does not execute



On Mon, 31 Oct 2005 09:54:48 +0100, in comp.lang.php Ewoud Dronkert
<firstname@xxxxxxxxxxxxxxxxxxxx> wrote:

>John Moore wrote:
>> $query = "UPDATE
>> about
>> SET
>> category_id = $category_id_new
>> WHERE
>> about_id = $_SESSION[about_id]";
>
>You can't use multi-line strings like that in PHP. I presume in your code
>it is actually written:
>
>> $query = "UPDATE about SET category_id = $category_id_new WHERE about_id = $_SESSION[about_id]";
>
>Then you can't use array values like that in strings. Zeldor was partly
>right that it needs quotes around the key (because that is a string, not a
>constant), but it also needs curly braces around the whole name if you are
>going to use it inside the string:
>
> $query = "... about_id = {$_SESSION['about_id']}";
>
>For goodness sake, see
>http://php.net/manual/en/language.types.string.php#language.types.string.parsing

Thanks,

I changed the query to read like this:

$query = "UPDATE about SET category_id = $category_id_new WHERE
about_id = {$_SESSION['about_id']}";

All on one single line.

But no dice- no update occurs! I've echoed out the query itself, and
the variables are showing up as they should:

UPDATE about SET category_id = 31 WHERE about_id = 5

I wrote this function to execute 2 more functions IF this query
evaluates true. Both these functions are executing, but the
category_id field is not updating.

I dont mind rewriting my code, but I wish I could understand why when
it doesn't work as expected.

Thanks to all of you for trying to help.



J Moore
.



Relevant Pages

  • Re: DB_E_ERRORSINCOMMAND Exception(_com_error:: vtable)
    ... strings, only UNICODE. ... Embedded MVP ... > In Embedded VC,While I execute an insertion query I am getting ...
    (microsoft.public.sqlserver.ce)
  • Re: execute append query
    ... copied sql from query into strings in vba in form, ... Dim qdfAppend as querydef ... > yes i did declare the parameter in the query and yes there was a suitable ...
    (microsoft.public.access.modulesdaovba)
  • Re: update table from form
    ... all my fields are text / strings and am trying to get form to update table ... as when get it to run query only updating first record. ... Dim stDocName As String ...
    (microsoft.public.access.formscoding)
  • Re: Please justify-who is right?
    ... use a different symbol would have broken almost all VS/APL and APL SV ... a tool that would find all slashes outside of strings or comments and either ... SQL code which writes SQL, though -- now that is difficult to read ... the APL "execute" primitive is horrible, ...
    (comp.lang.apl)
  • Newbie help with binary fields and locks
    ... If I were not doing this in a SQL database, I would set up an array of bits and simply look for the first zero bit. ... and a column to indicate the length of the varbinary field (which is really my maximum number of generateable strings). ... I am assuming that I can execute a Begin Transaction with the SqlCommand.ExecuteNonQuery method. ...
    (microsoft.public.sqlserver.server)