Adamb10 Posted June 21, 2006 Share Posted June 21, 2006 Scroll down to post #11 plz. Quote Link to comment https://forums.phpfreaks.com/topic/12597-unexpected-t_character-parse-error-on-line-67/ Share on other sites More sharing options...
Caesar Posted June 21, 2006 Share Posted June 21, 2006 Try this:[code]<?//commentmanagement.php//essential functions to lifedb_connect();//User logged in?if(session_is_registered('ub2')){ echo '<br><br><center> <table width="60%" cellspacing="1" cellpadding="4" border="0" class="border"> <tr> <td class="titlebg" colspan="2"> <b>Admin Center - Comment Management</b> </td> </tr><tr> <td class="windowbg" colspan="2"> <table width="100%" cellspacing="0" cellpadding="0" border="0"> <tr> <td class="windowbg" width="20%">Hey Adam!</td> <td class="windowbg" width="70%" align="right"><a href="?action=admin">Admin Center</a> | <b>Comments</b> | <a href="index.php?action=settings">Settings</a> | <a href="?action=customize">Customize</a></td> </tr> </table> </td> </tr> <td class="windowbg2"> Listed below are all the comments on this guestbook. Comments are listed by id and the persons name who posted it.<br><br>'; echo ' <table width="80%" cellspacing="1" cellpadding="4" border="0" class="border" align="Center"> <tr> <td class="titlebg"><b>ID</b></td> <td class="titlebg"><b>Name</b></td> <td class="titlebg"><b>Edit</b></td> <td class="titlebg" width="30%"><b>Delete</b></td> </tr>'; if(!isset($cmd)){$result = mysql_query("select * from comments order by id");while($r=mysql_fetch_array($result)) { $name=$r["name"]; //take out the title $id=$r["id"]; //Take out the id $date=$r["date"]; // Take out the Date echo " <tr> <td class='windowbg2'>$id</td> <td class='windowbg2'>$name</td> <td class='windowbg'><a href='?action=commentmanagement?cmd=edit&id=$id'>Edit</a></td> <td class='windowbg'><a href='?action=commentmanagement?cmd=delete&id=$id'>Delete</a></td> </tr> </center>"; if($_GET["cmd"]=="edit" || $_POST["cmd"]=="edit"){ if (!isset($_POST["submit"])) { $id = $_GET["id"]; $sql = "SELECT * FROM comments WHERE id=$id"; $result = mysql_query($sql); $myrow = mysql_fetch_array($result); echo " <form action='?action=editing' method='post'> <input type='hidden' name='id' value='.$myrow[id].'> <table width='100%' cellspacing='0' cellpadding='0' border='0'> <td class='titlebg' colspan='2'><b>Edit Comment</b></td> </tr><tr> <td class='windowbg2' width='30%'><b>Name:</b><br> <font class='subtext'>The name the person used to tell who they are.</font></td> <td class='windowbg'><input type='text' name='title' size='40' value='.$myrow['name'].'></td> </tr><tr> <td class='windowbg2' width='30%'><b>Email:</b><br> <font class='subtext'>The email the person used to be contacted.</font></td> <td class='windowbg'><input type='text' name='name' size='40' value=''.$myrow["email"].''></td> </tr><tr> <td class='windowbg2' width='30%'><b>Website:</b><br> The website the person entered in. This field is optional <td class='windowbg'><input type='text' name='name' size='40' value=''.$myrow['website'].''></td> </tr><tr> <td class='windowbg2' width='30%'><b>Comment:</b><br> <font class='subtext'>The comment the user entered in.</font></td> <td class='windowbg'><textarea name='comment' cols='38' rows='5'>'.$myrow['comment'].'</textarea></td> <input type='hidden' name='cmd' value='edit'> </tr> <tr> <td class='titlebg' colspan='2' align='right'><input type='submit' value='Edit Comment'> <input type='reset' value='Reset'></td></tr> </form>"; } }}echo '</table>';} else { error('You do not have permission to view this page because:<br> <b>You are not logged in</b>');}?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/12597-unexpected-t_character-parse-error-on-line-67/#findComment-48281 Share on other sites More sharing options...
mainewoods Posted June 21, 2006 Share Posted June 21, 2006 Go to line 67 in your source code and look at that line and the line before it. One or the other line will have a simple syntax error in it involving: failure to terminate single or double quotes, failure to terminate parentheses or currly braces, too many parentheses or curly braces, other simple syntax errors etc. Quote Link to comment https://forums.phpfreaks.com/topic/12597-unexpected-t_character-parse-error-on-line-67/#findComment-48282 Share on other sites More sharing options...
Adamb10 Posted June 21, 2006 Author Share Posted June 21, 2006 [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/adamb10/public_html/ub2/sources/admin/commentmanagement.php on line 74[/quote]I looked over the code twice, the only thing that catches my eye is the value= part and I tried changing that but I still got the error. Quote Link to comment https://forums.phpfreaks.com/topic/12597-unexpected-t_character-parse-error-on-line-67/#findComment-48283 Share on other sites More sharing options...
mainewoods Posted June 21, 2006 Share Posted June 21, 2006 What code is on line 74? Quote Link to comment https://forums.phpfreaks.com/topic/12597-unexpected-t_character-parse-error-on-line-67/#findComment-48288 Share on other sites More sharing options...
Caesar Posted June 22, 2006 Share Posted June 22, 2006 Ah...didn't notice...but you have a ton of errors surrounding the use of single quotes around your variables. Check those.[!--quoteo(post=386647:date=Jun 21 2006, 06:52 PM:name=Adamb10)--][div class=\'quotetop\']QUOTE(Adamb10 @ Jun 21 2006, 06:52 PM) [snapback]386647[/snapback][/div][div class=\'quotemain\'][!--quotec--]I looked over the code twice, the only thing that catches my eye is the value= part and I tried changing that but I still got the error.[/quote]Line 74 should be:[code]<td class='windowbg'><input type='text' name='title' size='40' value=''.$myrow['name'].''></td>[/code]But there are gonna be errors down the line in others areas where single quotes are used around variables. Quote Link to comment https://forums.phpfreaks.com/topic/12597-unexpected-t_character-parse-error-on-line-67/#findComment-48289 Share on other sites More sharing options...
Adamb10 Posted June 22, 2006 Author Share Posted June 22, 2006 Yeah, I get confused with the variable stuff and quotes. Quote Link to comment https://forums.phpfreaks.com/topic/12597-unexpected-t_character-parse-error-on-line-67/#findComment-48290 Share on other sites More sharing options...
mainewoods Posted June 22, 2006 Share Posted June 22, 2006 You should pop in and out of php mode instead of outputting large amounts of html between single quotes and double quotes. Makes it way less confusing[code]<?php //do php stuff?><a href="somelink">don't need to worry about single quotes ' or double quotes " either</a>more html<?php //back to php?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/12597-unexpected-t_character-parse-error-on-line-67/#findComment-48292 Share on other sites More sharing options...
Caesar Posted June 22, 2006 Share Posted June 22, 2006 [!--quoteo(post=386654:date=Jun 21 2006, 07:00 PM:name=Adamb10)--][div class=\'quotetop\']QUOTE(Adamb10 @ Jun 21 2006, 07:00 PM) [snapback]386654[/snapback][/div][div class=\'quotemain\'][!--quotec--]Yeah, I get confused with the variable stuff and quotes.[/quote]Welll...if it confuses you, you can do the following when using variables in your html...[code]echo"<table align=\"center\"><tr><td>Name: </td><td align=\"center\">$name</td></tr><tr><td>Name: </td><td align=\"center\">$name</td></tr></table>";[/code]Basically, use double quotes if you're going to have PHP variables there...it should make it easier for you.[!--quoteo(post=386656:date=Jun 21 2006, 07:05 PM:name=mainewoods)--][div class=\'quotetop\']QUOTE(mainewoods @ Jun 21 2006, 07:05 PM) [snapback]386656[/snapback][/div][div class=\'quotemain\'][!--quotec--]You should pop in and out of php mode instead of outputting large amounts of html between single quotes and double quotes.[/quote]Also an option ;-) Whatever is easiest for you. Quote Link to comment https://forums.phpfreaks.com/topic/12597-unexpected-t_character-parse-error-on-line-67/#findComment-48293 Share on other sites More sharing options...
Adamb10 Posted June 22, 2006 Author Share Posted June 22, 2006 I did do that Caesar(just not in this file), but in this file nothing works. Quote Link to comment https://forums.phpfreaks.com/topic/12597-unexpected-t_character-parse-error-on-line-67/#findComment-48294 Share on other sites More sharing options...
Adamb10 Posted June 22, 2006 Author Share Posted June 22, 2006 Instead of creating a new topic...I got the code to run thanks to starting and stopping PHP like previously mentioned. Now I got another problem(not a parse error :)).The whole purpose of this file is to let the admin edit/delete comments. When the admin clicks edit to edit a topic, the url goes to ?action=comments?cmd=edit&id=15. Unfortuantely, when I do click edit, it goes to a blank page instead of a few text boxes. The code for this is right here...[code]if($_GET["cmd"]=="edit" || $_POST["cmd"]=="edit"){ if (!isset($_POST["submit"])) {[/code]I use the action urls system where every action(like ?action=logout) is stored in actions.php. Heres a sampling from that file...[code]$action = $_GET['action'];if($action == "login"){ require('login.php');}if($action =="admin"){ require('admin/admin.php');}[/code]Any reason this wont work?Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/12597-unexpected-t_character-parse-error-on-line-67/#findComment-48298 Share on other sites More sharing options...
trq Posted June 22, 2006 Share Posted June 22, 2006 [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Any reason this wont work?[/quote]Nope.[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Unfortuantely, when I do click edit, it goes to a blank page instead of a few text boxes[/quote]Can we see the form in which you click this second edit? Quote Link to comment https://forums.phpfreaks.com/topic/12597-unexpected-t_character-parse-error-on-line-67/#findComment-48300 Share on other sites More sharing options...
Adamb10 Posted June 22, 2006 Author Share Posted June 22, 2006 Second edit? Theres only 1 edit you click to get to the form. [img src=\"http://adamb10.com/edit.jpg\" border=\"0\" alt=\"IPB Image\" /]OR...[a href=\"http://adamb10.com/ub2/?action=login\" target=\"_blank\"]http://adamb10.com/ub2/?action=login[/a]adam/hakkar are the login detailsClick commentsClick Edit for any of the comments Quote Link to comment https://forums.phpfreaks.com/topic/12597-unexpected-t_character-parse-error-on-line-67/#findComment-48303 Share on other sites More sharing options...
trq Posted June 22, 2006 Share Posted June 22, 2006 Ah... just now noticed. This...[code]?action=comments?cmd=edit&id=15[/code]Should be...[code]?action=comments&cmd=edit&id=15[/code]You have two ? in your query string. Quote Link to comment https://forums.phpfreaks.com/topic/12597-unexpected-t_character-parse-error-on-line-67/#findComment-48305 Share on other sites More sharing options...
mainewoods Posted June 22, 2006 Share Posted June 22, 2006 I would code it like this:[code] //end php?><table align="center"><tr><td>Name: </td><td align="center"><?php echo $name; ?></td></tr><tr><td>Name: </td><td align="center"><?php echo $name; ?></td></tr></table>[/code]--get to lose all those escaped quotes! Quote Link to comment https://forums.phpfreaks.com/topic/12597-unexpected-t_character-parse-error-on-line-67/#findComment-48306 Share on other sites More sharing options...
Adamb10 Posted June 22, 2006 Author Share Posted June 22, 2006 :p Right now I just wanna get a working script and then optimize/clean it up. P.S. Adding a & and removing the ? kinda works. I get the same page only without the posts. Quote Link to comment https://forums.phpfreaks.com/topic/12597-unexpected-t_character-parse-error-on-line-67/#findComment-48308 Share on other sites More sharing options...
Adamb10 Posted June 22, 2006 Author Share Posted June 22, 2006 [img src=\"http://www.adamb10.com/edit2.jpg\" border=\"0\" alt=\"IPB Image\" /]Theres the new screenshot, what it looks like after you hit edit. Quote Link to comment https://forums.phpfreaks.com/topic/12597-unexpected-t_character-parse-error-on-line-67/#findComment-48314 Share on other sites More sharing options...
trq Posted June 22, 2006 Share Posted June 22, 2006 Well... to be of any further help were going to need to see some code. Quote Link to comment https://forums.phpfreaks.com/topic/12597-unexpected-t_character-parse-error-on-line-67/#findComment-48315 Share on other sites More sharing options...
Adamb10 Posted June 22, 2006 Author Share Posted June 22, 2006 ummm..I posted the code on the last page, but heres more of it.[code]if(!isset($cmd)) {$result = mysql_query("select * from comments order by id"); while($r=mysql_fetch_array($result)) { $name=$r["name"]; //take out the title $id=$r["id"]; //Take out the id $date=$r["date"]; // Take out the Date echo " <tr> <td class='windowbg2'>$id</td> <td class='windowbg2'>$name</td> <td class='windowbg'><a href='?action=comments&cmd=edit&id=$id'>Edit</a></td> <td class='windowbg'><a href='?action=comments&cmd=delete&id=$id'>Delete</a></td> </tr> </center>"; if($_GET["cmd"]=="edit" || $_POST["cmd"]=="edit"){ if (!isset($_POST["submit"])) { $id = $_GET["id"]; $sql = "SELECT * FROM comments WHERE id=$id"; $result = mysql_query($sql); $myrow = mysql_fetch_array($result);//PHP, we need you to cool down so get a drink and relax. ?> <form action='?action=editing' method='post'> <input type=hidden name='id' value="<? echo $myrow["id"] ?>"> <table width='100%' cellspacing='0' cellpadding='0' border='0'> <td class='titlebg' colspan='2'><b>Edit Comment</b></td> </tr><tr> <td class='windowbg2' width='30%'><b>Name:</b><br> <font class='subtext'>The name the person used to tell who they are.</font></td> <td class='windowbg'><input type='text' name='title' size='40' value="<? echo $myrow["name"] ?>"></td> </tr><tr> <td class='windowbg2' width='30%'><b>Email:</b><br> <font class='subtext'>The email the person used to be contacted.</font></td> <td class='windowbg'><input type='text' name='name' size='40' value="<? echo $myrow["email"] ?>"></td> </tr><tr> <td class='windowbg2' width='30%'><b>Website:</b><br> <font class='subtext'>The website the person entered in. This field is optional</font></td> <td class='windowbg'><input type='text' name='name' size='40' value="<? echo $myrow["website"] ?>"></td> </tr><tr> <td class='windowbg2' width='30%'><b>Comment:</b><br> <font class='subtext'>The comment the user entered in.</font></td> <td class='windowbg'><textarea name='comment' cols='38' rows='5'><? echo $myrow["comment"] ?></textarea></td> <input type='hidden' name='cmd' value='edit'> </tr> <tr> <td class='titlebg' colspan='2' align='right'><input type='submit' value='Edit Comment'> <input type='reset' value='Reset'></td></tr> </form> <? } } } } [/code] Quote Link to comment https://forums.phpfreaks.com/topic/12597-unexpected-t_character-parse-error-on-line-67/#findComment-48316 Share on other sites More sharing options...
trq Posted June 22, 2006 Share Posted June 22, 2006 None of that code is relevent considering the first line says...[code]if(!isset($cmd))[/code]Assuming, that is, that $cmd = $_GET['cmd']Really... the problem with writting all your code in one big file like so is the logic becomes pretty un-userfriendly pretty quickl;y. The logic is quite difficult to follow when you cant see the whole picture. Quote Link to comment https://forums.phpfreaks.com/topic/12597-unexpected-t_character-parse-error-on-line-67/#findComment-48318 Share on other sites More sharing options...
Adamb10 Posted June 22, 2006 Author Share Posted June 22, 2006 hmmm... I see. I should probobly close that if statement earlier then? Quote Link to comment https://forums.phpfreaks.com/topic/12597-unexpected-t_character-parse-error-on-line-67/#findComment-48320 Share on other sites More sharing options...
trq Posted June 22, 2006 Share Posted June 22, 2006 See me edited post above.As I said.... In one big file, I really cant see your logic. Quote Link to comment https://forums.phpfreaks.com/topic/12597-unexpected-t_character-parse-error-on-line-67/#findComment-48321 Share on other sites More sharing options...
Adamb10 Posted June 22, 2006 Author Share Posted June 22, 2006 Yep that was it, I moved the textboxes to a new file and now it works. Thanks!! Quote Link to comment https://forums.phpfreaks.com/topic/12597-unexpected-t_character-parse-error-on-line-67/#findComment-48329 Share on other sites More sharing options...
Adamb10 Posted June 22, 2006 Author Share Posted June 22, 2006 Now, I cant get the code that actually edit's the DB to work. Ah well, Im sure I can tackle it on my own. :) Quote Link to comment https://forums.phpfreaks.com/topic/12597-unexpected-t_character-parse-error-on-line-67/#findComment-48330 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.