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

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:[EMAIL PROTECTED]]
Sent: Friday, 21 June 2002 4:22 PM
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,


Global Travellers Network!

"Matthew Nock" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
> I am about to build a database of products that will store features fore
> 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

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

Reply via email to