zoomboom Posted June 22, 2008 Share Posted June 22, 2008 Hello, I am trying to do some calculations on the select stament and assigning the result to a different name. Here's the problem, I need to calculate the customers points based on sales value, items and recommendations. When I do SELECT int(value*items+recommendations) as points from MySQL I get the correct answer However, when I do this in PHP then points is always set to NULL. I don't know why. Any help appreciated! Link to comment https://forums.phpfreaks.com/topic/111302-selectas-problem-in-php/ Share on other sites More sharing options...
sasa Posted June 22, 2008 Share Posted June 22, 2008 can we see some code Link to comment https://forums.phpfreaks.com/topic/111302-selectas-problem-in-php/#findComment-571356 Share on other sites More sharing options...
zoomboom Posted June 22, 2008 Author Share Posted June 22, 2008 Here's the part that gets the values from the database: $sql="SELECT int(value*items+recommend) as points from customers order by points desc LIMIT 30"; $rs = $conn->Execute($sql); if($rs->recordcount()>0){$answers = $rs->getrows();} When I run the SQL directly on MySQL it works. I get results like: points 5679 4456 2345 etc... whereas when I run this in php I get a NULL for points Link to comment https://forums.phpfreaks.com/topic/111302-selectas-problem-in-php/#findComment-571391 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.