php - Trying to create a search facility but having issues -
i having issues php code, been trying create search facility , having errors , don't know do. here's code area having issues:
<input type="text" required="required" name="name"> <input name="submit" name="submit" value="search"> </form> <?php if(isset($_post['submit'])) { if(isset($_get['go'])){ if(preg_match("^/[a-za-z]+/", $_post['name'])){ //to make sure either capital or small letters $name=$_post['name']; //connection database $db=mysql_connect ("localhost", "<u1375454>", "<25jun94>") or die ('cannot connect database: ' .mysql_error()); //selection of database use $mydb=mysql_select_db("cars"); $sql="select brand i_d, brand_name, headquarters, net_worth cars brand_name '%" . $name . '%" or headquarters '%" . $name ."%'"; $result=mysql_query($sql); // heres having problem while($row=mysql_fetch_array($result)){ $brand_name=$row['brand_name']; $headquarters=$row['headquarters']; $brand i_d=$row['brand i_d']; echo "<ul>\n"; echo "<li>" . "<a href=\"search.php?id=$id\">" .$brand_name . " " . $headquarters . "</a> </li>\n"; echo "</ul>"; }
your variable "$brand i_d" cannot that! change $brand_i_d;
Comments
Post a Comment