Jump to content

Recommended Posts

here is my userlist.php

 

when i run the page i get the parse error

 

Parse error: parse error in C:\xampp\htdocs\testsite\community\userlist.php on line 152

 

line 152 of userlist.php is this

 

include("includes/footer.php"); ?>

 

when i remove the include footer it still has the same error

 

here is the userlist.php code

 

<?php
session_start();

if (!isset($_SESSION['user_id'])) {


	$url = absolute_url();
	header("Location: $url");

	exit();



}

include("includes/start.php");
require_once("includes/_connect.inc.php");

$display= 2;

if (isset($_GET['p']) && is_numeric($_GET['p'])) {


	$pages = $_GET['p'];

}

else	{

	$q = " SELECT COUNT(user_id) FROM user";

	$result = @mysqli_query($dbc, $q);

	$row = mysqli_fetch_array($result, MYSQLI_NUM);

	$records = $row [0];


	if ($records > $display) {

		$pages = ceil ($records/$display);

	}

	else  {

		$pages= 1;

	}

}

if (isset($_GET['s']) && is_numeric ($_GET['s'])) {

	$start =$_GET['s'];

} 	else {

$start =0;

}

 $q = " SELECT 
   
   user.user_first_name,
   user.user_surname,
   user.user_photo,
   user.user_age,
   user.user_sex,
   user.user_city,
   user.user_home_phone,
   user.user_mobile_phone,
   user.user_profession,
   user.user_specialist_area,
   user.user_email,
   user.user_password,
   user.user_username

   FROM
   user
  ASC LIMIT $start, $display";
  
  $r = @mysqli_query($dbc, $q);

  while ($row =mysqli_fetch_array($result, MYSQLI_ASSOC)) {


	while ($row =mysqli_fetch_array($result, MYSQLI_ASSOC)) {

	 echo "<div class='userlist'><table class='pictable'>


  <tr>
  <td><img src='images/".$row[user_photo]."' width='100%' height='100%'></img></td>  </tr></table>
  <table class='profiletable'>
	   <tr><td>First Name</td> <td>".$row[user_first_name]."</td>  </tr>
	  <tr><td>Surname</td> <td>".$row[user_surname]."</td></tr>
	 <tr><td>Age</td> <td>".$row[user_age]."</td></tr>
	  <tr><td>Email</td> <td>".$row[user_email]."</td></tr>
	  <tr><td>Sex</td> <td>".$row[user_sex]."</td></tr>
	    <tr><td>City</td><td>".$row[user_city]."</td></tr>
	  <tr><td>Home Phone</td> <td>".$row[user_home_phone]."</td></tr>
	  <tr><td>Mobile Phone</td> <td>".$row[user_mobile_phone]."</td></tr>
	  <tr><td>Profession</td> <td>".$row[user_profession]."</td></tr>
	  <tr><td>Specialist area</td> <td>".$row[user_specialist_area]."</td></tr>
</table></div>";
	  
	  }

	  mysqli_free_result($result);
	  mysqli_close($dbc);
	  
	  if ($pages>1) {
		  
		  echo'<br/><p>';
		  
		  $current_page =($start/$display) +1;
		  
		  if ($current_page !=1) {
			  
			  echo '<a href="userlist.php?s='.($start - $display).'&p='.$page.'">Previous</a>';
			  
		  }
		  
		  
		  for ($i =1; $i <= $pages; $i++) {
			  if ($i !=$current_page) {
				  
				  echo '< a href="userlist.php?s='.(($display * ($i -1))).'&p='.$pages.'">'.$i.'</a>';

			  }
			  
			  else {  
				  
				  echo $i.'';
				  
			  }
		  }
		  
		  
		  if ($current_page !=$pages) {
			  
			  echo '<a href="userlist.php?s='.($start + $display).'&p'.$pages.'">Next</a>';
			  
			  
		  }
		  
		  echo '</p>';
		  
	  }
	  
	  include("includes/footer.php"); ?>

 

can anyone help much thanks :)

 

 

Link to comment
https://forums.phpfreaks.com/topic/149164-why-am-i-getting-parse-errors/
Share on other sites

Ahh yes no more parse errors but now its throwing up some strange issues. I am paginating results so there are two profiles per page. The results are not appearing and the navigation at the bottom is just very strange. Its hard to explain whats happening so i sent the site as a attachment and included some screenshots of the problem im having.

 

[attachment deleted by admin]

got errors

 

Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in C:\xampp\htdocs\testsite\community\userlist.php on line 85

 

Warning: mysqli_free_result() expects parameter 1 to be mysqli_result, boolean given in C:\xampp\htdocs\testsite\community\userlist.php on line 109

 

the url looks abit strange too when going from previous and next

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.