drt41563 2016-02-10 10:39
浏览 59

如何在PHP 7中将mysql mediumtext列绑定到stmt

I have base64 text in database and this column type is mediumtext which can store up to 64 mb. I want to store base64 text using stmt statement in php. How can I bind mediumtext type?

$stmt =  $conn->stmt_init();
// Prepared statement, stage 1: prepare
if (!($stmt = $conn->prepare("INSERT INTO sertkatestdatabase.users(lastName,firstName,address,profession,manager,pass,userName) VALUES (?,?,?,?,?,?,?)")))
{
    $error= 'Prepare failed: (' . $conn->errno . ') ' . $conn->error;
    //return; //how to return?
}
// Prepared statement, stage 2: bind and execute
if (!$stmt->bind_param("ssssiss", $lastname,$firstname,$address,$profession,$manager,$password,$username))
{
    $error="Binding parameters failed: (" . $stmt->errno . ") " . $stmt->error;
}

if (!$stmt->execute())
{
    $error="Execute failed: (" . $stmt->errno . ") " . $stmt->error;
}
// close statement
$stmt->close();

I have this code currently working. Same here I want to add image column but don't now which 'letter' binds it.

  • 写回答

0条回答 默认 最新

    报告相同问题?