How to query data from MySQL via ODBC by C programming.

From 2 previous post about C programming, MySQL and ODBC.

  1. How to connect MySQL5 via ODBC by C programming .
  2. How to INSERT data into MySQL via ODBC by C programming.

And today, I will show how to query and display value on screen. Many part of below source code come form those articles so you should read them before..

Continue reading

How to INSERT data into MySQL via ODBC by C programming.

Yesterday, we talked about “How to connect MySQL5 via ODBC by C programming.” I recommend if you are not expert in C programming please see that post firstly. Because many part of source in this post are come from that post.

Today, I need to show how to insert data after we can create a connection between our program and MySQL.

Before you go to to see my source code, I would like to show my “data table” inside MySQL database.

Continue reading

หนีไม่พ้น ODBC

ไม่ได้ยุ่งเกี่ยวกับ ODBC มาก็หลายปีแล้ว ล่าสุดจำได้ตั้งแต่ใช้ Delphi ตอนฝึกงาน หลังจากนั้นก็ทำให้ผมพบว่า ไอ้อาชีพโปรแกรมไม่เหมาะกับผมเลยเสียจริงๆ แต่จนแล้วจนรอดก็หนีไม่พ้น ยังไงๆ ก็ต้องเขียน วันนี้กับมาเจออีกครั้งในภาค C Programming ให้ทำงานติดต่อกับฐานข้อมูล MySQL ก็เลยต้องกลับมารื้อฟื้นวิทยายุทธกันนิดหน่อย

เกริ่นที่ปัญหาก่อน ปัญหาคือไอ้โปรเจคฝึกงานผมเนี้ย มันเขียนด้วย C แล้วก็ติดต่อด้วยฐานข้อมูล Btrieve (ตอนนี้ถูก Move ไปเป็น Pervasive PSQL) จุดประสงค์คือ อยากย้ายจาก Btrieve ไปเป็น MySQL ก่อนจะมุทะลุ เดินแบบไร้ทิศทาง..ตั้งหลัก..แล้วมองกลับมาที่ตัวเอง “กูจักพวกมึงมั่งมั๊ยเนี้ย”

Continue reading

How to install phpMyAdmin – 2.11.3 on CentOS 5.

After , I installed PHP5, Apache2 and MySQL completed. I want to maintain MySQL service by phpMyAdmin program. This is solution of how to install phpMyAdmin 2.11.3 on CentOS 5.

  1. $ su -
  2. # cd /var/www/html
  3. # wget -c http://prdownloads.sourceforge.net/phpmyadmin/
    phpMyAdmin-2.11.3-english.tar.gz?download
  4. # tar xvfz phpMyAdmin-2.11.3-english.tar.gz
  5. # mv phpMyAdmin-2.11.3-english phpmyadmin
  6. # cd phpmyadmin
  7. # cp config.sample.inc.php config.inc.php
  8. # vi config.inc.php
    :
    $cfg['Servers'][$i]['auth_type'] = ‘http‘; # default is cookies
    :
  9. # service httpd restart

You can test by open phpmyadmin by this link :

http://your.domain.com/phpmyadmin/

You should be find pop up for insert your user name and password.

How to install PHP5,Apach2.2,MySQL5 by manual compile.

ได้รับมอบหมายให้ Install OS พร้อม Software จำพวก Apache, PHP5 แล้วก็ MySQL5 เริ่มแรกเราก็ไปหา source file มาก่อน เตรียมๆ เอาไว้ ดังนี้

  1. Apache 2.2
  2. MySQL 5.0.37
  3. PHP 5.2.1

ลำดับการติดตั้ง ก็ตามนี้ครับ

  1. การติดตั้ง Apache 2.2
  2. การติดตั้ง MySQL 5.0.37 : http://laffers.net/howtos/howto-install-mysql
  3. การติดตั้ง PHP 5.2.1

Continue reading

Basic MySQL Cluster Concepts.

วันนี้ได้รับหมอบหมายให้ดู Concepts ของ MySQL Cluster ก็เลยถือโอกาสเอามาเล่าให้ฟัง สำหรับ Cluster ของ MySQL นั้นจะประกอบด้วยกันทั้งหมด 3 node โดย node ของ MySQL นั้นหมายถึงแต่ละส่วนที่มีหน้าที่การทำงานที่แตกต่างกัน ดังนี้


Continue reading

LOAD DATA by MySQL

เรื่องของเรื่องก็มีอยู่ว่า
ทำเว็บให้ลูกค้าคนหนึ่ง…ลูกค้าคนนี้มีข้อมูลอยู่แล้วเป็น TEXT File ซึ่งจำนวนข้อมูลก็มากโขอยู่ มากสุดอยู่ที่ 150,000 Records ไ้อ้โปรเจคนี้แน่นอนว่า develop ด้วย php ปัญหาเกิดขึ้นตอนที่จะต้องเอาข้อมูลทั้งหมดยัดเข้าไปใส่ใน MySQL จ๊ากกกก เอาไงหว่าจะให้ วน Loop ที่ละบรรทัดแล้ว Insert เข้าไปก็นะ ถึก…โครต สุดท้ายก็มาเจอคำสั่ง LOAD DATA ของ MySQL
LOAD DATA
ปัญหาแรกที่เจอก็คือ
Continue reading