and populated it with this data...CREATE TABLE `people` (
`mbrID` tinyint(3) NOT NULL,
`name` varchar(20) NOT NULL
PRIMARY KEY (`mbrID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
I want to retrieve the record in here from a variable passed to this simple script...INSERT INTO `people` VALUES (21, 'John Smith');
Code: Select all
<?$db_name ="MRM";
include('connect.php'); //(connection details)
$mbrNbr = 21; // I want to look up the record for this value
$sql = 'SELECT * FROM `people` WHERE `mbrID` = "21";';
$result = @mysql_query($sql,$connection)or die(mysql_error());
// view the result
$row=mysql_fetch_array($result);
foreach($row as $item){print $item;}
?>Since the value in the $mbrNbr variable is same as the literal numeric it seems it should work.