dad00 Posted September 24, 2009 Share Posted September 24, 2009 I keep getting this error whatever i do heres my code: TEACHER<br> <?php error_reporting(E_ALL); $HOST='localhost'; $USER='root'; $PASS=''; $DATABASE='school'; mysql_connect($HOST,$USER,$PASS) or die('connect'); mysql_select_db($DATABASE) or die($DATABASE); function confirm($msg) { echo "<script langauge=\"javascript\">alert(\"".$msg."\");</script>"; }//end function ?> <h4> Filter According To:</h4> Tutor <form action="" method="POST"> <?php $ages = array(); $query = mysql_query("SELECT * From pupils"); while($r = mysql_fetch_array($query)) { if(!in_array($r['tutor'], $ages)) array_push($ages, $r['tutor']); }; sort($ages, SORT_NUMERIC); echo "<select name='tutorfilter'> <option>Select Tutor</option>"; for($i = 0; $i < count($ages); $i++) echo "<option value=\"" . $ages[$i] . "\">" . $ages[$i] . "</option>"; echo "</select>"; ?> <input type="submit" value="Go"> </form> <?php if(isset($_POST['sent'])){ $_POST['tutorfilter']=$_POST['filter']; //add stamp if(isset($_POST['addstamp'])){ $id2=$_POST['id']; //echo $when; //$sql = "SELECT * FROM stamps WHERE player_id='$id2'"; $sql = mysql_query($sql) or die(mysql_error()); $numberofrows = mysql_num_rows($sql); //echo $numberofrows; if($numberofrows===0){ mysql_query("INSERT INTO stamps( player_id, total, totalweek ) VALUES($id2, '1','1') ") or die(mysql_error()); echo "no rows"; }else{ //mysql_query("UPDATE stamps SET $when = 1 WHERE player_id = $id2"); } //remove stamp /* if(isset($_POST['removestamp'])){ $id2=$_POST['id']; $sql = "SELECT * FROM stamps WHERE player_id='$id2'"; $sql = mysql_query($sql) or die(mysql_error()); $numberofrows = mysql_num_rows($sql); //echo $numberofrows; if($numberofrows===0){ //mysql_query("INSERT INTO stamps( player_id, monday1,monday2,monday3,monday4,monday5,tuesday1,tuesday2,tuesday3,tuesday4,tuesday5,wednesday1,wednesday2,wednesday3,wednesday4,wednesday5,thursday1,thursday2,thursday3,thursday4,thursday5,friday1,friday2,friday3,friday4,friday5 ) VALUES($id2, '0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0') ") or die(mysql_error()); //echo "no rows"; } //mysql_query("UPDATE stamps SET $when = 0 WHERE player_id = $id2"); } */ if(isset($_POST['tutorfilter'])){ $sql = "SELECT * FROM pupils WHERE tutor='".$_POST['tutorfilter']."' ORDER BY surname "; $sql = mysql_query($sql) or die(mysql_error()); while($rows = mysql_fetch_assoc($sql)) { echo "<form action='' method='POST'>"; echo "<a href='addpoints.php?id=".$rows['id']."' target='side'>".$rows['surname']." ".$rows['first_name']."</a>"; ?> <input type="submit" value="+" name="addstamp"> <input type="submit" value="-" name="removestamp"> <input type="hidden" value="<?php echo $rows['id']; ?>" name="id"> <input type="hidden" value="sent" name="sent"> <input type="hidden" value="<?php echo $_POST['tutorfilter']; ?>" name="filter"> </form> <?php } } ?> the error is Parse error: parse error in C:\wamp\www\teacher\index.php on line 101 and thats the bottom line Link to comment https://forums.phpfreaks.com/topic/175404-solved-parse-error-on-very-bottom-line/ Share on other sites More sharing options...
cahrehn Posted September 24, 2009 Share Posted September 24, 2009 I gave it a quick look in emacs and the automatic paren matching says that you need two more closing parens at the end. one closes: if(isset($_POST['addstamp'])){ and the other closes: if(isset($_POST['sent'])){ What are you using as an editor? If it's something without paren matching, Notepad++ and Jedit are two good Windows options and I like emacs on linux. I'd like to start using Eclipse, but that's going to take time to learn. Link to comment https://forums.phpfreaks.com/topic/175404-solved-parse-error-on-very-bottom-line/#findComment-924397 Share on other sites More sharing options...
dad00 Posted September 24, 2009 Author Share Posted September 24, 2009 i use notepad++ and my script works now thanks Link to comment https://forums.phpfreaks.com/topic/175404-solved-parse-error-on-very-bottom-line/#findComment-924404 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.