0

Hello Fellow members,

Need assistance in my PHP/SQL statement please.

$sql1 = "SELECT * FROM `forum_cats` WHERE `admin` < ".$row['admin']."+1";

I would like the above code in Ascending order i.e ORDER BY ASC.

Thanks

4
Contributors
9
Replies
11
Views
7 Years
Discussion Span
Last Post by nathenastle
0

You don't need quote marks around table or column names. This SQL should work for you:

SELECT * FROM forum_cats WHERE admin < ".$row['admin']."+1
ORDER BY admin ASC
0

You don't need quote marks around table or column names. This SQL should work for you:

SELECT * FROM forum_cats WHERE admin < ".$row['admin']."+1
ORDER BY admin ASC

Thanks for the reply.

The above code is not working.....

Says:MySql error

It needs a quote mark end of +1 to close the sql statement.

0

hi this is nathen can u try this

SELECT * FROM forum_cats WHERE admin < ".$row['admin']."+1  
      .ORDER BY admin ASC
0

hi this is nathen can u try this
SELECT * FROM forum_cats WHERE admin < ".$row."+1
.ORDER BY admin ASC

Thanks nathen for your help, the issue was solved as I added the following SQL in my php:

"SELECT * FROM `forum_cats` WHERE `admin` < .$row['admin']."+1 ORDER BY `id` ASC";

Thanks for the advice....;)

0

That would be

$sql = "SELECT * FROM forum_cats WHERE admin < ".$row['admin']."+1 ORDER BY `id` ASC";

Note that my original post listed the SQL not the PHP.

0

Hi getarticles1123 and welcome to DaniWeb :)

That's what we're here for. If you have questions, chances are someone at DaniWeb has solutions. Feel free to look around and ask if you need help. Enjoy your stay!

0

That would be

$sql = "SELECT * FROM forum_cats WHERE admin < ".$row['admin']."+1 ORDER BY `id` ASC";

Note that my original post listed the SQL not the PHP.

Oh I know 'darkagn' your original php statement was correct as I knew how to write the SQL statment myself but I was confused with the quote marks.......

"+1 ORDER BY `id` ASC"

Thanks

0

Its ok my friend any way the issue was solved and i too know some new things in querys thanks for your replay

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.