farban Posted March 12, 2009 Share Posted March 12, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/149164-why-am-i-getting-parse-errors/ Share on other sites More sharing options...
sasa Posted March 12, 2009 Share Posted March 12, 2009 remove line 88 Quote Link to comment https://forums.phpfreaks.com/topic/149164-why-am-i-getting-parse-errors/#findComment-783231 Share on other sites More sharing options...
redarrow Posted March 12, 2009 Share Posted March 12, 2009 while ($row =mysqli_fetch_array($result, MYSQLI_ASSOC)) { <<< repeated....... Quote Link to comment https://forums.phpfreaks.com/topic/149164-why-am-i-getting-parse-errors/#findComment-783234 Share on other sites More sharing options...
farban Posted March 12, 2009 Author Share Posted March 12, 2009 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] Quote Link to comment https://forums.phpfreaks.com/topic/149164-why-am-i-getting-parse-errors/#findComment-783255 Share on other sites More sharing options...
sasa Posted March 12, 2009 Share Posted March 12, 2009 in line 83 you setup variable $r and after use variable $result Quote Link to comment https://forums.phpfreaks.com/topic/149164-why-am-i-getting-parse-errors/#findComment-783262 Share on other sites More sharing options...
redarrow Posted March 12, 2009 Share Posted March 12, 2009 while ($row =mysqli_fetch_array($result, MYSQLI_ASSOC)) { to while ($row =mysqli_fetch_array($r, MYSQLI_ASSOC)) { Quote Link to comment https://forums.phpfreaks.com/topic/149164-why-am-i-getting-parse-errors/#findComment-783264 Share on other sites More sharing options...
farban Posted March 12, 2009 Author Share Posted March 12, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/149164-why-am-i-getting-parse-errors/#findComment-783278 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.