用mySQLI显示行

时间:2014-03-20 13:40:28

标签: php mysqli printf

我正在尝试显示用户输入内容的行的所有数据。我有这个代码,但它不显示任何变量:(

$db = new mysqli("127.0.0.1", "root", "", "classic");

if (mysqli_connect_errno())
    {
    echo "Noes, we could not complete your request! Quote error code S69 when contacting tech support!";
    exit();
    }
// variables
$modelToDlete = strip_tags($_POST['deleteMe']);

if (isset($_POST['submit']))
    {

$deleteCar = $db->prepare("SELECT `model`, `price`, `miles`, `engineSize`, `color`, `description`, `regNo` FROM `cardetails` WHERE `carID` =?") or die($db->error);
$deleteCar->bind_param('s', $modelToDlete);
$deleteCar->execute();
$result = $deleteCar->bind_result($model, $price, $miles, $engineSize, $color, $desc, $regno);

printf("Detais of the car you want to delete: ", $model, $price, $miles, $engineSize, $color, $desc, $regno);
}//if

>

1 个答案:

答案 0 :(得分:0)

您错过了printf()语句中的占位符(假设字符串值):

printf("Detais of the car you want to delete: %s, %s, %s, %s, %s, %s", $model, $price, $miles, $engineSize, $color, $desc, $regno);