kratsg Posted July 1, 2010 Share Posted July 1, 2010 Just a quick question for anyone who knows: Does mysql_fetch_*****() always return values from the database in the form of strings (regardless of what data type it is set in the database?) The reason I ask is I did something like the following: while($row = mysql_fetch_object($curr_data)){ var_dump($row); //.... //.... } Which outputted object(stdClass)#1 (3) { ["pid"]=> string(1) "1" ["description"]=> string(35) "Allows user to view survey results." ["expires"]=> string(1) "0" } Now, 'pid' and 'expires' are both set as integers in the database. There's nothing wrong with the values, but rather the type of values they are. ~kratsg. Quote Link to comment https://forums.phpfreaks.com/topic/206462-mysql_fetch_-question/ Share on other sites More sharing options...
PFMaBiSmAd Posted July 1, 2010 Share Posted July 1, 2010 From the documentation - Return Values Returns an array of strings that corresponds to the fetched row, or FALSE if there are no more rows. The data type of the php array elements are strings, even if the values are numbers or are defined as a numeric data type in the table. Due to php's loose data typing and automatic type casting, this is usually NOT an issue. Do you have a specific problem? Quote Link to comment https://forums.phpfreaks.com/topic/206462-mysql_fetch_-question/#findComment-1080003 Share on other sites More sharing options...
kratsg Posted July 1, 2010 Author Share Posted July 1, 2010 Hey, I don't particularly have a problem. It was just interesting when I dumped the object to see exactly what happened with the stored values (since I did use a join) and I was wondering if the periods also carried over in the property names: $statement_paginate = "SELECT perms.pid, perms.description, user_perms.expires FROM perms, user_perms WHERE user_perms.fk_uid = '$user_id' AND perms.pid = user_perms.fk_pid ORDER BY perms.pid ASC"; They appear not to. No problem here. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/206462-mysql_fetch_-question/#findComment-1080008 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.