我有一个带有浮点变量的 mysql 表。我想将它们传递给 mongodb 集合,但是当我这样做时,php 将我的浮点变量转换为字符串。我尝试使用此代码将变量类型设置为浮点数,但它在每个字段中返回 1:
foreach( $mytables as $table => $struct ) {
$sql = mysql_query("SELECT num_auto FROM XL_10331_EXPLOIT_251012 where flightid like '191622'") or die( mysql_error() );
$count = mysql_num_rows( $sql );
// If it has content insert all content
if( $count > 0 ) {
while($info = mysql_fetch_row($sql)) {
$int_info=intval($info);
$mosql[]=($int_info);
}
// Starts new collection on mongodb
$collection = $modb->floatdb;
$collection->insert(array('num_auto'=>$mosql));
我找不到我的错误,任何帮助将不胜感激!谢谢!