Jump to content

Display php in web page?


renfley

Recommended Posts

K i have a very noobish question ,

i have 5 item in my database id,callsign,email,location,joindate    and i wnt to display them on my page,

 

now i m at a loss i havnt done this in years and any help would be apreciated.

 

so far ive got

<?PHP

mysql_connect("localhost","root","root");

mysql_select_db("RankingSystem");

$result = mysql_query("select * from rank_tbl");

 

?>

Link to comment
https://forums.phpfreaks.com/topic/189693-display-php-in-web-page/
Share on other sites

I would love to show you how, but time is limited. But I can tell you how I did mine, if you don't mine doing alittle reading.

 

Goto http://www.w3schools.com/php/php_mysql_intro.asp

 

But here is what I cut and paste from the site:

 

<?php
$con = mysql_connect("localhost","peter","abc123");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("my_db", $con);

$result = mysql_query("SELECT * FROM Persons");

echo "<table border='1'>
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>";

while($row = mysql_fetch_array($result))
  {
  echo "<tr>";
  echo "<td>" . $row['FirstName'] . "</td>";
  echo "<td>" . $row['LastName'] . "</td>";
  echo "</tr>";
  }
echo "</table>";

mysql_close($con);
?> 

 

Now this is an example, you'll have to read the code and add or delete what you need. But I would suggest to try the site and learn from their examples and you'll get the hang of it, if you done it before. Cheers!  ;D

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.