Saturday, 23 August 2014

PHP mysql_fetch_array() While function

<?php
mysql_connect('localhost', 'root', '');
 mysql_select_db("newcode");
 $q=$_GET["q"];
 $sql="SELECT *  FROM table_name WHERE name_en = '".$q."'";

  $result = mysql_query($sql);

  while($row = mysql_fetch_array($result))
  {
   echo $row['name'];
  }

  mysql_close();
  ?>
 
 

No comments:

Post a Comment