Hi all, Does anybody know how to convert a number to a string? I'm using in_array, and when I retrieve the data from the mysql database it is returned as a string and not a number. onehundredandtwo.
Why do you save such data in your database? You better change the way you insert data from your mysql db, save numbers as numbers! or as characters but in the numeric format!
Huh you said "Does anybody know how to convert a number to a string?" and then "it is returned as a string and not a number." So do you want number to string or string to number and why maybe there is another way around. Anyway to convert int to String maybe something like: $mynum = (string)$mynum; and oppoiste for String to int like: $mystr = (int)$mystr;
You would definitely be better off using an int type field in your DB if all the data in that column is a number.
The data in the database is already stored as an integer, but it's returned as a string. I just found the intval() function and it seems to work fine. Thanks for your help anyway guys!