view_blog.php

I am using Larry Ullman’s view_blog.php software on my Debian Linux system. When I click on view_blog I get the address localhost/view_blog.php/ in my browser. Then
when I click on Edit I get localhost/view_blog.php/edit_entry.php?id=2 as a browser address, but edit_entry.php is not accessed.

After installing the identical viewblog.php,edit_entry.php and delete.php on a GoDaddy Linux server they all work OK.

Can anyone explain why the Ullmam code works on GoDaddy but not on my localhost Apache2? This is not an Ullman code problem. Presumably it is some kind of setup or .htaccess problem?

first off you need to post the codes here so we can see what you are talking about

use the code tags please

mvnetn look at the address you posted. your trying to access the sub folder of a file (not Possible) you should not be able to get to /view_blog.php/edit_entry.php?id=2 on any server if you can on godaddy it is probably redirecting you to /edit_entry.php?id=2 automatically.

Please verify that what you typed below is accurate, if it is please post the live site cause I want to see that in action.

andrew you can do just about anything with the url if you are good with htaccess :wink: his problem is exactly that, htaccess is not acting the same on his localhost as it does on godaddy servers

Isn’t that what I said? It’s what I meant.

At this point the browser address is http://www.villageforum.net/view_blog.php
and the source is :-

<html xmlns="http//www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type"
content="text/html; charset=
iso-8859-1" />
<title>View my blog</title>

Revised Web Site Purpose

The revised purpose of this web site is to publish CCRC information based upon actual CCRC experience and to publish questions or comments related to actual CCRC experience. Other information of interest to seniors may also be included. Questions, answers and comments may be submitted to [email protected] or they may be submitted using the blogging capability which has been provided.
Edit Delete

After clicking on edit the browser address is
http://www.villageforum.net/edit_entry.php?id=4
and the source is :-

<html xmlns="http//www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type"
content"text/html; charset=
iso-8859-1" />
<title>Edit a blog entry</title>

Entry Title:

Entry Text: The revised purpose of this web site is to publish CCRC information based upon actual CCRC experience and to publish questions or comments related to actual CCRC experience. Other information of interest to seniors may also be included. Questions, answers and comments may be submitted to [email protected] or they may be submitted using the blogging capability which has been provided.

use the code blocks and page sourrce is not good we would need the actual php scripts

<html xmlns="http//www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type"
content="text/html; charset=
iso-8859-1" />
<title>View my blog</title>
<?php // view_blog.php This script connects to the MySQL server. //This script retrieves blog entries from the database // Address Error Handling ini_set ('display_errors',1); error_reporting (E_ALL & ~E_NOTICE); // Connect and select include('dbc_sql_db_inc.php');
// Define the query
$query = ' SELECT * FROM blog_entries ORDER BY date_entered  DESC';
if ($r =mysql_query ($query)) { // Run the query
// Retrieve and print every record
while ($row = mysql_fetch_array ($r)) {
print "<p><h3>{$row['title']}</h3>
{$row['entry']}<br />
<a href=\"edit_entry.php?id=
{$row['blog_id']}\">Edit</a>
<a href=\"delete_entry.php?id=
{$row['blog_id']}\">Delete</a>
</p><hr />\n";

}
} else { // Query did not run
die(’

Could not retrieve the data
because: ’ . msql_error() . “.
The query was $query,

”);
} // End of query IF
mysql_close();

?>

<html xmlns="http//www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type"
content"text/html; charset=
iso-8859-1" />
<title>Edit a blog entry</title>
<?php // edit_entry.php //This script edits a blog entry using UPDATE // Address Error Handling ini_set ('display_errors',1); error_reporting (E_ALL & ~E_NOTICE); include('dbc_sql_inc.php');

if (isset ($_POST[‘submit’]))
{ // Handle the form

// Define the query
$query = “UPDATE blog_entries SET title=’{$_POST[‘title’]}’, entry=’{$_POST[‘entry’]}’ WHERE
blog_id={$_POST[‘id’]}”;
$r = mysql_query ($query); // Execute the query
//REPORT ON THE RESULT
if (mysql_affected_rows() == 1) {
print ’

The blog entry has been updated.

’;
} else

{print "

Could not update the entry because: " . mysql_error(). “. The query was $query.

”;
}
} else { // Display the entry in a form
// Check for a valid entry ID in the URL
if(is_numeric ($_GET[‘id’])) {

//Define the query
$query = “SELECT * FROM blog_entries WHERE blog_id={$_GET[‘id’]}”;
if ($r = mysql_query ($query)) {// Run the query.
$row = mysql_fetch_array($r);// Retrieve the infORMATION

//Make the form

print ’

Entry Title:

Entry Text: ' . $row['entry'] . '

'; } else { // Could not get the information. print "

Could not retrieve the entry because: " . mysql_error() . ". The query was $query.

"; } } else { // No ID set print '

You must have made a mistake inusing this page.

'; }

} // End of main IF

mysql_close(); // Close the database connection.

?>

It is your apache configuration file that is not setup correctly. here is a start for you to begin some research on how to set it up http://www.bingshui.org/tech/apache2-htaccess-not-working/

or

Thanks for the help, mvnetn

Sponsor our Newsletter | Privacy Policy | Terms of Service