| 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.
|
What is the connection string for my mariaDB database?
Viewed 2573 times since Fri, Jun 26, 2020
Sample Code to Send email using ASP.NET 2
Viewed 10316 times since Tue, May 1, 2012
How to Deploy and host .Net Core 2 and Angular 6 app
Viewed 14169 times since Tue, Oct 23, 2018
Can i login to my MySQL database via my own mySQL tool?
Viewed 3767 times since Mon, May 7, 2012
Do you support ASP.NET MVC 6?
Viewed 5559 times since Wed, Feb 17, 2016
Can I set up additional logins for my MySQL database?
Viewed 3539 times since Mon, Apr 30, 2012
How to Solve the error: "405 - HTTP verb used to access this page is not allowed"?
Viewed 6139 times since Wed, Oct 24, 2018
My site is showing 500 Internal Server error message. What is wrong here?
Viewed 4406 times since Thu, May 3, 2012
About Azure Key Vault
Viewed 2559 times since Mon, Nov 2, 2020
How To Solve Problem with Connection String on EF (Entity Framework) 4 or above
Viewed 33127 times since Mon, Apr 1, 2013
|
