I can't get it to display the data from my SQL table called "ig_servers". basically i just want to display everything in it. I'm new to php and even newer to smarty so I must be missing something huge. The closet i came following other forum posts was having the first character displayed in every field.
The actual php part worked when I wasn't using smarty. But I don't want to violate the tho shall not mix presentation and business logic together rule.
Any suggestions?
Script
$result = $mysqli->query("SELECT * FROM ig_servers") or mysqli_error('Theres been a horrible horrible error probably relating to the SQL query');
if ($result->num_rows >= 1)
{
while ($row=$result->fetch_array(MYSQL_ASSOC))
{
$data = array(
"ig_sid"=>$row['ig_sid'],
"ig_masterserverip"=>$row['ig_masterserverip'],
"ig_serverip"=>$row['ig_serverip'],
"ig_uid"=>$row['ig_uid']);
}
$smarty->assign('data', $data);
}
$smarty->display('addserver.tpl');
if(isset($_POST['submit'])){
//Will add stuff here after sleep.
}
?>
Template Schtuff:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
{section name="id" loop="data"}
<li>{$data[id]} {$data[id]} {$data[id]} : {$data[id]}</li><br>
{/section}
</body>
</html>

New Topic/Question
Reply




MultiQuote




|