abdelelbouhy Posted February 14, 2012 Share Posted February 14, 2012 hello guys,this function just to get products_id function getProductId( $model, $importFrom = '' ) //retrun product id{ if( empty( $model ) ) { return 0; } if($importFrom == 'Play'){ $sql_where = " play_sku = '$model'"; }else{ $sql_where = " products_model = '$model'"; } $select_orderid_query_raw = "SELECT * FROM " . TABLE_PRODUCTS . " WHERE " . $sql_where; $select_orderid_query = tep_db_query($select_orderid_query_raw); $productsId = 0; while ( $orderId = tep_db_fetch_array($select_orderid_query) ) { $productsId = $orderId['products_id']; } return $productsId;}what happend is it return always 0 even that play_sku exists but when i hard code the $model to 5060164670018 which is the same if i pass it the function it return the right result$model i'm getting from file i read it with fgetcsv then i used the array to get the value of $model which is $arr[4] the $model field in sql is VARCHAR could it be because i'm looking for a number and the $model is passed as a stringplease help Link to comment Share on other sites More sharing options...
justsomeguy Posted February 14, 2012 Share Posted February 14, 2012 It will return 0 if the model is empty or the query doesn't return any records. You'll need to add debugging statements there to figure out which one of those is the case. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.