Hello,
I currently have a problem with a MySQL script, that'll output data to my page. Here is the script that I have:
This page is called:
get_email.php (Just for testing purposes)
Code:
<?php
include 'config.php';
?>
<?php
mysql_connect ("localhost", $username, $password);
@mysql_select_db($database) or die("Unable to select database");
$user_result = mysql_query("SELECT username FROM users");
$email_result = mysql_query("SELECT email FROM users");
print "<table width="100%">";
print "<thead>";
print "<tr>";
print "<th>Username</th>";
print "<th>Email Address</th>";
print "<th>Actions</th>";
print "<th><input name="" type="checkbox" value="" id="checkboxall" /></th>";
print "</tr>";
print "</thead>";
print "<tbody>";
while ($get_email = mysql_fetch_row($user_result)){
while ($get_user = mysql_fetch_row($email_result)){
print "<tr>";
foreach ($user_result as $usercred)
foreach ($email_result as $emailcred)
print "</td>$user_result</td>";
print "</td>$email_result</td>";
print "</tr>";
}
print "</tbody>";
?>
This page is called:
index.php
Code:
<?
include '../header.php';
?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>PS3Panda • Housekeeping • Home</title>
<link href="styles/layout.css" rel="stylesheet" type="text/css" />
<link href="styles/wysiwyg.css" rel="stylesheet" type="text/css" />
<!-- Theme Start -->
<link href="themes/blue/styles.css" rel="stylesheet" type="text/css" />
<!-- Theme End -->
</head>
<body id="homepage">
<div id="header">
<a href="" title=""><img SRC="img/cp_logo.png" alt="Control Panel" class="logo" /></a>
<div id="searcharea">
<p class="left smltxt"><a href="#" title="">Advanced</a></p>
<input type="text" class="searchbox" value="Search control panel..." onclick="if (this.value =='Search-2520control-2520panel..-2E'){this.value=''}"/>
<input type="submit" value="Search" class="searchbtn" />
</div>
</div>
<!-- Top Breadcrumb Start -->
<div id="breadcrumb">
<ul>
<li><img SRC="img/icons/icon_breadcrumb.png" alt="Location" /></li>
<li><strong>Location:</strong></li>
<li><a href="#" title="">Control Panel</a></li>
<li>/</li>
<li class="current">Manage Users</li>
</ul>
</div>
<!-- Top Breadcrumb End -->
<!-- Right Side/Main Content Start -->
<div id="rightside">
<!-- Status Bar Start --><!-- Status Bar End -->
<!-- Red Status Bar Start --><!-- Red Status Bar End -->
<!-- Green Status Bar Start --><!-- Green Status Bar End -->
<!-- Blue Status Bar Start --><!-- Blue Status Bar End -->
<!-- Content Box Start -->
<div class="contentcontainer">
<div class="headings alt">
<h2>Create New User</h2>
</div>
<div class="contentbox">
<table><form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<tr>
<td width="150"><strong>Current Password:</strong></td>
<td width="500"><label for="user">
<input name="user" type="text" class="inputbox" id="user" />
</label></td>
</tr>
<tr>
<td><strong>New Password:</strong></td>
<td><label for="pass">
<input name="pass" type="password" class="inputbox" id="pass" />
</label></td>
</tr>
<tr>
<td>Email Address:</td>
<td><label for="confirm">
<input name="confirm" type="password" class="inputbox" id="confirm" />
</label></td>
</tr>
<tr>
<td><strong>Nickname:</strong></td>
<td><label for="nickname">
<input name="nickname" type="text" class="inputbox" id="nickname" />
</label></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" id="createuser" name="createuser" class="btn" value="Create User" /></td>
</tr>
</table></form>
</div>
</div>
<?php
If(isset($_POST['createuser']))
{
include '../config.php';
$user = $_POST['user'];
$pass = $_POST['pass'];
$confirm = $_POST['confirm'];
$email = $_POST['email'];
$nickname = $_POST['nickname'];
$rank = $_POST['rank'];
mysql_connect(localhost,$username, $password);
@mysql_select_db($database) or die ("Unable to select Database");
$query = "INSERT INTO users VALUES ('','$user', '$pass','$nickname','$email','$rank')";
mysql_query($query);
}
?>
<!-- Content Box End -->
<!-- Graphs Box Start --><!-- Graphs Box End -->
<!-- Alternative Content Box Start -->
<div class="contentcontainer">
<div class="headings altheading">
<h2>Current Users</h2>
</div>
<div class="contentbox">
<?php
include 'get_email.php';
?>
<!-- Alternative Content Box End -->
<div style="clear:both;"></div>
<!-- Content Box Start --><!-- Content Box End -->
<div id="footer">
© Copyright 2011 PS3Panda</div>
</div>
<!-- Right Side/Main Content End -->
<!-- Left Dark Bar Start -->
<?
include '../sidebar.php';
?>
<!-- Left Dark Bar End -->
<!-- Notifications Box/Pop-Up Start -->
<div id="notificationsbox">
<h4>Notifications</h4>
<ul>
<li>
<a href="#" title=""><img SRC="img/icons/icon_square_close.png" alt="Close" class="closenot" /></a>
<h5><a href="#" title="">New member registration</a></h5>
<p>Admin eve joined on 18.12.2010</p>
</li>
<li>
<a href="#" title=""><img SRC="img/icons/icon_square_close.png" alt="Close" class="closenot" /></a>
<h5><a href="#" title="">New member registration</a></h5>
<p>Jackson Michael joined on 16.12.2010</p>
</li>
<li>
<a href="#" title=""><img SRC="img/icons/icon_square_close.png" alt="Close" class="closenot" /></a>
<h5><a href="#" title="">New blog post created</a></h5>
<p>New post created on 15.12.2010</p>
</li>
<li>
<a href="#" title=""><img SRC="img/icons/icon_square_close.png" alt="Close" class="closenot" /></a>
<h5><a href="#" title="">New group created</a></h5>
<p>�Web Design� group created on 12.12.2010</p>
</li>
<li>
<a href="#" title=""><img SRC="img/icons/icon_square_close.png" alt="Close" class="closenot" /></a>
<h5><a href="#" title="">1 new private message</a></h5>
<p>New message from Joe sent on 21.11.2010</p>
</li>
<li>
<a href="#" title=""><img SRC="img/icons/icon_square_close.png" alt="Close" class="closenot" /></a>
<h5><a href="#" title="">New member registration</a></h5>
<p>Graham joined on 20.11.2010</p>
</li>
</ul>
<p class="loadmore"><a href="#" title="">Load more notifications</a></p>
</div>
<!-- Notifications Box/Pop-Up End -->
<![endif]-->
</body>
</html>
And I then get the error of:
Quote:
|
Parse error: syntax error, unexpected T_LNUMBER in /home/noonhos1/public_html/cms/housekeeping/test/get_email.php on line 9
|
I really need help on this, all help is welcomed! Thanks!
Best Wishes,
Ptsface12