Discussions Search    Reviews    Search Aid    Buzzzz    Google@Omgili Add to iGoogle   Bookmark and Share

  Advanced Search



Help, printf problem



Hi,

I'm attemping:-

$blah = "pop";
$query = sprintf("UPDATE events SET event_title = %s WHERE event_id =
%s",$blah, $id);

It just doesn't do it. If I echo the $query it all looks ok. If I put
the "pop" in the expression it works.

$query = sprintf("UPDATE events SET event_title = 'pop' WHERE event_id =
%s", $id);

That works!

What's going on? Any help appreciated.

Thanks,

Paul

 Latest discussions from this group  (alt.comp.databases.mysql)

Vb.Net Integration  
[10 Jun 2008]
On Tue, 10 Jun 2008 18:58:12 +0100, "Tym" <spamtrap@ictis.n et I've had a wonderful idea...
for one of my apps, and don't know if it possible to do what I want... The app currently...
Help, printf problem  
[24 May 2008]
Hi, I'm attemping:- $blah = "pop"; $query = sprintf("UPDATE events SET event_title = %s...
s WHERE event_id = %s",$blah, $id); It just doesn't do it. If I echo the $query it all looks...
MySQL Query Browser: Access violation in module LIBMYSQL.DLL (VISTA)  
[13 May 2008]
On Tue, 13 May 2008 10:28:08 +0100, "Brian Cryer" <www.cryer.co.uk Each time I run a ...
query using MySQL Query Browser (version 1.2.12) I get the error: Access violation at...
More...




hi,

Oh poop!

If I put it like this it works. That is; poop is enclosed with (spaced
out for clarity):-

" ' poop ' "


$blah = "'poop'";
$query = sprintf("UPDATE events SET event_title = %s WHERE event_id =
%s", $blah, $id);

That works but why?

Any help appreciated.

Paul


Paul Fredlein <...@optusnet.com.au
> Paul



Oh double poop!

Of course...

Must remember to switch brain on before posting to news groups.

Sorry guys...

Paul



Paul Fredlein <...@optusnet.com.au
> > Paul

Discussion Title: Help, printf problem
Title Keywords: Help,  printf  problem