简体   繁体   中英

How do i add 0 in database for telephone number

所以我想将 0 放入我的电话列数据库中,我尝试使用此代码,但它不断收到错误消息,表示意外的“0”,对于该列,我使用的是 int

  mysqli_query($koneksi,"INSERT INTO distributor VALUES('','$nama_distributor','$alamat','"0".$telpon')");

use concat() function

mysqli_query($koneksi,"INSERT INTO distributor 
 VALUES('','$nama_distributor','$alamat',concat('0','$telpon'))");

You have to mentions the column names like this and use the cast() function

Declare @Num1 int
set @Num1 = 0

 mysqli_query($koneksi,"INSERT INTO distributor (column1, column2, column3, column4) VALUES('','$nama_distributor','$alamat', cast(@Num1 as varchar() + $telephone as varchar(12)");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM