Jump to content

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/258514-shoot-me/
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/258514-shoot-me/#findComment-1325151
Share on other sites

  • 3 weeks later...

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?

Link to comment
https://forums.phpfreaks.com/topic/258514-shoot-me/#findComment-1332613
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/258514-shoot-me/#findComment-1332618
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/258514-shoot-me/#findComment-1332621
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.