I created a simple function that takes User ID and shows the total number User ID
< {$ Sql = 'SELECT * FROM posts WHERE u_id =' of the post by the code> function totalpost ($ user_id). $ User_id; $ Total = mysql_num_rows (mysql_query ($ sql)) or die (mysql_errno ()); Return total; Its work is fine, but when 0 records get it, it does not return anything.record found
please
ceremony Totalpost ($ user_id) {$ Sql = 'SELECT count (*) by post WHERE u_id ='. Intval ($ user_id); $ Res = mysql_query ($ sql)) or trigger_error (mysql_error (.) $ Sql); $ Line = mysql_fetch_row ($ res); $ Line return [0]; }
It is not because you need 0, but because instead of selecting all the user posts you have to use the count ()
Can be a major burden. / P>
Comments
Post a Comment