raggy99 Posted March 8, 2012 Share Posted March 8, 2012 Ok php is starting to annoy me. one tiny little key out and it stuff's everything up. I am getting a Server error The website encountered an error while retrieving http://BLAH BLAH BLAH BLAH.com/viewprocedure.php. It may be down for maintenance or configured incorrectly. Here are some suggestions: Reload this web page later. HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfil the request. Server is still up as other pages are working. <?php define('DB_NAME', 'raggsweb_oltusers'); define('DB_USER', 'raggsweb_raggs'); define('DB_PASSWORD', 'ctu158'); define('DB_HOST', 'localhost'); $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if (!$link) { die('çould not connect: '. mysql_error()); } include ('header.php'); include ('menu.php'); mysql_select_db(DB_NAME, $link); $result = mysql_query("SELECT * FROM procedures") or die(mysql_error()); <HTML> <BODY> echo "<table> <tr> <th scope='col'>Number</th> <th scope='col'>Procedure Name</th> <th scope='col'>Created By</th> <th scope='col'>View</th> <th scope='col'>Update</th> </tr>"; while($row = mysql_fetch_array($result)) { echo '<tr>'; echo '<td>'.$row['Procedure_number'].'</td>'; echo '<td>'.$row['Name'].'</td>'; echo '<td>'.$row['Created_by'].'</td>'; echo '<td><a href=/documents/'.$row['Uploadedfile'].'><img src='/images/folder.png'></a></td>'; echo '<td> </td>' echo '</tr>'; } echo '</table>'; include ('footer.php'); </BODY> </HTML> ?> I think it has something to do with line 34 echo '<td><a href=/documents/'.$row['Uploadedfile'].'><img src='/images/folder.png'></a></td>'; it stuffed up when i changed it to. echo '<td><a href=/documents/'.$row['Uploadedfile'].'><img src='/images/folder.png' width="25" height="25"></a></td>'; When I removed "width="25" height="25"" and took it back to the original code it still did not work. What have I done Wrong? is there a principle that I am missing with PHP and Tables? Quote Link to comment https://forums.phpfreaks.com/topic/258514-shoot-me/ Share on other sites More sharing options...
trq Posted March 8, 2012 Share Posted March 8, 2012 You have single quotes in a single quoted string. This logically makes no sense because php sees your inner quote as the end of the string. echo '<td><a href="documents/' . $row['Uploadedfile'] . '"><img src="/images/folder.png"></a></td>'; If you get yourself an editor with syntax highlighting these simple mistakes will stand out like tits on a bull Quote Link to comment https://forums.phpfreaks.com/topic/258514-shoot-me/#findComment-1325151 Share on other sites More sharing options...
litebearer Posted March 8, 2012 Share Posted March 8, 2012 Thorpe, if you have a pic of one of those, Natl Inq will pay a ton for it. Quote Link to comment https://forums.phpfreaks.com/topic/258514-shoot-me/#findComment-1325156 Share on other sites More sharing options...
PFMaBiSmAd Posted March 8, 2012 Share Posted March 8, 2012 Also, you should have php's error_reporting set to E_ALL (or even better a -1) and display_errors set to ON in your master php.ini on your development system so that all the php detected errors will be reported and displayed. Quote Link to comment https://forums.phpfreaks.com/topic/258514-shoot-me/#findComment-1325172 Share on other sites More sharing options...
raggy99 Posted March 30, 2012 Author Share Posted March 30, 2012 I am still getting the 500 internal server error The website encountered an error while retrieving http://BLAH BLAH BLAH BLAH.com/viewprocedure.php. It may be down for maintenance or configured incorrectly. Here are some suggestions: Reload this web page later. HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfil the request. I have changed my php.ini however it is still only show the error above? Please see my code below. <?php define('DB_NAME', 'raggsweb_oltusers'); define('DB_USER', 'raggsweb_raggs'); define('DB_PASSWORD', 'XXXXX'); define('DB_HOST', 'localhost'); $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if (!$link) { die('çould not connect: '. mysql_error()); } include ('header.php'); include ('menu.php'); mysql_select_db(DB_NAME, $link); $result = mysql_query("SELECT * FROM procedures") or die(mysql_error()); <HTML> <BODY> echo "<table> <tr> <th scope='col'>Number</th> <th scope='col'>Procedure Name</th> <th scope='col'>Created By</th> <th scope='col'>View</th> <th scope='col'>Update</th> </tr>"; while($row = mysql_fetch_array($result)) { echo '<tr>'; echo '<td>'.$row['Procedure_number'].'</td>'; echo '<td>'.$row['Name'].'</td>'; echo '<td>'.$row['Created_by'].'</td>'; echo '<td><a href="/documents/'.$row['Uploadedfile'].'"><img src='/images/folder.png' width="25" height="25"></a></td>'; echo '<td> </td>' echo '</tr>'; } echo '</table>'; include ('footer.php'); </BODY> </HTML> ?> Can anyone help? Quote Link to comment https://forums.phpfreaks.com/topic/258514-shoot-me/#findComment-1332613 Share on other sites More sharing options...
PFMaBiSmAd Posted March 30, 2012 Share Posted March 30, 2012 You have a fatal php parse (syntax) error in your code because you have some HTML tags (<HTML><BODY> and </BODY></HTML>) in-line inside your php code block. Only php statements can go inside of your php code block. You would either need to echo the HTML tags or exit php 'mode' by putting a closing ?> php tag before the html tags and then re-start php 'mode' by putting an opening <?php tag after the html tags. As it will save you a HUGE amount of development and debugging time by getting the php error_reporting/display_errors settings to work, you need to debug why the change you made to the php.ini did not take effect. Did you restart your web server to get the changes made to the php.ini to take effect? Did you change the php.ini that php is using? The Loaded Configuration File value in the output from a phpinfo statement is the php.ini that php is using. Quote Link to comment https://forums.phpfreaks.com/topic/258514-shoot-me/#findComment-1332618 Share on other sites More sharing options...
PFMaBiSmAd Posted March 30, 2012 Share Posted March 30, 2012 After you fix the in-line html tag problem I mentioned above, you will find that you have another fatal php parse/syntax error in your code (edit: which thorpe posted a fix for in reply #1.) I won't specifically mention what it is because it is imperative that you get the error_reporting/display_errors settings set as suggested on your development system to get php to help you find these basic/fundamental problems in your code so that you can get past them on your own without wasting time running to a help forum for each one. Ok php is starting to annoy me. one tiny little key out and it stuff's everything up. Programming is an exact science. Computers only do exactly what their code tells them to do. The syntax errors you are currently getting are the same as the red marks your language teacher put on the papers you turned in for spelling errors, grammar errors, and punctuation errors. The code you write must have perfect spelling, grammar, and punctuation before the computer will even execute it. Quote Link to comment https://forums.phpfreaks.com/topic/258514-shoot-me/#findComment-1332621 Share on other sites More sharing options...
PFMaBiSmAd Posted March 30, 2012 Share Posted March 30, 2012 And after you fix the above mentioned php syntax errors, there is yet another one a few lines later due to some missing punctuation. Quote Link to comment https://forums.phpfreaks.com/topic/258514-shoot-me/#findComment-1332622 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.