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

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

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.

hi this is nathen can u try this

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

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....;)

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.

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!

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.