i making query system person post query, db allocated id (query_id) query. using query_id in column query_reply_id in same table store data of send emails. trying count number of emails sent on id, following code giving me number of emails sent per id in mysql when call it, preview shows combine.
$new_sql = "select t.query_id, count(o.query_reply_id) mycount query t left join query o on t.query_id = o.query_reply_id t.query_form = 'contactus' , t.query_status= 'replied' group o.query_reply_id order t.query_reply_date desc"; $new_run = mysqli_query($conn, $new_sql); while($new_rows = mysqli_fetch_assoc($new_run)){ echo $new_rows['mycount'];} query_id mycount 70 1 23 8 43 11 49 1
in preview, showing 18111 against each of query.
the reason getting long line mycount values echoing out mycount values.
you need add line break @ end and output query_id values too. perhaps bit this:
while($new_rows = mysqli_fetch_assoc($new_run)){ echo $new_rows['query_id'], ':', $new_rows['mycount'],"<br />"; }
personally, tabular data i'd tempted use table.
this sort of thing:
echo "<table><tr><td>query_id</td><td>mycount</td></tr>"; while($new_rows = mysqli_fetch_assoc($new_run)){ echo '<tr><td>' ,$new_rows['query_id'], '</td><td>', $new_rows['mycount'],"</td></tr>"; } echo "</table";
Comments
Post a Comment