PDA

View Full Version : PHP, A beginners Guide - 404 error


Rwb
01-20-2008, 02:29 PM
Hey guys,

I have been doing this tutorial (PHP, A beginners Guide) and got up to part 7 where I write the coding so that I can show my database on a web page. However when it came to test time (pressing F12) his worked and unfortunately mine didn't. I have been back over the coding a few times just to make sure that I didn't miss anything or have any miss spellings but I haven't noticed anything. what happens basically is when I press F12 it just comes up with a 404 error saying that the web page cannot be found. It may have something to do with Dreamweaver as it is fairly new and I may have to change some settings.

I noticed a few different things between both my and his web page when they were launched. His URL was http://localhost/test/dwc.php where as mine is http://localhost/test/Images/dwc.php. I saved the dwc.php file in my images like he did so unless I wasn't supposed to.

Also the dwc.php file is saved in Web Root/Test as well as Web Root/Test/Images as well as Local Root/Test. Also in Web Root/Test there is a dwc.php.lck file. I'm not sure if that is supposed to be there.

dwc.php
<?php
require_once("Connections/connection.php"); // database connection
////////////////////////////////////////
$query = sprintf("SELECT * FROM table1");
$result = @mysql_query($query);
$row = mysql_fetch_array($result);
/////////////////////////////////////////

echo $row['field2'];

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
</body>
</html>

connection.php
<?php
////////////////////////////////////////////
$database = "dwc"
$username = "dj"
$password = "******"
///////////////////////////////////////////

$link = @mysql_connect('localhost', $username, $password);
$db = mysql_select_db($database, $link);
?>

Those are the codes, also the asterisks (*) for password are there on purpose as it is my password to everything so I would rather no reveal it.

Anyway I hope I haven't confused you all too much and you can still help me out. :lol:

Thanks in advance,
Max

davidj
01-20-2008, 06:00 PM
I saved the dwc.php file in my images like he did so unless I wasn't supposed to.

no i never

i would never save anything to the images directory unless they were images

404 error means "file not found"

you have setup your site in dreamweaver incorrectly

your paths wrong

set this site up again but only add your images dir were it asks for it

Rwb
01-21-2008, 02:15 AM
Still not coming up even though I have the sane URL as the one in the tutorial. I did steps 5-7 all over again and correctly this time but it's still coming up with the 404 error.

Could it have something to do with my dreamweaver?

Rwb
01-21-2008, 02:23 AM
The error also may be realted to this message I got when I tried to configre the URL prefix in Testing server. Originally I just clicked ok but now I'm starting to think that it may have something to do with the 404 error message.

http://i86.photobucket.com/albums/k84/lufc6/AdobedreamweavererrorURLprefix.jpg

davidj
01-21-2008, 07:25 AM
do a screen shot of your site settings in dreamweaver and post them here

Rwb
01-21-2008, 07:46 AM
http://i86.photobucket.com/albums/k84/lufc6/LocalInfo.jpg
http://i86.photobucket.com/albums/k84/lufc6/TestingServer.jpg
http://i86.photobucket.com/albums/k84/lufc6/RemoteInfo.jpg

davidj
01-21-2008, 11:27 AM
it could be your wamp server is wrong

setup an alias and point that to the right address

ssx95351
01-20-2010, 07:41 AM
it could be your wamp server is wrong

setup an alias and point that to the right address

I am having the same issue with the 404 error. How can i resolve this? I see where I can make a new Alias through the WAMPSERVER control panel, but not sure what I am supposed to type.

the window that I see says:

Enter your alias.
For example,

'test'

would create an alias for the url

http://localhost/test/

:


I'm not sure what to type. Thank you in advance.