我是PHP和MySQL的新手,我只是想不出这个.我在论坛周围搜索过但没有找到我能理解的答案.我最初使用的是mysql_fetch_assoc(),但我只能搜索数字,并且在搜索字母时也收到了错误.我希望我在这里走在正确的轨道上.提前感谢您的帮助!
$con = mysqli_connect($hostname,$username,$password) or die ("<script language='javascript'>alert('Unable to connect to database')</script>");
mysqli_select_db($con, $dbname);
if (isset($_GET['part'])){
$partid = $_GET['part'];
$sql = 'SELECT *
FROM $usertable
WHERE PartNumber = $partid';
$result = mysqli_query($con, $sql);
$row = mysqli_fetch_assoc($result);
$partnumber = $partid;
$nsn = $row["NSN"];
$description = $row["Description"];
$quantity = $row["Quantity"];
$condition = $row["Conditio"];
}
Run Code Online (Sandbox Code Playgroud)