php mysql greater than issue -


I have two tables: users, pictures . Users have the column paid how many images they pay to enter this contest, this is a number .. In the images, a column has been entered There is no value of 0, and 1 for entry. I need the amount of money for each user.

I am trying to inquire from all the users who paid more images than the entries. But it does not work properly .. What does print:

  bob@example.com 8 2 jcannon@example.com 3 3 jrcih@example.com 7 3 aerwqeerll @ Example.com 5 1 ray @ example.com 2 3   

You can see that the jaccon @ and ray should not be in the list, because the paid entry is no more than

Code here:

  $ SQL = mysql_query ("SELECT *, SUM (images.entered) users, images WHERE users.id = images.owner and users.paid & SUM (images.entered) 'Group by users.id'); while ($ sendto = mysql_fetch_array ($ SQL)) {print $ sendto ['email']. "". $ Sendto ['Payment'] "". $ Sendto ['SUM (images.entered)'] "& lt; Br> What can I do?   

Get rid of quotation marks first, they are for verbal strings. Second, you can compare the values ​​collected only with the clause:

  one ?? | WHERE รข ?? | Users have paid & gt; = SUM (images.entered)   

apart from this, instead of the WHERE To make use of the syntax, I make it very clear:

 Include images from  SELECT *, SUM (images.entered) users at IN.ER users.id = images.owner GROUP by users.id to users.paid> SUM (images.entered)    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -