I have the folllowing switch statement
<?php
$keyword1 = $_GET['keyword'];
switch($_GET['type']) {
case 'ordernumber':
$result = @mysql_query("SELECT * FROM orderbook WHERE order_no LIKE '".$keyword1."'");
break;
case 'partnumber':
$result = @mysql_query("SELECT Part_no FROM orderbook WHERE Part_no LIKE '".$keyword1."'");
break;
case 'accountname':
$result = @mysql_query("SELECT account_name FROM orderbook WHERE account_name LIKE '".$keyword1."'");
break;
}
if (!$result) {
exit('<p>Error performing query: ' . mysql_error() . '</p>');
}
while ($row = mysql_fetch_array($result)) {
echo $row['order_no'] . '<br/>';
echo $row['Part_no'] . '<br/>';
echo $row['account_name'] . '<br/>';
}
?>
However what I would like to do is add a Like command to the queries but I can't get it to work so the last digits can be anything something like this
SELECT * FROM tablename WHERE name LIKE '1234%'
Also how would I put a default action into the code if the database has no results in it so it would say something like
Sorry your query has returned no results please try again
Thank you for any help