Hello. I'm very new to php, and I'm running into the same problem over and over. I'm trying to get info from a database based on a variable (user defined). I've been testing this on Earthlink.net and also on inmotionhosting.com, but don't know what I'm missing. Any help would be greatly appreciated.
Here is the search section of the code (not sure what other info you'll need to help me out):
if ($searchtype || $searchterm) {
$query = 'SELECT * FROM `rawmaterials` WHERE `$searchtype` LIKE `$searchterm` ';
$result = mysql_query($query) or DIE("Could not Execute Query on table $usertable. ");
echo '<table border="1">';
while ($row = mysql_fetch_array($result)) {
echo '<tr><td colspan="2"><strong>Trade Name: </strong>'.'<br />';
echo $row['trade_name'].'<br />';
echo '<strong>Code #: </strong>'.$row['code_num'].'<br />';
echo '<strong>INCI Name: </strong>'.'<br />';
echo $row['INCI_name'].'<br />';
echo '<strong>Usage Levels: </strong>'.$row['usage_levels'].'<br />';
echo '<strong>Platform: </strong>'.$row['platform'].'<br />';
echo '</td>';
echo '<td colspan="4"><strong>Description: </strong>'.'<br />';
echo $row['description'].'<br />';
echo '</td>';
echo '</tr>';
}
echo '</table>';