Forum Moderators: coopster
Db has one table with 2 fields called input and output. User will enter the input via web form which sends "forminput" to this script. I can echo that to screen so I know it's getting through.
Script should then display the input and output fields to the screen. Here's the script
<?
$dbh=mysql_connect ("localhost", "database_name", "passwordhere") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("database_name");
$query = "SELECT * FROM database_name WHERE input = {$_POST['forminput']} LIMIT 1";
$result = mysql_query ($query);
$row = mysql_fetch_assoc ($result);
echo "input: {$row['input']}<br>output: {$row['output']}";
?>
Any ideas very welcome
Mike
See below that you can echo the query.
<?
$dbh=mysql_connect ("localhost", "database_name", "passwordhere") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("database_name");
$query = "SELECT * FROM database_name WHERE input = {$_POST['forminput']} LIMIT 1";
echo $query;
$result = mysql_query ($query) or die('Error');;
$row = mysql_fetch_assoc($result);
echo "input: {$row['input']}<br>output: {$row['output']}";
?>