簡體   English   中英

PHP綁定'bigint'數據類型(MySQLi准備語句)

[英]PHP binding 'bigint' datatype (MySQLi prepared statement)

$studentId = 57004542323382
$companyOfferId = 7

$sql = 'INSERT INTO studentPlacement (companyOfferId, studentId) VALUES (?, ?)';

if ($stmt = $db->prepare($sql)) {
    $stmt->bind_param("ii", $offerId, $studentId);
    $stmt->execute();
    $insertId = $stmt->insert_id;
    $stmt->close();
}

我的問題在於studentId變量。 它的值太長而無法存儲為標准整數,因此必須將其存儲為bigint。 將參數綁定為整數時,只需輸入“1”作為studentId值。 據我所知, bind_param支持4種類型; 整數,字符串,blob和double。 有沒有人對如何解決這個問題有任何想法,所以我可以正確地發送值作為bigint?

謝謝

使用$studentId = '57004542323382'; // quotes added $studentId = '57004542323382'; // quotes added和用於綁定的字符串參數。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM