Php help.

WarriorH

New Member
Messages
55
Reaction score
0
Points
0
Hi, I need help with this PHP code. I am trying to add a link into a PHP/SQL script, but it gives errors.

I made the link orange so you could spot it faster.

<?php
$sql=mysql_connect('HIDDEN','HIDDEN','HIDDEN') or die
("Error: Couldn't connect to database!");
mysql_select_db('HIDDEN') or die ("Error: Couldn't connect to database!");
$query="Select * from data";

$result=mysql_query($query,$sql);
echo "<table border=2><tr><th>Connect Info</th><th>Location</th><th>League</th><th>Players</th><th>Map</th></tr>";
//that gets the table opened, and <th> is Table Header, so with CSS you can make just those unique :)

while ($row=mysql_fetch_assoc($result)) {
//loop started!
echo "<tr><td>" . <a href="user/connectdata.php">Click Here To Connect </a>. "</td>"; //start the table row, and echo back the data in connectinfo in the first cell
echo "<td>" . $row['location'] . "</td>"; //echo back location in the 2nd cell
echo "<td>" . $row['leaguelevel'] . "</td>"; //echo back league in the 3rd cell
echo "<td>" . $row['players'] . "</td>"; //echo back players in the 4th cell
echo "<td>" . $row['map'] . "</td>"; //echo back map in the 5th cell
echo "</tr>"; //close the table row
} //loop ended. The loop will repeat as long as there's still data left to display.

echo "</table>"; //close the table
mysql_free_result($result); //saving memory, clear it out so it doesn't cause problems in the way future :)
?>
 

marshian

New Member
Messages
526
Reaction score
9
Points
0
This
PHP:
echo "<tr><td>" . <a href="user/connectdata.php">Click Here To Connect </a>. "</td>"; //start the table row, and echo back the data in connectinfo in the first cell
should be this:
PHP:
echo "<tr><td>" . "<a href=\"user/connectdata.php\">Click Here To Connect </a>". "</td>"; //start the table row, and echo back the data in connectinfo in the first cell

Edit:
unless you want to receive the contents of connectdata.php...
Then use this:
PHP:
echo "<tr><td>" . file_get_contents(user/connectdata.php) . "</td>"; //start the table row, and echo back the data in connectinfo in the first cell
 
Last edited:
Top