I'm doing this

$query = mysql_query("SELECT M.msg_id, M.uploads, M.message, M.description, M.type, M.text, M.views_count, U.username, C.name as country_name FROM users AS U INNER JOIN messages AS M ON U.uid = M.uid_fk INNER JOIN head_networks AS H ON M.network_id=H.network_id LEFT JOIN countries AS C ON M.country_id=C.country_id WHERE M.type='A' ");
$Order = " ORDER BY M.message ASC";
$result = $query . $Order;
while($row=mysql_fetch_array($result))

But it doesnt work. The problem is when i am putting a the variables $Order and $result

$query is not a string, it is a mysql_query so your concatenation isn't working as you would think.
Build your string and then create your query.

$select = "SELECT M.msg_id, M.uploads, M.message, M.description, M.type, M.text, M.views_count, U.username, C.name as country_name FROM users AS U INNER JOIN messages AS M ON U.uid = M.uid_fk INNER JOIN head_networks AS H ON M.network_id=H.network_id LEFT JOIN countries AS C ON M.country_id=C.country_id WHERE M.type='A' ";
$Order = " ORDER BY M.message ASC";
$query = mysql_query($select . $Order);

hericles give you the right answer.

Thanks hericles.

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.