-
14th December 2009, 05:58 PM
#1
php Help?
I have mysql database name "prj" which has two fields id & amount
i want to display the amount field in php and with S#.
like that
S# Amount
1. 7800
2. 5200
3. 7400
.
.
.
10 5369
How it is possible that i can add S# in php page.
plz help me because me in trouble
regards.
Adil
-
15th December 2009, 02:03 AM
#2
here comes the php code you can save it as anyname.php
<?php
$con = mysql_connect("localhost","prj","dbpassword");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("my_db", $con);
$result = mysql_query("SELECT * FROM table_name");
while($row = mysql_fetch_array($result))
{
echo $row['id'] . " " . $row['amount'];
echo "<br />";
}
mysql_close($con);
?>
The following example selects all the data stored in the "price" table (The * character selects all the data in the table
table_name is a name of the table where your fields (ID & amount are stored) plz change it as you required
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks