Forum Moderators: open
<div id="container">
<div id="content" role="main">
<form action="/vitamine/wp-content/themes/twentyten/insert.php" method="post">
Value1: <input type="text" name="value1"><br>
<input type="Submit">
</form>
</div><!-- #content -->
</div><!-- #container -->
<?php get_footer(); ?> <?php
$username="root";
$password="";
$database="test";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT Shrt_Desc, Vit_D_mcg, Water, Energ_Kcal, Protein, Lipid_Tot, Carbohydrt FROM abbrev WHERE Shrt_Desc LIKE '%".mysql_real_escape_string($_POST['value1'])."%' ORDER BY Vit_D_mcg DESC ";
$result=mysql_query($query) or die("could not execute query: " . mysql_error());
while ($row=mysql_fetch_array($result)) {
$results .= '<tr>
<td>' . $row['Shrt_Desc'] . '</td>
<td>' . $row['Vit_D_mcg'] . '</td>
<td>' . $row['Water'] . '</td>
<td>' . $row['Energ_Kcal'] . '</td>
<td>' . $row['Protein'] . '</td>
<td>' . $row['Lipid_Tot'] . '</td>
<td>' . $row['Carbohydrt'] . '</td>
</tr>';
}
mysql_close();
//
if ($results) {
echo "<table border=\"1\" align=\"center\" cellpadding=\"2\" cellspacing=\"2\">
<tr><td>NAME</td><td>Vit D mcg</td><td>Water</td><td>Energy</td><td>Protein</td><td>Fat</td><td>Carbohydrate</td></tr>
$results
</table>
";
}
else { echo "<p>No results were found with that search.</p>"; }
?> <?php
$username="root";
$password="";
$database="vitaminen";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT Shrt_Desc, Vit_D_mcg, Water, Energ_Kcal, Protein, Lipid_Tot, Carbohydrt FROM abbrev WHERE Shrt_Desc LIKE '%".mysql_real_escape_string($_POST['value1'])."%' ORDER BY Vit_D_mcg DESC ";
$result=mysql_query($query) or die("could not execute query: " . mysql_error());
while ($row=mysql_fetch_array($result)) {
$results .= '<tr>
<td>' . $row['Shrt_Desc'] . '</td>
<td>' . $row['Vit_D_mcg'] . '</td>
<td>' . $row['Water'] . '</td>
<td>' . $row['Energ_Kcal'] . '</td>
<td>' . $row['Protein'] . '</td>
<td>' . $row['Lipid_Tot'] . '</td>
<td>' . $row['Carbohydrt'] . '</td>
</tr>';
}
mysql_close();
//
if ($results) {
get_header(); ?>
<div id="container">
<div id="content" role="main">
<?php
echo "<table border=\"1\" align=\"center\" cellpadding=\"2\" cellspacing=\"2\">
<tr><td>NAME</td><td>Vit D mcg</td><td>Water</td><td>Energy</td><td>Protein</td><td>Fat</td><td>Carbohydrate</td></tr>
$results
</table>
";
}
else { echo "<p>No results were found with that search.</p>"; }
?>
</div><!-- #content -->
</div><!-- #container -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>