|Ryan A wrote:
|
|> Hey everyone,
|> Thanks for your response,
|>
|> I did try the query without the single quote, with double quotes but didnt
|> work.
|> I do think that a dot is valid in the URL coz it seems to be working if
|> there are 2 zeros in the
|> decimal part. I even tried running the SQL in PHPMyAdmin with same
|> results...
|> and I did try this:
|>
|> total='".$p."'";
|>
|> I wonder if "total" is a mysql reserved word or something....
|>
|> Like I said before, i took that out and everythings running fine 'n
|> dandy...but am just curious as
|> to what was wrong...never know if it may come up again in future.
|>
|> Cheers,
|> -Ryan
|>
|>
|>

Sounds to me like your variable is being passed/interpreted as a string.
As such, 4 will never equal 4.00. 2.1 will never equal 2.10. You should
probably look at the printf() or sprintf() function to make sure that your
$p will be inserted into your query string as you expect it.

I'm not up on sprintf() format, but you would probably want something like
<?php $sql_p = sprintf("%1.2f", $p); ?>
then use $sql_p in your sql querystring.

HTH

Jeff

-- 
Registered Linux user #304026.   |  52FC 20BD 025A 8C13 5FC6
gpg key: B0890FED                |  68C6 9CF9 46C2 B089 0FED
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xB0890FED
Responses to this message should conform to RFC 1855.
========================================================================
A: Because it messes up the conversation.
Q: Why is top posting bad?
A: Top posting.
Q: What's the most annoying thing on mailing lists?

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

Reply via email to