|
 |
|
โค้ดมันดึงฐานข้อมูลไม่ได้ช่วยทีนะคะ แบบทดสอบความรู้เบื้องต้น,User name และรหัสผ่าน |
|
 |
|
|
 |
 |
|
Code (PHP)
<?php
$choice1 = $ dbarr['Choice1']
ควรจะเป็น
$choice1 = $dbarr['Choice1'];
?>
|
 |
 |
 |
 |
Date :
2009-08-10 14:52:41 |
By :
Sek-nakarin |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เราต้องเรียกใช้ Database ให้ถูกต้องก่อนนะครับ
1.Connect MySQL
$ link =mysql_connect("localhost,"root","1234");
2.Connect Database
mysql_select_db("examination", $link);
3.Use SQL Statement
$sql="Select * From examdata;";
$result = mysql_query($sql);
หลังจากนั้นถึงจะนำ $result ไปใช้ตามที่เราต้องการครับ
|
 |
 |
 |
 |
Date :
2009-08-10 15:04:05 |
By :
ak |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
หลังจากนั้นก็ดู Format ภาษาให้ถูกต้อง อย่างที่คุณ sak , memee บอกนะครับ
|
 |
 |
 |
 |
Date :
2009-08-10 15:09:28 |
By :
DonAdmin |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอโทษ ผมลืมดู
ตรง Connect MySQL
$ link =mysql_connect("localhost,"root","1234");
แก้ไขเป็น
$ link =mysql_connect("localhost","root","1234");
|
 |
 |
 |
 |
Date :
2009-08-10 15:12:49 |
By :
DonAdmin |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
$no = $dbarr['No']
$question = $dbarr['Question'];
$choice1 = $ dbarr['Choice1']
$choice1 = $ dbarr['Choice2']
$choice1 = $ dbarr['Choice3']
$choice1 = $ dbarr['Choice4']
แก้ไข
$no = $dbarr['No'] ;
17.$question = $dbarr['Question'];
18.$choice1 = $dbarr['Choice1'] ;
19.$choice1 = $dbarr['Choice2'] ;
20.$choice1 = $dbarr['Choice3'] ;
21.$choice1 = $dbarr['Choice4'] ;
|
 |
 |
 |
 |
Date :
2009-08-10 15:20:47 |
By :
DonAdmin |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
คุณนะคะคณรsek คุณ meemee และคุณ akที่มาช่วยตอบคะ
|
 |
 |
 |
 |
Date :
2009-08-10 23:50:01 |
By :
mainaka |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 02
|