Nuggit Posted February 11, 2007 Share Posted February 11, 2007 I've looked through my code so many times, but I'm just not getting it. I Googled this error and found that it's usually a problem with a missing } or not having quick start enabled... but uh, line 1 of my document is "<?php" and that's not quick starting, is it? I guess I'll just post the code here: <?php $title = "thechickennuggit"; include ("/home/heathenk/public_html/tcn/skins/cookiecheck.php"); $headervar="/home/heathenk/public_html/tcn/skins/header"; $extension=".php"; include($headervar.$skin.$extension); $con = mysql_connect("localhost","heathenk_nuggit","******"); if(!$con){ die('Could not connect:' . mysql_error()); } $idnum = $_GET['id']; mysql_select_db("heathenk_dbfornuggit", $con); $query = mysql_query("SELECT * FROM Sk_book WHERE id=$idnum"); echo "<h1>Editing #" . $idnum . "</h2>"; while($row = mysql_fetch_array($query)) { //THE DISPLAY OF WHAT I'M EDITING echo '<table id="db" cellspacing="0" cellpadding="8">'; echo "<tr><td valign='top'>" . $row['id'] . "</td>"; echo "<td valign=top>" . $row['category'] . "</td>"; echo "<td>" . $row['Title'] . " (".$row['filename'] . ".php) "; echo "<a href='" . $row['imgURL'] . "'>[x]</a><br />"; echo "<p style='size:8pt;margin:2px;border:2px azure;'>"; if ($row['blurb'] !== null) { echo $row['blurb']; } else { echo "<b style='color:red;'>OMG this needs a blurb.</b>"; } echo "</p></td></tr>"; echo "</table>"; //THE FORM echo "<form action='edit123.php' method='post'>"; echo "<input type='hidden' name='id' value='".$idnum."' />"; echo "filename: <input type='text' value='".$row['filename']."' name='filename' style='font:8pt verdana;margin:5px;' />*<br />"; echo "category: <input type='text' value='".$row['category']."' name='category' style='font:8pt verdana;margin:5px;' />*<br />"; echo "Title: <input type='text' value='".$row['Title']."' name='Title' style='font:8pt verdana;margin:5px;' />*<br />"; echo "imgURL: <input type='text' value='".$row['imgURL']."' name='imgURL' style='font:8pt verdana;margin:5px;' /><br /><br />"; echo "blurb:<br /><textarea name='blurb' rows='14' cols='80' style='font:8pt verdana;margin:5px;'>".$row['blurb']."</textarea>"; echo '<input type="submit" /></form>'; } //while ends here mysql_close($con); $footervar = "/home/heathenk/public_html/tcn/skins/footer"; $extension = ".php"; include ($footervar.$skin.$extension); ?> Quote Link to comment https://forums.phpfreaks.com/topic/38050-solved-error-unexpected-end-on-line-1/ Share on other sites More sharing options...
PC Nerd Posted February 11, 2007 Share Posted February 11, 2007 ok, well i have no idea how to fix this error, with the code youve posted here all i can say is that if youve included it from another page, then maybe its that page thats the problem. if you incldue filse, and receive an error, check all of the error line becauase often the error is like "output started line 54 of "INC FILE.inc" Error on line 97 of page 'File that icludes the other'". in that case, your error is in the included file...... so maybe your script actually has a problem with an included file or something like that Quote Link to comment https://forums.phpfreaks.com/topic/38050-solved-error-unexpected-end-on-line-1/#findComment-182149 Share on other sites More sharing options...
Nuggit Posted February 11, 2007 Author Share Posted February 11, 2007 Hmm... I don't think so, because those first five lines are on every page of my website, and I don't get that error everywhere else. Quote Link to comment https://forums.phpfreaks.com/topic/38050-solved-error-unexpected-end-on-line-1/#findComment-182151 Share on other sites More sharing options...
Nuggit Posted February 14, 2007 Author Share Posted February 14, 2007 Well, I fixed the problem... It worked after I took out the comments inside the while {}, and after I turned stuff like $row['filename'] to $row[filename]. So what I learned is that Mr. While does not like comments, and you shouldn't use single quotes to call stuff from a row. >.> It's a little vexing. Isn't it? Why can't I comment inside there? And why do I see code bits in tutorials using single quotes for $row, when it doesn't work for me? Oh well, I solved the problem. Sorry for bumping, but I just felt like writing this out... and see if anyone could tell me more if they know off the top of their heads. Quote Link to comment https://forums.phpfreaks.com/topic/38050-solved-error-unexpected-end-on-line-1/#findComment-184353 Share on other sites More sharing options...
redarrow Posted February 14, 2007 Share Posted February 14, 2007 post your current correction dosent sound right ok. Quote Link to comment https://forums.phpfreaks.com/topic/38050-solved-error-unexpected-end-on-line-1/#findComment-184354 Share on other sites More sharing options...
Nuggit Posted February 14, 2007 Author Share Posted February 14, 2007 Well, the entirety of my code looks like this now: <?php $title = "thechickennuggit"; include ("/home/heathenk/public_html/tcn/skins/cookiecheck.php"); $headervar="/home/heathenk/public_html/tcn/skins/header"; $extension=".php"; include($headervar.$skin.$extension); $con = mysql_connect("localhost","heathenk_nuggit","******"); if(!$con){ die('Could not connect:' . mysql_error()); } $idnum = $_GET['id']; mysql_select_db("heathenk_dbfornuggit", $con); $query = "SELECT * FROM Sk_book WHERE id=$idnum"; $result = mysql_query($query); echo "<h1>Editing #" . $idnum . "</h2>"; while($row = mysql_fetch_array($result)) { echo '<table id="db" cellspacing="0" cellpadding="8">'; echo "<tr><td valign='top'>$row[id]</td>"; echo "<td valign=top>$row[category]</td>"; echo "<td>$row[Title] ($row[filename].php) "; echo "<a href=\"$row[imgURL]\">[x]</a><br />"; echo "<p style='size:8pt;margin:2px;border:2px azure;'>"; if ($row[blurb] !== null) { echo $row[blurb]; } else { echo "<b style='color:red;'>OMG this needs a blurb.</b>"; } echo "</p></td></tr>"; echo "</table>"; echo "<form action=\"edit123.php\" method=\"post\">"; echo "<input type='hidden' name='id' value='$idnum' />"; echo "filename: <input type='text' value=\"$row[filename]\" name='filename' style='font:8pt verdana;margin:5px;' />*<br />"; echo "category: <input type='text' value=\"$row[category]\" name='category' style='font:8pt verdana;margin:5px;' />*<br />"; echo "Title: <input type='text' value=\"$row[Title]\" name='Title' style='font:8pt verdana;margin:5px;' />*<br />"; echo "imgURL: <input type='text' value=\"$row[imgURL]\" name='imgURL' style='font:8pt verdana;margin:5px;' /><br /><br />"; echo "blurb:<br /><textarea name='blurb' rows='14' cols='80' style='font:8pt verdana;margin:5px;'>$row[blurb]</textarea>"; echo "<input type=\"submit\" /></form>"; } //while ends here mysql_close($con); $footervar = "/home/heathenk/public_html/tcn/skins/footer"; $extension = ".php"; include ($footervar.$skin.$extension); ?> (What's fishy now is that the footer isn't showing up. But I suppose that'd be for another topic later.) Quote Link to comment https://forums.phpfreaks.com/topic/38050-solved-error-unexpected-end-on-line-1/#findComment-184360 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.