[FONT="Verdana"]
Hi, I'm only a PHP newbie and I am currently working on a way to get info that is stored on the database. The form goes like this:
<form method="post" action="query.php" name="frmBox">
<table width="5%" border="0" cellspacing="1" cellpadding="1">
<tr>
<td>
<input name="invNum" maxlength="6" tabindex="6"/>
</td>
</tr>
<tr>
<td>
<input type="submit" name="submit" value="Go!" class="button" tabindex="6"/>
</td>
</tr>
</table>
</form>
Now (please don't laugh at me!) this is how I did my query.php file... and it doesn't work at all. Could any Genius (if not everyone) out there help me out???
[/SIZE][/FONT]
<?php
// get values from input form
$id = $_REQUEST['invNum'];
$username = "username";
$password = "password";
$database = "database";
#CONNECT TO MYSQL
$dbcnx = @mysql_connect('localhost',$username,$password) or die("Unable to connect to MySQL");
#CONNECT TO DATABASE
@mysql_select_db($database) or die( "Unable to select database");
#CREATE THE QUERY
$sql = 'SELECT `DATE` , `LOCATION` FROM `Folder` WHERE `ID` = "$id"'
. ' ORDER BY `DATE` LIMIT 0, 30';
#EXECUTE QUERY
$rs = mysql_query($sql,$dbcnx) or die(mysql_error());
while($row = mysql_fetch_array($rs))
{
echo "<br>",$row['DATE'],": ",$row['LOCATION'];
}
?>
[FONT="Verdana"]I also wanted the result of the query to be posted in a presentable manner, like maybe on a table (?). Is there a way to do that?[/FONT]