Jump to content

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


Jayden_Blade

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?

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>

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.

 

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>

So you are using $mysqli->query() without connecting to mysql.

 

What do you think you need to do now?

 

Also note mysqli methods/functions and mysql_* functions are not compatible. You use one or the other, not both at the same type.

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>";
	             }
			}
			?>

Archived

This topic is now archived and is closed to further replies.

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