Home » Categories » Multiple Categories |
How do I query MySQL Database in PHP ? |
Article Number: 86 | Rating: Unrated | Last Updated: Tue, May 1, 2012 at 11:21 PM
|
Please follow the following guidelines: <html>
<head>
<title>MySQL Test Code</title>
</head>
<body>
<h1>MySQL Test Code Results</h1>
<p>
<table border="1">
<tr>
<td>pkID</td>
<td>username</td>
<td>password</td>
</tr>
<?php
/*
* Configuration Information and Definitions
*/
$mysql_host = mysql01.discountasp.net;
$mysql_user = username;
$mysql_pass = password;
$mysql_db = database;
$query = SELECT * from table1;
mysql_connect($mysql_host, $mysql_user, $mysql_pass) or die("Connection to MySQL-server failed!");
mysql_select_db($mysql_db) or die("Selection of database $mysql_db failed!");
$result = mysql_query($query) or die("Invalid Query, " . mysql_error());
while( list( $pkid, $user, $pass ) = mysql_fetch_row($result) )
{
printf("<tr><td>%d</td><td>%s</td><td>%s</td></tr>", $pkid, $user, $pass);
}
?>
</table>
</p>
<h1>End MySQL Test Code Results</h1> |
Attachments
There are no attachments for this article.
|
I cannot find a way to enable ASP.NET 4.5 on my Control Panel
Viewed 10825 times since Tue, Sep 11, 2012
Do you support MySQL WebAdmin Access?
Viewed 3052 times since Tue, May 1, 2012
I receive this error message: "Directory Listing Denied. This Virtual Directory does not allow contents to be listed."
Viewed 10366 times since Mon, Apr 30, 2012
I cannot see my website. What should I do?
Viewed 3626 times since Thu, May 3, 2012
Sample Code to Send email using ASP.NET 2
Viewed 9345 times since Tue, May 1, 2012
Can I set up additional logins for my MySQL database?
Viewed 2748 times since Mon, Apr 30, 2012
How can I enable ASP.NET 3.5 on your Control Panel?
Viewed 3690 times since Wed, May 2, 2012
How to Deploy and host .Net Core 2 and Angular 6 app
Viewed 12708 times since Tue, Oct 23, 2018
How to Solve an Error Message "Validation of viewstate MAC failed"
Viewed 9014 times since Tue, Apr 2, 2013
How to solve ReportViewer error message: "An error has occurred during report processing. Input string was not in a correct format"
Viewed 7951 times since Tue, Jun 18, 2013
|