hi everybody its me again help me if you can my search page is not work in server please check my code below & find out what is wrong with it Code: <HTML> <?php include ('config.php'); if (isset($_POST['searchstring'])) { $sql="SELECT * FROM personnel WHERE $searchtype LIKE '%$searchstring%' ORDER BY firstname ASC"; $result = mysql_query($sql); echo "<TABLE BORDER=0 align=center>"; echo"<TR><td align=center width=190><B>الاجـــراء</B><td align=center width=190><B>الاسم واللقب</B><td align=center width=190><B>العنــوان</B></TR>"; while ($myrow = mysql_fetch_array($result)) { echo "<TR><td align=center><a href=\"view.php?id=".$myrow["id"]."\">عرض</a>"; echo "<td align=center>".$myrow["firstname"]." ".$myrow["lastname"]."<td align=center>".$myrow["nick"]; } echo "</TABLE>"; } else { ?> <form method="POST" action="<?php $PHP_SELF ?>"> <table border="0" cellspacing="2" align=center> <tr><td align=center width=190><b>مجال البحث</b></td> <td align=center width=190><b>ادخل كلمة البحث</b></td></tr> <tr> <td align=center width=150> <p dir="rtl"><select size="1" name="searchtype"> <option selected value="firstname">الاســـــم</option> <option value="lastname">اللقــــب</option> <option value="nick">العنوان</option> <option value="email">البريد الالكتروني</option> </select></td> <td align=center width=150> <p align="left" dir="rtl"> <input name="searchstring" size="22" style="float: right"></td> </tr> <tr><td colspan=3> <p> <input type="submit" value="ابحث" name="B1" align=middle> <input type="reset" value="تراجع" name="B2"> </p> </td></tr> </table> <p align="center"><b><span lang="ar-sa"><a href="serch.php">بحث جديد</a> <a href="viewdb.php">عودة للقائمة</a></span></b></p> </form> <?php } ?> </HTML>
You should learn how to post code by now. Read the link I have in the reason if you still don't know. Second thing is you should be specific for what is not running. I see your code even with just opening and closing HTML tag can run on any server.
dear Shabbir when I run above code my result is this error: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in .../serch.php on line 10
Again I assume the issue is with the Query. Print your SQL Query. I think the variable searchtype is not initialized.