This is my actual query in MySQL:
SELECT sndprefix, COUNT(*) FROM `inbox` WHERE
(
sndprefix='22' OR
sndprefix='23' OR
sndprefix='32' OR
sndprefix='33' OR
sndprefix='34' OR
sndprefix='42' OR
sndprefix='43'
)
GROUP BY sndprefix;
I'm getting the CORRECT response such as:
sndprefix COUNT(*)
22 3
23 5
32 1
33 1
43 1
My question is what is the PHP code to show this query in the browser and to be parsed as json format too.
Thanks in advance.
Apology if I have not posted the code earlier, I was trying to familiarize myself with stackoverlow's UI finding the edit option..
Here's the code I've tried so far:
<?php
$query="SELECT sndprefix, COUNT(*) FROM `inbox` WHERE
(
sndprefix='22' OR
sndprefix='23' OR
sndprefix='32' OR
sndprefix='33' OR
sndprefix='34' OR
sndprefix='42' OR
sndprefix='43'
)
GROUP BY sndprefix;";
$result = mysql_query($query);
while($sunget = mysql_fetch_array($result)){
foreach($sunget AS $key => $value) { $conget[$key] = stripslashes($value); }
echo "". nl2br( $sunget['sndprefix']) ."";
}
?>
Thanks.
sndprefix IN ('22','23','32','33','34','42','43')?mysql_*will be deprecated and here is just a huge security hole without any mention about it. Hence: don't direct people to that site for the better of the web.