Im trying to crack this serach box but it doesnt seem to work, when i click search, i get an empty screen. please help. This is my code: php.php <form action="search.php" method="post"> <input type="text" name="query" id="query" size="40" value="" action="Search.php" columns="2" autocomplete="off" delay="1500"> <input type="submit" value="Search"> <input type="hidden" name="Search" value="1"> </form> Search.php <html> <body> <? session_start(); $myServer = '****'; $myUser = '****'; $myPass = '***'; $myDB = '*****'; $SpecRef = $_GET['query']; print ("$SpecRef"); //connection to the database $dbhandle = mssql_connect($myServer, $myUser, $myPass) or die("Couldn't connect to SQL Server on $myServer"); //select a database to work with $selected = mssql_select_db($myDB, $dbhandle) or die("Couldn't open database $myDB"); //error message (not found message)begins $XX = "No Matches Found"; //query details table begins $query = ("SELECT * FROM dbo.DesignControl WHERE Spec_Ref LIKE'$SpecRef%' "); // $query = ("SELECT * FROM dbo.DesignProcess"); print(' is what you searched for:'); //execute the SQL query and return records $result = mssql_query($query); $numRows = mssql_num_rows($result); echo "<h1>" . $numRows . " Record" . ($numRows == 1 ? "" : "s") . " Found </h1>"; //display the results echo '<textarea>'; while($row = mssql_fetch_array($result)) { echo $row["Spec_Ref"] . "\n"; } echo '</textarea>'; //close the connection mssql_close($dbhandle); //display the results while($row = mssql_fetch_array($result)) { echo $row["Spec_Ref"] . "\n"; } echo '</textarea>'; //close the connection mssql_close($dbhandle); //display the results while($row = mssql_fetch_array($result)) { echo "<li>" . $row["Spec_Ref"] . "</li>"; } //close the connection mssql_close($dbhandle); //textareaContent = ""; //while ($row = @mysql_fetch_array($query)) //{ //$var1=$row["Player"]; //$var2=$row["Avg"]; //$var3=$row["HR"]; //$var4=$row["RBI"]; $textareaContent .= "Spec Ref: $var1 Avg: $var2 HR: $var3 RBI $var4 <br/>"; //} //if (!isset($var1) || $var1=="") { //echo $XX; //} ?> </body> </html>
Try putting this at the top of the page if you do not have access to your error logs: <?php error_reporting(E_ALL); ini_set('display_errors', 1); ?> PHP: Also, change the "<?" to "<?php".