I have the following PHP MySql query:

$query="SELECT * FROM hosts WHERE php='$isphp' AND asp='$isasp' ORDER BY asp $sort";

The variable $sort is as follows:

$sort = "DESC";

can anyone tell me where i am going wrong with the above query ? i know its somthing to do with the $sort variable.

Thanks,
Mark.

I figured out where i went wrong, i used ' ' where i shouldnt of. The end of the PHP mysql query should read:

ORDER BY $order_by $sort";

Not:

ORDER BY '$order_by' $sort";
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.