Jump to content

Parse error: syntax error, unexpected 'DISTINCT' (T_STRING) in


Jayden_Blade
Go to solution Solved by Ch0cu3r,

Recommended Posts

Hello again!

having an error issue.

Parse error: syntax error, unexpected 'DISTINCT' (T_STRING) in /home/jayden1/public_html/newmembers.php on line 91

<?php
			
			$year = (date('Y'));
			$month = (date('m'));
			$day = date(('d')- 30);
			$datecheck = mktime(0,0,0,$month,$day,$year);
			
			$new = $mysqli->query(SELECT DISTINCT signupdate FROM profiledata);
			$signupdate = $new;
			 if(mysql_num_rows($signupdate)>0){
	             print "<ul>";
	             while($users=mysql_fetch_array($signupdate)){
	             	print "<li>{$users[0]}</li>";
	             }
			
			?>

i have went through it like 100 times. I know i am missing something somewhere. Anyone know what I forgot?

Link to comment
Share on other sites

Parse error: syntax error, unexpected end of file in /home/jayden1/public_html/newmembers.php on line 135

New error?

<?php

session_start();
if (!$_SESSION || !$_SESSION['login']) {
 //redirect to a login page
 header('Location: index.php');
 
  exit;
}

?>









<html>
	
	<head>
		
		<link type="text/css" rel="stylesheet" href="style.css" />
	
	</head>
	
	<body>
		<div id="info_wrapper">
			
			<table align="center" width="1100px">
				<tr>
					
					<td width="220px" align="center">
						<a href="home.php">Home</a>
					</td>
						
					<td width="220px" align="center">
						<a href="myhome.php">My Home Page</a>
					</td>
						
					<td width="220px" align="center">
						<a href="profile.php">My Profile</a>
					</td>	
						
					<td width="220px" align="center">	
						<a href="msearch.php">Member Search</a>
					</td>
						
					<td width="220px" align="center">
						<a href="logout.php">Logout</a>
					</td>
				
				</tr>
			</table>

		</br>
			<table align="center" width="1100px">
			
				<tr>
					
					<td width="366px" align="center">
						<a href="missionstatement.php">Mission Statement</a>
					</td>
					
					<td width="366px" align="center">
						<a href="adviceblog.php">Advice Blog</a>
					</td>
					
					<td width="366px" align="center">
						<a href="storycorner.php">Story Corner</a>
					</td>	
					
					
				</tr>
			
			</table>
			</br></br></br>
			<h2 id="h2" align="center">
			New Members
			</h2>
			</br></br>
			<?php
			
			$year = (date('Y'));
			$month = (date('m'));
			$day = date(('d')- 30);
			$datecheck = mktime(0,0,0,$month,$day,$year);
			
			$new = $mysqli->query("SELECT DISTINCT signupdate FROM profiledata");
			$signupdate = $new;
			 if(mysql_num_rows($signupdate)>0){
	             print "<ul>";
	             while($users=mysql_fetch_array($signupdate)){
	             	print "<li>{$users[0]}</li>";
	             }
			
			?>
			</br></br>
			<p chat>
				Instant Messages and Online friends here
			</p chat>
</br></br></br>
			<table align="center" width="1100px">
				
				<tr>
					<td>
						<a href="tos.php">Terms of Service</a>
					</td>
					
					<td>
						<a href="suggestionbox.php">Suggestion Box</a>
					</td>	
				</tr>

				<tr>
					<td>
						<a href="privacy.php">Privacy Policy</a>
					</td>
					
					<td>
						<a href="problem.php">Report a Problem</a>
					</td>
				</tr>
				
				<tr>
					<td>
						<a href="contact.php">Contact Us</a>
					</td>
				</tr>
			</table>
		</div>	
  </body>
</html>
Link to comment
Share on other sites

You have left of the closing brace on line 98 (highlighted in red below)

 

           if(mysql_num_rows($signupdate)>0){
                 print "<ul>";
                 while($users=mysql_fetch_array($signupdate)){
                    print "<li>{$users[0]}</li>";
                 }
            } // <--- add this closing brace on line 98

 

Also you will want to echo out the closing list tag </li> after the while loop so your HTML has valid syntax. Having invalid HTML syntax could result in unexpected behaviour in different browsers.

Edited by Ch0cu3r
Link to comment
Share on other sites

 

Fatal error: Call to a member function query() on a non-object in /home/jayden1/public_html/newmembers.php on line 91

<?php

session_start();
if (!$_SESSION || !$_SESSION['login']) {
 //redirect to a login page
 header('Location: index.php');
 
  exit;
}

?>









<html>
	
	<head>
		
		<link type="text/css" rel="stylesheet" href="style.css" />
	
	</head>
	
	<body>
		<div id="info_wrapper">
			
			<table align="center" width="1100px">
				<tr>
					
					<td width="220px" align="center">
						<a href="home.php">Home</a>
					</td>
						
					<td width="220px" align="center">
						<a href="myhome.php">My Home Page</a>
					</td>
						
					<td width="220px" align="center">
						<a href="profile.php">My Profile</a>
					</td>	
						
					<td width="220px" align="center">	
						<a href="msearch.php">Member Search</a>
					</td>
						
					<td width="220px" align="center">
						<a href="logout.php">Logout</a>
					</td>
				
				</tr>
			</table>

		</br>
			<table align="center" width="1100px">
			
				<tr>
					
					<td width="366px" align="center">
						<a href="missionstatement.php">Mission Statement</a>
					</td>
					
					<td width="366px" align="center">
						<a href="adviceblog.php">Advice Blog</a>
					</td>
					
					<td width="366px" align="center">
						<a href="storycorner.php">Story Corner</a>
					</td>	
					
					
				</tr>
			
			</table>
			</br></br></br>
			<h2 id="h2" align="center">
			New Members
			</h2>
			</br></br>
			<?php
			
			$year = (date('Y'));
			$month = (date('m'));
			$day = date(('d')- 30);
			$datecheck = mktime(0,0,0,$month,$day,$year);
			
			$new = $mysqli->query("SELECT DISTINCT signupdate FROM profiledata");
			$signupdate = $new;
			 if(mysql_num_rows($signupdate)>0){
	             print "<ul>";
	             while($users=mysql_fetch_array($signupdate)){
	             	print "<li>{$users[0]}</li>";
	             }
			}
			?>
			</br></br>
			<p chat>
				Instant Messages and Online friends here
			</p chat>
</br></br></br>
			<table align="center" width="1100px">
				
				<tr>
					<td>
						<a href="tos.php">Terms of Service</a>
					</td>
					
					<td>
						<a href="suggestionbox.php">Suggestion Box</a>
					</td>	
				</tr>

				<tr>
					<td>
						<a href="privacy.php">Privacy Policy</a>
					</td>
					
					<td>
						<a href="problem.php">Report a Problem</a>
					</td>
				</tr>
				
				<tr>
					<td>
						<a href="contact.php">Contact Us</a>
					</td>
				</tr>
			</table>
		</div>	
  </body>
</html>
Edited by Jayden_Blade
Link to comment
Share on other sites

Hopefully the last question for a while..

 

Warning: mysql_num_rows() expects parameter 1 to be resource, array given in /home/jayden1/public_html/newmembers.php on line 93

<?php
			error_reporting(E_ALL);
			$year = (date('Y'));
			$month = (date('m'));
			$day = date(('d')- 30);
			$datecheck = mktime(0,0,0,$month,$day,$year);
			include ('/home/jayden1/database_access/database.php');
			$new = mysql_query("SELECT DISTINCT signupdate FROM profiledata");
			$signupdate = mysql_fetch_assoc($new);
			 if(mysql_num_rows($signupdate)>0){
	             print "<ul>";
	             while($users=mysql_fetch_array($signupdate)){
	             	print "<li>{$users[0]}</li>";
	             }
			}
			?>
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.