ต้องการให้รหัสลูกค้ารันเองแบบนี้ 0001,0002 ไปเรื่อยๆ ต้องทำยังไงครับ
คือกำลังเขียนโปรแกรมเก็บข้อมูลลูกค้า ใช้ php+mysql ครับ
สร้างตารางชื่อ customer มี 2 ฟิล
ฟิลที่ 1 ชื่อ cus_id กำหนดให้เป็น int ไพรมารี่คีย ์และ auto increment
ฟิลที่ 2 ชื่อ Cus_name เป็น varcha
ตือตอนนี้มันก็เก็บข้มูลได้แล้วครับ
แต่รหัสลูกค้ามันเก็บเป็น 1,2,3,4
อยากให้เก็บเป็น 0001,0002,0003 เรียงไปเรื่อยๆ ต้องทำยังไงครับ
ภาษาไทย สำหรับ phpBB เวอร์ชั่นล่าุด คือ 3.2.2
มาแล้วโหลดได้เลย
มาแล้วโหลดได้เลย
ต้องการให้รหัสลูกค้ารันเองแบบนี้ 0001,0002 ไปเรื่อยๆ ทำไงคับ
ข้อมูล 0001 -------> ไม่ใช่ int นะครับ
ถ้าจะให้ เก็บ เป็น 0001 ได้ต้องเปลี่ยน data type
ถ้าจะให้ เก็บ เป็น 0001 ได้ต้องเปลี่ยน data type
สร้างไฟล์ pdf online
ท่องเที่ยว http://www.thailandhotelforums.com/" onclick="window.open(this.href);return false;
สอน php http://www.mindphp.com/" onclick="window.open(this.href);return false;
ท่องเที่ยว http://www.thailandhotelforums.com/" onclick="window.open(this.href);return false;
สอน php http://www.mindphp.com/" onclick="window.open(this.href);return false;
ชนิดข้อมูลที่เกี่ยวกับ ตัวอักษร ( String data type )
* CHAR
* VARCHAR
* BINARY
* VARBINARY
* BLOB
* TEXT
* ENUM
* SET
แต่ไม่ สามารถใช้ auto increment กับ String data type นะครับ
* CHAR
* VARCHAR
* BINARY
* VARBINARY
* BLOB
* TEXT
* ENUM
* SET
แต่ไม่ สามารถใช้ auto increment กับ String data type นะครับ
สร้างไฟล์ pdf online
ท่องเที่ยว http://www.thailandhotelforums.com/" onclick="window.open(this.href);return false;
สอน php http://www.mindphp.com/" onclick="window.open(this.href);return false;
ท่องเที่ยว http://www.thailandhotelforums.com/" onclick="window.open(this.href);return false;
สอน php http://www.mindphp.com/" onclick="window.open(this.href);return false;
set attribute UNSIGNED ZEROFILL in phpMyAdmin
set attribute UNSIGNED ZEROFILL in phpMyAdmin
ขอบคุณท่าน knopsod ด้วยครับ
ถ้าท่าน jit สร้างตารางไปแล้ว เอาคำสั่งนี้ไปรัน ที่ phpmysql
ALTER TABLE `tb` CHANGE `field` INT( 4 ) UNSIGNED ZEROFILL NOT NULL AUTO_INCREMENT
หรือเลือกโครงสร้างตาราง แล้ว คลิกแก้ไขที่ field นั้นใน phpmyadmin แล้ว เลือก แอตทริบิวต์ เป็น UNSIGNED ZEROFILL ตามที่ท่าน knopsod แนะนำไว้ครับ
ถ้าท่าน jit สร้างตารางไปแล้ว เอาคำสั่งนี้ไปรัน ที่ phpmysql
ALTER TABLE `tb` CHANGE `field` INT( 4 ) UNSIGNED ZEROFILL NOT NULL AUTO_INCREMENT
หรือเลือกโครงสร้างตาราง แล้ว คลิกแก้ไขที่ field นั้นใน phpmyadmin แล้ว เลือก แอตทริบิวต์ เป็น UNSIGNED ZEROFILL ตามที่ท่าน knopsod แนะนำไว้ครับ
สร้างไฟล์ pdf online
ท่องเที่ยว http://www.thailandhotelforums.com/" onclick="window.open(this.href);return false;
สอน php http://www.mindphp.com/" onclick="window.open(this.href);return false;
ท่องเที่ยว http://www.thailandhotelforums.com/" onclick="window.open(this.href);return false;
สอน php http://www.mindphp.com/" onclick="window.open(this.href);return false;
Re: set attribute UNSIGNED ZEROFILL in phpMyAdmin
ทำตามนี้ ได้แล้วครับ ง่ายด้วยknopsod เขียน:set attribute UNSIGNED ZEROFILL in phpMyAdmin
ขอบคุณมากครับ
ผู้ใช้งานขณะนี้
กำลังดูบอร์ดนี้: 80 และ บุคคลทั่วไป 0 ท่าน