<?php
$link = mysql_connect("localhost", "root","1234")or die("Could not connect : " . mysql_error());
print "Connected successfully";
mysql_select_db("test") or die("Could not select database");
$id = $_GET['id'];
$query = "SELECT id,user,pass FROM login where id = ".$id;
echo "<h3>Query : " . $query . "</h3>";
$result = mysql_query($query) or die("Query failed : " . mysql_error());
print "<table style='color:#ff0000' border='1'>\n";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
print "\t<tr>\n";
foreach ($line as $col_value) {
print "\t\t<td><b>$col_value</b></td>\n";
}
print "\t</tr>\n";
}
print "</table>\n";
mysql_free_result($result);
mysql_close($link);
?>
สร้าง DB ชื่อ test , Table ชื่อ login , Column ชื่อ id,user,pass ใส่ข้อมูล
เซฟลง localhost เรียกใช้ http://localhost/sqlibug.php?id=1
จุดเริ่มต้นของผมเลยนะนี้
ตอบลบcode นี้
ขอบคุณมากครับ