mysql - order by sql query error -


$post_items = $db->query("select post_id,content,date,category_id          post_items join user on(post_items.user_id = user.user_id) post_items.user_id =" . $userid) 

how can include order in case? tried

$post_items = $db->query("select post_id,content,date,category_id          post_items join user on(post_items.user_id = user.user_id) post_items.user_id =" . $userid ."order post_id"); 

please, apply space between field , order keyword, , use tablename if columnaname ambiguse in query use join :

$post_items = $db->query("select post_id,content,date,category_id          post_items inner join user on post_items.user_id = user.user_id            post_items.user_id =" . $userid ." order post_items.post_id "); 

Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -