Jump to content

Recommended Posts

Can't seem to spot the problem, sorry if it's a bit messy =/

 

thanks in advance :D

 

 

<?php
session_start();

include("db.php");




if(isset($_POST['submit'])){
   $username = $_POST['username'];
   $password = $_POST['password'];

   $checklogin = mysql_query("SELECT * FROM tbl_users WHERE user_name = $username && user_pass = $password");
   
   if(!$checklogin){
   
     //login failed
     
   } else {
   
   while($checkrank = mysql_fetch_array($checklogin)){


   $_SESSION['username'] = $checkrank['user_name'];
   $_SESSION['rank'] = $checkrank['user_rank'];

   }
   
   $_SESSION['loggedin'] = 1;
   
   }
   
if(!isset($_GET['catid'])){

?>

<html>
  <head>
   <title> Clint Orms - Shopping Cart </title>
   <link rel="stylesheet" type="text/css" href="style.css">
  </head>
  <body>
   <div id="container"> <!-- start container-->
     <div id="topbar"><!-- start topbar-->
       <img class="logo" src="logo.gif"><?php if(!$_SESSION['loggedin']){ ?><form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>"><label for="username">Username</label><input type="text" name="username"><br><label for="password">Password</label><input type="password" name="password"><br><input type="hidden" value="category"><input type="submit" value="login"></form> <?php } else { ?> <?php echo $_SESSION['username']; ?> [My Cart]<br>[Logout] <?php } ?>
     </div><!-- end topbar-->
     <div id="navbar"><!-- starts navbar-->
       Select A Category ...
     </div><!-- ends navbar-->
     <div id="items">
       <?
       $get_cats = mysql_query("SELECT * FROM tbl_category");
       while($cats = mysql_fetch_array($get_cats)){
       ?>


       <div id="category" onclick="location.href='default.php?catid=<? echo $cats['cat_id']; ?>';"><b><? echo $cats['cat_name']; ?></b><br><small><? echo $cats['cat_description']; ?></small></div><!-- ends category-->
       <?php } ?>
       </div><!-- ends items-->
       </div><!-- ends container-->
       </body>
       </html>
       
       
<?php } else {  ?>










<html>
  <head>
   <title> Clint Orms - Shopping Cart </title>
   <link rel="stylesheet" type="text/css" href="style.css">
  </head>
  <body>
   <div id="container"> <!-- start container-->
     <div id="topbar"><!-- start topbar-->
       <img class="logo" src="logo.gif"></img><?php if(!$_SESSION['loggedin']){ ?><form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>"><label for="username">Username</label><input type="text" name="username"><br><label for="password">Password</label><input type="password" name="password"><br><input type="submit" value="login"></form><?php } else { ?> <?php echo $_SESSION['username']; ?> [My Cart]<br>[Logout] <?php } ?>
     </div><!-- end topbar-->
     <div id="navbar"><!-- starts navbar-->
       <?php
        $category = $_GET['catid'];
        $getcategory = mysql_query("SELECT * FROM tbl_category WHERE cat_id = $category");
        
        while($displaycat = mysql_fetch_array($getcategory)){
        echo "<a href=\"default.php\" class=\"category\">Select A Category</a> \\ ".$displaycat['cat_name'];
        }
        ?>
        

     </div><!-- ends navbar-->


       <div id="items">



      <?php
       $getitems = mysql_query("SELECT * FROM tbl_product WHERE cat_id = $category ORDER BY pd_id DESC");

      while($get = mysql_fetch_array($getitems)){

       ?>

     <div id="item"> <!-- start item-->
     <? echo $get['pd_name']; ?><br><img src="<? echo $get['pd_thumbnail']; ?>"><br><div id="cost">Cost: <? echo $get['pd_price']; ?></div> <br><small><? echo $get['pd_description']; ?></small>
     </div><!-- end item-->

      <?php } } ?>



  </div><!-- ends items-->
   </div><!-- end containter-->
  </body>
</html>

 

Parse error: syntax error, unexpected $end in /homepages/29/d119570661/htdocs/wmptest.com/clintormscart/default.php on line 123

Link to comment
https://forums.phpfreaks.com/topic/135570-syntax-error/
Share on other sites

Usually $end means you are missing a ; or } or ?>

 

Since your code goes in and out of PHP so much with braces etc, I will let you figure out where it is. At least now you know what to look for.

 

And check around line 123, most likely above it 1-5 lines but even below it and see what is there and what might be causing the problem.

Link to comment
https://forums.phpfreaks.com/topic/135570-syntax-error/#findComment-706253
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.