我对 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"];
}