Query MySQL Database in PHP

                                                        
1
2
3 <html>
4 <head><title>MySQL Test Codetitle>head>
5 <body>
6 <h1>MySQL Test Code Resultsh1>
7 <p>
8 <table border="1">
9 <tr><td>pkIDtd><td>usernametd><td>passwordtd>tr>
10 php
11
12 /*
13 * Configuration Information and Definitions
14 */
15 $mysql_host = 'mysql01.discountasp.net';
16 $mysql_user = 'username';
17 $mysql_pass = 'password';
18 $mysql_db = 'database';
19 $query = 'SELECT * from table1';
20
21 mysql_connect($mysql_host, $mysql_user, $mysql_pass) or die("Connection to MySQL-server failed!");
22
23 mysql_select_db($mysql_db) or die("Selection of database $mysql_db failed!");
24
25 $result = mysql_query($query) or die("Invalid Query, " . mysql_error());
26
27 while( list( $pkid, $user, $pass ) = mysql_fetch_row($result) )
28 {
29 printf(" %d %s %s", $pkid, $user, $pass);
30
31 }
32
33 ?>
34 table>
35 p>
36 <h1>End MySQL Test Code Resultsh1>
37
38

  • 0 Bu dökümanı faydalı bulan kullanıcılar:
Bu cevap yeterince yardımcı oldu mu?

İlgili diğer dökümanlar

Sample Code on Sending Email using ASP.NET 1

Our mail server is configured with SMTP authentication and all your code need to use SMTP...

Sample Code on how to send email using ASP.NET 2

For ASP.NET 2 you no longer using System.Web.Mail, but you will be using System.Net.Mail and the...

Query MySQL Database in ASP.net

1 2 3 <%@ Page Language="VB"...