I need my search/select query to result in the row searched from my input text aka ‘searchby’ but with the added =’$searchby’ it delivers no data but just ea_reg $searchby gains all data.
I only want it to deliver rows that include $searchby.
please help
[php]
$searchby = $_POST[“searchby”];
$db_host = "localhost";
$db_user = "++++";
$db_pass = "++++";
$db_base = "+++";
$db_server = mysql_connect($db_host, $db_user, $db_pass);
if (!$db_server) die("unable to connect: " . mysql_error());
mysql_select_db($db_base)
or die("Unable to select database: " . mysql_error());
$query = "SELECT * FROM job_db WHERE ea_reg='$searchby'";
$result = mysql_query($query);
if (!$result) die ("Database access failed: " . mysql_error());
$rows = mysql_num_rows($result);
for ($j = 0 ; $j < $rows ; ++$j)
{
$row = mysql_fetch_row($result);
echo '<table border="1" align="center">';
echo '<tr>';
echo '<th>' . 'EA Number ' . '</th>';
echo '<th>' . 'Job Notes ' . '</th>';
echo '<th>' . 'Job Completed ' . '</th>';
echo '<th>' . 'Task Name ' . '</th>';
echo '<th>' . 'Order Number ' . '</th>';
echo '<th>' . 'Engineer1 ' . '</th>';
echo '<th>' . 'Engineer2 ' . '</th>';
echo '<th>' . 'Reported Time ' . '</th>';
echo '<th>' . 'Reported Date ' . '</th>';
echo '<th>' . 'Completed Time ' . '</th>';
echo '<th>' . 'Completed Date ' . '</th>';
echo '</tr>';
//table split
echo '<tr>';
echo '<td>' . $row[0] . '</td>';
echo '<td>' . $row[1] . '</td>';
echo '<td>' . $row[2] . '</td>';
echo '<td>' . $row[3] . '</td>';
echo '<td>' . $row[4] . '</td>';
echo '<td>' . $row[5] . '</td>';
echo '<td>' . $row[6] . '</td>';
echo '<td>' . $row[7] . ':' . $row[8] . '</td>';
echo '<td>' . $row[9] . ' / ' . $row[10] . ' / ' . $row[11] . '</td>';
echo '<td>' . $row[12] . ':' . $row[13] .'</td>';
echo '<td>' . $row[14] . ' / ' . $row[15] . ' / ' . $row[16] . '</td>';
echo '</tr></table><p></p>';
}
mysql_close($db_server);
echo <<<_END
_END;?>[/php]