0

is there any way through which we can generate reports in mysql.
not using any s/w but coding.
if yes plz tell me
Thanks

2
Contributors
3
Replies
4
Views
10 Years
Discussion Span
Last Post by jbennet
0

you can do it in php . Here is the code i use to show a report of all the people whose email adresses and names i have in my database

<html>
<head>
<title>Test MYSQL PHP Page</title>
</head>
<body>
<?php
include("dbinfo.inc.php");
mysql_connect(localhost,$user,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM contacts";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
echo "<b><u><center>Database Output</center></u></b><br>";
echo "<hr>";
$i=0;
while ($i < $num) {
$first=mysql_result($result,$i,"first");
$last=mysql_result($result,$i,"last");
$email=mysql_result($result,$i,"email");
echo "<b>$first $last</b><br>$email<br><hr><br>";
$i++;
}
?>
<p>
<center><a href="/index.php">Return to main page</a></center>
</p>
</body>
</html>

dbinfo.inc should contain something like:

<?php
$user="root";
$password="letmein";
$database="mydatabase";
?>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.