Jump to content

Recommended Posts

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

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.