Programming ...
The existing user name is root, the password is root MySQL database server, which has a database named JWGL, how to use PHP programming to display the JWGL Database student table of the first 15 records
------Solution--------------------
mysql_connect (' localhost ', ' root ', ' root ') or Die (Mysql_error ());
mysql_select_db (' Jwgl ') or Die (Mysql_error ());
$rs = mysql_query (' SELECT * from student limit ") or Die (Mysql_error ());
while ($r = Mysql_fetch_assoc ($rs)) {
echo Join (", $r). '
';
}
------Solution--------------------
mysql_connect (' localhost ', ' root ', ' root ') or Die (Mysql_error ());
mysql_select_db (' Jwgl ') or Die (Mysql_error ());
$rs = mysql_query (' SELECT * FROM student ORDER BY id desc-limit ') or Die (Mysql_error ());
while ($r = Mysql_fetch_assoc ($rs)) {
echo Join (", $r). '
';
}
------Solution--------------------
$mysql _server_name= ' localhost ';
$mysql _username= ' root ';
$mysql _password= ' root ';
$mysql _database= ' JWGL ';
$mysql _table= ' student ';
$conn =mysql_connect ($mysql _server_name, $mysql _username, $mysql _password, $mysql _database) or Die (Mysql_error ());
mysql_select_db ($mysql _database, $conn);
$sql = ' SET NAMES UTF8 ';//if UTF8
mysql_query ($sql);
$QUESTR = ' SELECT * from '. $mysql _table. ' ORDER by ID ASC LIMIT 0,15 ';//if pri key ID
$result =mysql_query ($QUESTR);
while ($row = Mysql_fetch_array ($result)) {
echo $row [0]. " ". $row [1]."
";//or $row [" Test_col "]
}
Mysql_close ($conn);
------Solution--------------------
SELECT * FROM student limit 0,15