Hiya, Your right about the $row variable. Since you haven't defined it earlier in the script it will just be empty and print nothing. You assigned teh "numer of rows" to $numrows, so just use that. Also, You need to use {fancy brackets} around any variables you want inside of your SQL queries, otherwise it will search for a date > "$lastdate" (ie, including the dollar sign). Lastly: "Select count(*)" will return a single row containing information on how many rows would have been selected in a full query......that means mysql_num_rows()==1 all the time for that query. You forgot to end your line starting "mysql_query()" with a semicolon....thats whats making your T-String error . Try This: <?php $first_date_opened=$_GET['first_date_opened']; $second_date_opened=$_GET['second_date_opened']; $conn = @mysql_connect("","","")or die("sorry - could not connect to mysql"); $rs = @mysql_select_db("",$conn) or die("problem with database"); $result= mysql_query("SELECT * FROM fault WHERE date_opened > '{$first_date_opened}' AND date_opened < '{$second_date_opened}'"); $query=$_GET['Query']; $num_rows = mysql_num_rows($result); if ($query=="Click to count") { echo "The number of faults is: "; echo ($num_rows) . " "; echo "<br><br>"; } ?>