RE: [PHP-DB] Re: Converting values from text to numerical

From: Date: Fri, 21 Jun 2002 06:37:15 +0000
Subject: RE: [PHP-DB] Re: Converting values from text to numerical
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-19937@lists.php.net to get a copy of this message
Hi All, upon looking at the link Russ gave me earlier... the PHP site recommends the use of is_numeric() function. This does exactly what I want.. there will only be numbers of text in the field. I can quickly run this returned result from the record through this function.. and if it is numeric, then I do one thing (the calc), if its just text, I just echo it to screen. I will be keeping any dates etc in separate fields. So, the is_numeric() does what i need :) Thanks everyone :) -----Original Message----- From: Andy [mailto:news.letters@gmx.de] Sent: Friday, 21 June 2002 4:22 PM To: php-db@lists.php.net Subject: [PHP-DB] Re: Converting values from text to numerical yes you can switch the type of var for examle with: $number = (integer)$textvar; But if you do store it as a textfield you want be able to do some special sql stuff directly in mysql. For example if you store the date as text in the db you want be able to filter out entries which are between x and y. Good luck, Andy -- ---------------------------------------------------- http://www.globosapiens.net Global Travellers Network! "Matthew Nock" <matthew@mnc.com.au> schrieb im Newsbeitrag news:DOEEJNAFHHEJMCCGIDPDGEBHCNAA.matthew@mnc.com.au... > I am about to build a database of products that will store features fore ach > product in a separate table. > > I need to be able to store both text and numeric values in this table, but > be able to perform mathmatical functions on the numeric variables. > > is it possible to have PHP covert numbers that are stored as text strings > back into values it can calculate with? > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.db (#19937) next »