Jump to content

help with mysql_query


MDanz

Recommended Posts

I have to columns Positive and Negative.  i use this as a rating system.

 

e.g.  For example if Positive is value 2 and Negative is value 1.

Then the total would be 1.

 

i have a variable $order.  if i did $order="(Positive-Negative)";  I now that is incorrect.  But how do i do that so it order's by the the total of (Positive-Negative) for a row.

 

$construct = "SELECT * FROM Stacks WHERE keywords='$search' AND ({$adult}) ORDER BY `$order` DESC";

Link to comment
https://forums.phpfreaks.com/topic/211753-help-with-mysql_query/
Share on other sites

I have to columns Positive and Negative.  i use this as a rating system.

 

e.g.  For example if Positive is value 2 and Negative is value 1.

Then the total would be 1.

 

i have a variable $order.  if i did $order="(Positive-Negative)";  I now that is incorrect.  But how do i do that so it order's by the the total of (Positive-Negative) for a row.

 

$construct = "SELECT * FROM Stacks WHERE keywords='$search' AND ({$adult}) ORDER BY `$order` DESC";

 

Format simple is:

 

$order=$positive-$negative;

 

but you need to provide more details for in depth help... You didn't mention what you do with negative values? How you store ' $order ' in database, where and in which format?

 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.