title: SELECT COUNT(`id`)FROM `table` WHERE merk LIKE '%$searchq%'
body: <p>I want to count how many results I get when i use my search engine..</p>
  
  <p>Here is my html code:</p>
  
  <pre><code>&lt;form id="header-search" action="car-list.php" method="get"&gt;
              &lt;input type="text" name="search"  id="text" placeholder="Zoek hier.."   class="quick-search"  &gt; &lt;/form&gt;
  </code></pre>
  
  <p>Php code:            </p>
  
  <pre><code>     $searchq = $_GET['search'];
       $searchq = str_replace(' ','-',$searchq);     
      $con =  mysql_connect("localhost","root","****");
  if (!$con) {
    die('Could not connect: ' . mysql_error());
  }
  
  mysql_select_db("register-login", $con);
  
  $result = mysql_query("SELECT COUNT(`car_id`)FROM `adver` WHERE merk LIKE '%$searchq%' OR titel LIKE '%$searchq%' OR model LIKE '%$searchq%'");
  $row = mysql_fetch_array($result);
  $total = $row[0];
  
  
  
  $pages = new Paginator;  
  $pages-&gt;items_total = $total;
  $pages-&gt;mid_range = 5;  
  $pages-&gt;paginate();  
  </code></pre>
  
  <p>Im doing this to know "$pages->items_total = $total;" for my pagination.</p>
  
  <p>Code for display results:</p>
  
  <pre><code>$searchq = htmlspecialchars($searchq); 
  $searchq = mysql_real_escape_string($searchq);                  
  $photo=mysql_query("SELECT * FROM `adver` WHERE merk LIKE '%$searchq%' OR titel LIKE '%$searchq%' OR model LIKE '%$searchq%' ORDER BY car_id DESC $pages-&gt;limit")or die(mysql_error());
  
  while($get_photo=mysql_fetch_array($photo)){ 
  
  
  ?&gt;
  
  
                                          &lt;a href="&lt;?php echo 'car-details.php?merk='.$get_photo['merk'] .'&amp;car_id=' .$get_photo['car_id'] .'&amp;titel=' .$get_photo['titel'] ;?&gt;"&gt;
                              &lt;img src="&lt;?php  echo $get_photo['path'] ; ?&gt;" style="border:1px solid #021a40;" alt="&lt;?php  echo $get_photo['merk'] ;?&gt;" }/&gt;
  </code></pre>
  
  <p>Everyyhing is working fine until, when I search for something that doesn't exist in my databse. So $result =  0. Then I get the fowllowing error:</p>
  
  <p>You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-10,10' at line 1</p>
  
  <p>When I change my $result = mysql_query to ==> ("SELECT COUNT(<code>car_id</code>)FROM <code>adver</code>");
  Then everything works fine exept my pagination numbers... Because I count every car_id, no matter what I'm searching.. I'm getting for exampple 3 empty pages..</p>
  
  <p>I hope someone can help me with this problem,Thanks</p>