|
-
October 4th, 2009, 02:47 PM
#1
[RESOLVED] rows, tables, mysql, servers etc.
Greetings!
I've this code.
PHP Code:
<?php
include("config.php");
include("query_class.php");
$sql = "SELECT * FROM server";
$query = mysql_query($sql);
$user_list = array();
while($row_s=mysql_fetch_assoc($query)) {
$server_list[] = $row_s;
$info = query_source("$row_s['serveraddress_port']");
}
?>
<html>
<body>
Server List:
<center>
<table border="1">
<tr>
<th width="100px">Status</th>
<th width="100px">Game</th>
<th width="100px">Hostname</th>
</tr>
<?php foreach($server_list as $row): ?>
<tr>
<td align="center"><?php echo $info['status'] ? "ONLINE" : "OFFLINE"; ?></td>
<td align="center"><?php echo $info['game'] ?></td>
<td align="center"><?php echo $info['name'] ?></td>
</tr>
<?php endforeach; ?>
</table>
</center>
I need it to gather a row from my mysql database.
I've done this with users before(userlist) and it worked. But now I need to run a game query too. What have I done wrong since I can't get it to work? I get this error, probably just a typo.
Code:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING
My SQL is like this:
Code:
$table = "CREATE TABLE IF NOT EXISTS `server`(
`id` int(10) NOT NULL AUTO_INCREMENT,
`serveraddress_port` varchar(25) NOT NULL,
`rcon` varchar(35) NOT NULL,
PRIMARY KEY(id)
)";
mysql_query($table, $conn) or die(mysql_error());
Hope you understood it. I found that pretty hard to explain!
Best regards,
- realchamp.
-
October 5th, 2009, 10:44 AM
#2
Re: rows, tables, mysql, servers etc.
Nvm. I fixed it by playing around with it.
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
|
Click Here to Expand Forum to Full Width
|