Hi, I have a table in a database which has 2 fields, userid and impressions what I want to do is specify the userid and read the impressions for that userid what query would i use? thanks
select * from yourtable where userid='someid'; Code (markup): That is the mysql query. If you are looking to display it using PHP then do: <?php $userid='someid'; $q="select * from yourtable where userid='$userid'"; $r=mysql_query($q); while ($row = mysql_fetch_array($r)){ $userid=$row['userid']; $impressions=$row['impressions']; echo "Userid: $userid\n"; echo "Impressions: $impressions"; } ?> PHP: