[PHP-DB] number_format problem

2003-11-05 Thread Dillon, John
I want to show a number from a database in the format x,xxx.00 in a textfield, then if it is changed by the user I want to post the value of the number to a decimal field. However, once you number_format the number it becomes a string, and numbers like 3,379.90 give a value of 3 when posted to

Re: [PHP-DB] number_format problem

2003-11-05 Thread jeffrey_n_Dyke
could you cast as a float/double before inserting? $number = (double) $string; don't know what would happen to the comma, but i assume it would just get removed?? just a guess/thought Jeff

Re: [PHP-DB] number_format problem

2003-11-05 Thread Peter Beckman
On Wed, 5 Nov 2003, Dillon, John wrote: I want to show a number from a database in the format x,xxx.00 in a textfield, then if it is changed by the user I want to post the value of the number to a decimal field. However, once you number_format the number it becomes a string, and numbers like

RE: [PHP-DB] number_format problem

2003-11-05 Thread Aleks @ USA.net
Great answer... One question though, how would you convert it back to X,xxx.00 format?? Thanks Aleks -Original Message- From: Peter Beckman [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 05, 2003 10:48 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] number_format problem On Wed,

RE: [PHP-DB] number_format problem

2003-11-05 Thread Peter Beckman
On Wed, 5 Nov 2003, Aleks @ USA.net wrote: Great answer... One question though, how would you convert it back to X,xxx.00 format?? number_format($variable,2); --- Peter Beckman

Re: [PHP-DB] number_format problem

2003-11-05 Thread CPT John W. Holmes
From: Dillon, John [EMAIL PROTECTED] I want to show a number from a database in the format x,xxx.00 in a textfield, then if it is changed by the user I want to post the value of the number to a decimal field. However, once you number_format the number it becomes a string, and numbers like

Re: [PHP-DB] number_format problem

2003-11-05 Thread CPT John W. Holmes
From: [EMAIL PROTECTED] could you cast as a float/double before inserting? $number = (double) $string; don't know what would happen to the comma, but i assume it would just get removed?? Everything after and including the first non-number character would be dropped. So $12,000.34 would end

[PHP-DB] Unsuscribe

2003-11-05 Thread massey
Unsubscribe -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DB] number_format problem

2003-11-05 Thread CPT John W. Holmes
From: Peter Beckman [EMAIL PROTECTED] On Wed, 5 Nov 2003, Dillon, John wrote: I use this: $x['funds'] = (int)preg_replace(/[\$,]/,,$x['funds']); where $x['funds'] contains something like $3,249,555.32, and the end result is an int of 3249555. I drop the cents... you want to keep

Re: [PHP-DB] number_format problem

2003-11-05 Thread jeffrey_n_Dyke
sweet. thanks for hte correction. i try, sometimes i fail. :) CPT John W.

Re: [PHP-DB] Unsuscribe

2003-11-05 Thread CPT John W. Holmes
From: [EMAIL PROTECTED] Unsubscribe No thanks. I like it here. ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DB] number_format problem

2003-11-05 Thread CPT John W. Holmes
From: [EMAIL PROTECTED] sweet. thanks for hte correction. i try, sometimes i fail. :) But trying is half the battle. GI JOE! ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-DB] Help: do ... while, reverse data query

2003-11-05 Thread Douglas Freake
Hi there, I need to do a loop where the mysql query starts at the bottom and goes up, as if the data was in reverse order. This is for building a category/ sub_category menu. Data structure: (cat_id, cat_sub, cat_name) sample routine: do { $sql = SELECT * FROM categories

Re: [PHP-DB] Help: do ... while, reverse data query

2003-11-05 Thread CPT John W. Holmes
From: Douglas Freake [EMAIL PROTECTED] I need to do a loop where the mysql query starts at the bottom and goes up, as if the data was in reverse order. This is for building a category/ sub_category menu. Data structure: (cat_id, cat_sub, cat_name) sample routine: do { $sql = SELECT *

[PHP-DB] Select Value with 's

2003-11-05 Thread Aleks @ USA.net
This is a basic question but I am all messed up and need to be straightened out.. Have a select field called customer that works great except when there is a ' in the customer name. Have tried addslash and stripslashes but I think I might be using them wrong. If I addslash to the select

Re: [PHP-DB] Help: do ... while, reverse data query

2003-11-05 Thread Boyan Nedkov
you can do it at sql level by using ORDER BY ... DESC like: SELECT * FROM categories WHERE cat_id = '$cat' ORDER BY cat_id DESC and then proceed the returned recordset in 'normal' way (order) -- Douglas Freake wrote: Hi there, I need to do a loop where the mysql query starts at the bottom and

Re: [PHP-DB] Select Value with 's

2003-11-05 Thread ma
hi! do not quite understand your problem.. pls post some code? heres a small snippet that should work well... $qry = 'SELECT `customer` FROM `customerList` ORDER BY `customer`'; $res = mysql_query($qry); while($customer = mysql_fetch_object($res)) { echo stripslashes($res-customer).'br'.\n;

[PHP-DB] SQL SERVER 2000 with PHP and FOR XML clause

2003-11-05 Thread Orlik, Edward \[BRAM:1281:EXCH\]
Hi, Has anybody had any luck using the ODBC libraries in PHP to connect to a SQL Server 2000 database and passing in a SELECT with a FOR XML clause. I keep getting Warning: odbc_execute(): SQL error: [Microsoft][ODBC SQL Server Driver][SQL Server]The FOR XML clause is not allowed in a CURSOR

RE: [PHP-DB] Select Value with 's

2003-11-05 Thread Aleks @ USA.net
Ok.. First I build my select list: SELECT NAME=Cid size=1 OPTION Selected VALUE=All Customers/OPTION ? While ($Site = mysql_fetch_array($S)) { $Sid = $Site[CID]; $SName = htmlspecialchars($Site[Customer]); echo(option value='$SName'$SName/options\n); } ? /select The

Re: [PHP-DB] Select Value with 's

2003-11-05 Thread CPT John W. Holmes
From: Aleks @ USA.net [EMAIL PROTECTED] First I build my select list: SELECT NAME=Cid size=1 OPTION Selected VALUE=All Customers/OPTION ? While ($Site = mysql_fetch_array($S)) { $Sid = $Site[CID]; $SName = htmlspecialchars($Site[Customer]); echo(option

RE: [PHP-DB] Select Value with 's

2003-11-05 Thread Aleks @ USA.net
Thanks John for the answer But... Now my select statement on the Result.php page errors out when The value has the [']in it. What the select statement looks like now Is Select * From customer Where customer.customer LIKE 'St Mary's Hospital' Error message is Warning

Re: [PHP-DB] Select Value with 's

2003-11-05 Thread ma
hi think you should use ' when you create the query and in the SQL-statement for comparison: $qry = 'SELECT * FROM customer WHERE customer.customer LIKE '.$FF.''; _ma # life would be easier if i knew the source code... Von: Aleks @ USA.net [EMAIL PROTECTED] Datum: Wed, 5 Nov 2003 13:52:51

RE: [PHP-DB] Select Value with 's

2003-11-05 Thread Aleks @ USA.net
Sorry I left out the exact form It is $info = mysql_query( Select * From customer Where customer.customer LIKE 'St Mary's Hospital'); -Original Message- From: ma [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 05, 2003 1:56 PM To: PHP-DB Subject: Re: [PHP-DB] Select Value

Re: [PHP-DB] Select Value with 's

2003-11-05 Thread ma
hi ok - than make it this way: $info = mysql_query( Select * From customer Where customer.customer LIKE St Mary's Hospital); anyways - shouldn't it be like this?: $FF = St Mary's Hospital; $info = mysql_query('Select * From customer Where customer.customer LIKE '.$FF.''); _ma # life would be

RE: [PHP-DB] Select Value with 's

2003-11-05 Thread Aleks @ USA.net
Tried both... Still no joy... The statement becomes $info = mysql_query('Select * From customer Where customer.customer LIKE St Mary's Hospital'); Maybe I need to be a little clearer... Seem that the sql statement is now getting the correct value But the extra ['] is confusing it

Re: [PHP-DB] Select Value with 's

2003-11-05 Thread ma
hi hm - it would help if you'd send us the code where you generate the query _ma # life would be easier if i knew the source code... Von: Aleks @ USA.net [EMAIL PROTECTED] Datum: Wed, 5 Nov 2003 14:23:06 -0500 An: 'ma' [EMAIL PROTECTED], 'PHP-DB' [EMAIL PROTECTED] Betreff: RE: [PHP-DB]

RE: [PHP-DB] Select Value with 's

2003-11-05 Thread Hutchins, Richard
Using your variables and query, the following, based on one of my own functional pages, the following should work: $FF = addslashes($_POST[Cid]); $info = mysql_query(Select * From customer Where customer.customer LIKE '$FF' ); Give it a shot. Hope this helps. Rich -Original Message-

RE: [PHP-DB] Select Value with 's

2003-11-05 Thread Aleks @ USA.net
BINGO Thanks Rich... I just realized were I was going wrong with my attempt Of addslashes I forgot to remove the ['s] in the $_POST statement. I had $FF = addslashes($_POST ['Cid']); Thanks for MA and John for your help also Hope to return the favors.. Aleks -Original

RE: [PHP-DB] Select Value with 's

2003-11-05 Thread Hutchins, Richard
You are most welcome, Aleks. Glad it helped. -Original Message- From: Aleks @ USA.net [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 05, 2003 3:01 PM To: 'Hutchins, Richard'; 'PHP-DB' Subject: RE: [PHP-DB] Select Value with 's BINGO Thanks Rich... I just realized were I

[PHP-DB] Re: Having problems on search engines.

2003-11-05 Thread phillippe . natividad
Hello, I'm having problems surfing to different search engines (e.g. yahoo, google, and the like) since after putting the address to the address bar, it redirects me to another site which is called searchalot.com and makes a prefix of a certain IP address and making the address I input look

[PHP-DB] SELECT COUNT - result from two tables

2003-11-05 Thread Mark Gordon
I cannot seem to get a SELECT COUNT for a query from fields in two different tables and a WHERE clause. Does anyone know if this is not possible with php/mysql or am I doing something wrong? I have tried a number of variations on the following code: $sql = SELECT COUNT(*), bandid, bandname,

Re: [PHP-DB] SELECT COUNT - result from two tables

2003-11-05 Thread John W. Holmes
Mark Gordon wrote: I cannot seem to get a SELECT COUNT for a query from fields in two different tables and a WHERE clause. Does anyone know if this is not possible with php/mysql or am I doing something wrong? I have tried a number of variations on the following code: $sql = SELECT COUNT(*),

Re: [PHP-DB] Re: Having problems on search engines.

2003-11-05 Thread John W. Holmes
[EMAIL PROTECTED] wrote: Hello, I'm having problems surfing to different search engines (e.g. yahoo, google, and the like) since after putting the address to the address bar, it redirects me to another site which is called searchalot.com and makes a prefix of a certain IP address and making

Re: [PHP-DB] SELECT COUNT - result from two tables

2003-11-05 Thread Mark Gordon
Yes, query is definitely working without COUNT(*). Even in the most stripped down form, the query fails: $sql = SELECT COUNT(bandid), genre FROM bands, genre; $result=mysql_query($sql); while ($gen=mysql_fetch_row($result)) { echo $gen[1]; } John W. Holmes [EMAIL PROTECTED] wrote: Mark Gordon

Re: [PHP-DB] SELECT COUNT - result from two tables

2003-11-05 Thread John W. Holmes
Mark Gordon wrote: Yes, query is definitely working without COUNT(*). Even in the most stripped down form, the query fails: $sql = SELECT COUNT(bandid), genre FROM bands, genre; $result=mysql_query($sql); while ($gen=mysql_fetch_row($result)) { echo $gen[1]; } Fails how? If it echos zero, it's

[PHP-DB] SQL COUNT vs mysql_num_rows

2003-11-05 Thread [EMAIL PROTECTED]
maybe mysql cannot COUNT the result from more than 1 table, hence the mysql_num_rows function - but isn't it good programming practice to get the SQL to do as much work up front? - Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard

Re: [PHP-DB] SELECT COUNT - result from two tables

2003-11-05 Thread Boyan Nedkov
Putting more than one table in the FROM clause means tables are joined, then at least following problems could arise: - using WHERE clause you can have empty recordset returned and then COUNT conflicts with it because there is actually no any data to be returned; - joining two (or more)

Re: [PHP-DB] Problem

2003-11-05 Thread Boyan Nedkov
A bit difficult to debug this without the file included (config.php); providing the error message would also be helpful. At first glance, I'm just wondering what does the dot mean in the table name used in the FROM clause: FROM school.physics_chris_rockets It shouldn't generate a php syntacs

Re: [PHP-DB] SQL COUNT vs mysql_num_rows

2003-11-05 Thread Boyan Nedkov
if tables are joined correctly it shouldn't be any problem to get count of a column, and yes - delegating that task to the database should be more efficient concerning the execution time boyan -- [EMAIL PROTECTED] wrote: maybe mysql cannot COUNT the result from more than 1 table, hence the

Re: [PHP-DB] Problem

2003-11-05 Thread George Patterson
On Thu, 06 Nov 2003 05:46:03 +0100 Boyan Nedkov [EMAIL PROTECTED] wrote: A bit difficult to debug this without the file included (config.php); providing the error message would also be helpful. At first glance, I'm just wondering what does the dot mean in the table name used in the FROM

[PHP-DB] SELECT Count - solved

2003-11-05 Thread [EMAIL PROTECTED]
Thanks for the debug advice - I will start using my_sql_error First I got this error: Mixing of GROUP columns (MIN(),MAX(),COUNT()...) with no GROUP columns is illegal if there is no GROUP BY clause So the correct code ended up: $sql = SELECT COUNT(bandid), genre FROM bands, genre GROUP BY

[PHP-DB] Problem Solved

2003-11-05 Thread Jacob Hackamack
Thanks for your help, I was able to go through line by line and fix what was wrong, I guess a simple rewriting of some code solved it because now its better and faster then before. Thank You all. Jacob

[PHP-DB] Adding a log file

2003-11-05 Thread Robert Sossomon
I am seeing some errors with a program I wrote and I need to write everything to a log file that the program is doing. The following syntax I KNOW is wrong, but not sure they are important to put here correctly yet. //script addtocart $Addcart (info1, info2) Mysqlquey($addcart) I am seeing

[PHP-DB] Re: Adding a log file

2003-11-05 Thread Bogdan Stancescu
$Addcart() -- is Addcart() a function (in which case you should remove the dollar sign) or are you specifically trying to do some magic there by running a function whose name is stored in that variable? Bogdan Robert Sossomon wrote: I am seeing some errors with a program I wrote and I need to

[PHP-DB] RE: [PHP] Re: Adding a log file

2003-11-05 Thread Robert Sossomon
Like I said, syntactically bogus, I was trying to write it out fast while I was away from the actual scripts... Like I said, for the MOST part the pieces are working, however on some items it is acting correctly yet the items are not showing up in the shopping cart or in the database anywhere.

Re: [PHP-DB] RE: [PHP] Re: Adding a log file

2003-11-05 Thread jeffrey_n_Dyke
if you want actual errors that PHP generates and not logic based errors, then writing your own error handling function and calling it with set_error_handler() at the top of your scripts may work for you. in your function you'd just need to use $errorstr, $errorfile and $errline and log it using

[PHP-DB] Re: [PHP] php|cruise - do unto others...

2003-11-05 Thread CPT John W. Holmes
From: Becoming Digital [EMAIL PROTECTED] php|cruise is coming this March. Final word on this, I promise! :) I'll be on the cruise, so I'm looking forward to meeting anyone else that'll be there. Contact me offline if you want. I wanted to say think you to all of those that contributed to the