Hi Russ,

Thanks for the reply.

I was looking more along the lines of having one field, that might store
either a text value (such as the words "Not included"), or a numeric value,
such as 10.

The using PHP to determine if the value is numeric, perform a function on it
(such as a calculation) then display the result, otherwise, just display the
text.



-----Original Message-----
From: Russ [mailto:[EMAIL PROTECTED]]
Sent: Friday, 21 June 2002 2:53 PM
To: Matthew Nock; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Converting values from text to numerical


"is it possible to have PHP covert numbers that are stored as text
strings
back into values it can calculate with?"

Mathew:

You can use PHP to convert these - dependant upon the way you store them
in your DB.
Foe example I sometimes need to store different types of data in the
same field (I suppose you need to do this to, othewise you'd store your
numerical data in another column) like so:

Russ|27|6|Michell (stored as a single string in your table)

This is my first name, age, height, and surname respectively.

You could then just use the explode() function to remove the pipes, and
pick out the values (integers in this case) from the resultant array
that explode() provides you with.

Hope this helps you out some.
Russ

-----Original Message-----
From: Matthew Nock [mailto:[EMAIL PROTECTED]]
Sent: Friday, June 21, 2002 12:43 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Converting values from text to numerical


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



--
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