|
|
|
เราจะเขียน PHP ดึงข้อมูลจากฐานข้อมูล Firebird ให้มันได้ผลลัพธ์แบบเดียวกับที่เขียนกับ phpMyAdmin อย่างไรครับ |
|
|
|
|
|
|
|
Code (PHP)
<?php
$strconnect = 'localhost:D:/DB.fdb';
if (!($db=ibase_connect($strconnect,'SYSDBA','masterkey')))
die('Could not connect: ' . ibase_errmsg());
$sql = "SELECT * FROM STT_MENUS";
$cursor = ibase_query($sql);
while($row_array = ibase_fetch_row($cursor)){
print_r($row_array);
}
ibase_free_result($cursor);
ibase_close($db);
?>
|
ประวัติการแก้ไข 2012-02-15 10:34:59 2012-02-15 10:38:57
|
|
|
|
Date :
2012-02-15 10:34:39 |
By :
teukkead |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
จะเอาไปลองดูนะครับ
ขอบคุณครับ
|
|
|
|
|
Date :
2012-02-15 20:03:37 |
By :
มือใหม่ครับ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
จากโค้ดข้างบนนะครับ มันได้ผลลัพธ์ตามนี้
Array ( [0] => 1 [1] => -1 [2] => 0 [3] => AAABBBBB [4] => Master Data [5] => [6] => [7] => [8] => [9] => [10] => [11] => [12] => A [13] => [14] => [15] => [16] => )
Array ( [0] => 14 [1] => 2 [2] => [3] => xxxx [4] => xxx [5] => [6] => [7] => [8] => [9] => [10] => xxx [11] => xxx [12] => A [13] => [14] => [15] => [16] => )
Array ( [0] => 2 [1] => -1 [2] => 1 [3] => xxxxxxxxxxxxxxxxxxx 2 [4] => [5] => CTRL+1 [6] => [7] => [8] => [9] => [10] => [11] => [12] => A [13] => [14] => [15] => [16] => )
Array ( [0] => 3 [1] => 1 [2] => 1 [3] => MasterData [4] => Master Data [5] => [6] => [7] => [8] => [9] => [10] => ข้อมูลหลัก [11] => ข้อมูลหลัก [12] => A [13] => [14] => [15] => [16] => )
Array ( [0] => 4 [1] => 1 [2] => 2 [3] => xxxxxxxxxxxxxxxxxxx 12 [4] => 1 [5] => [6] => [7] => [8] => [9] => [10] => 2 [11] => 3 [12] => A [13] => [14] => [15] => [16] => )
Array ( [0] => 6 [1] => 2 [2] => 2 [3] => hhhhhhhhhhhhhhhhhhh 22 [4] => [5] => [6] => [7] => [8] => [9] => [10] => [11] => [12] => A [13] => [14] => [15] => [16] => )
Array ( [0] => 11 [1] => 3 [2] => [3] => DDDD [4] => DDDD [5] => [6] => [7] => [8] => [9] => 0x0000000a00000087 [10] => DDDD [11] => DDDD [12] => A [13] => [14] => [15] => [16] => )
Array ( [0] => 5 [1] => 2 [2] => 1 [3] => hhhhhhhhhhhhhhhhhhh 21 [4] => [5] => [6] => [7] => [8] => [9] => [10] => [11] => [12] => A [13] => [14] => [15] => [16] => )
Array ( [0] => 7 [1] => 3 [2] => 0 [3] => CCCCaaaa [4] => aaaaaa [5] => [6] => [7] => [8] => [9] => 0x0000259700000087 [10] => [11] => [12] => A [13] => [14] => [15] => [16] => )
Array ( [0] => 9 [1] => 3 [2] => 2 [3] => CCCxxxxaa [4] => [5] => [6] => [7] => [8] => [9] => [10] => [11] => [12] => A [13] => [14] => [15] => [16] => )
Array ( [0] => 13 [1] => 3 [2] => [3] => xxxxx [4] => xxxxx [5] => [6] => [7] => [8] => [9] => [10] => [11] => xxx [12] => A [13] => [14] => [15] => [16] => )
แล้วถ้าผมต้องการแค่ค่าที่มันมีอยู่ในตาราง ไม่เอา Array([...]=>...) แบบนี้ ผมต้องเขียนโค้ดยังไงครับ
ขอบคุณล่วงหน้าครับ
|
|
|
|
|
Date :
2012-02-15 20:11:48 |
By :
มือใหม่ครับ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|