PDA

View Full Version : Problem with DW & Local Host


topdog
06-25-2009, 04:46 PM
I posted this on the DW General FOrum - no replies - so thought I would try here.

I trying the excellent training videos from dj for php & mysql. Am having a problem getting DW to behave the way I want it to. (Obviously my error) Here is the information:

This is my connections.php

<?php
// this is a database connection script
$database = "dwc";
$username = "bjs";
$password = "bjspwd";
// end of login

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

?>-

This is my dwc.php

<?php
require_once("connections/connections.php");//database connections
//////////////////////
$query = sprintf("SELECT * FROM table1");
$result = @mysql_query($query);
$row = mysql_fetch_array(@result};
//////////////////////////////////
echo @row['field2'];

?>

NOTE The database does exist!!

When I try to preview in my browser using this
http://localhost/test/dwc.php

404 error:The requested URL /test/dwc.php was not found on this server.

This is the information from DW Site set up

Local Info:
Site Name: dwc
Local Root Folder: C:\Users\CARO\Documents\localroot\test\
Images Folder: C:\Users\CARO\Documents\localroot\test\images\
Links relative to document
HTTP Address; http://localhost


Remote Info:
Access: Local Network
Remote Folder: C:\Users\CARO\Documents\webroot\test\


Testing Server: PHP MYSQL
Access: Local/Network
Testing Server Folder: C:\Users\CARO\Documents\webroot\test\
URL Prefix http://local/test/

I get this error message when setting up the site using the above parameters.

Error Message: The site URL prefix [/test] for the testing server does not match the site URL prefix [] specified in HTTP Address for the site. This may causse pages using site relative links to display incorrectly at runtime. Proceed anyway?

I proceed and I get the problem of the 404 error.

More information - if I look at the www.directory through wamp it does not point to the required file for the php I am trying to load. Or rather, the file I am trying to load is not there - the folders that are there are webroot and website and an index.php file that came from a previous tutorial I was trying.

Help

Brian

bee80
06-25-2009, 05:31 PM
change this:


<?php
// this is a database connection script
$database = "dwc";
$username = "bjs";
$password = "bjspwd";
// end of login

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

?>

to
<?php
// this is a database connection script
$database = "dwc";
$username = "bjs";
$password = "bjspwd";
// end of login

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

?>


you had a concatenation(full stop ) instead of a comma in the $link variable
and i dont think you need the link variable in the select database function

also this contains a lot of errors
<?php
require_once("connections/connections.php");//database connections
//////////////////////
$query = sprintf("SELECT * FROM table1");
$result = @mysql_query($query);
$row = mysql_fetch_array(@result};
//////////////////////////////////
echo @row['field2'];

?>

change to:
<?php
//database connections

require_once("connections/connections.php");

$query = sprintf("SELECT * FROM table1");
$result = @mysql_query($query);
$row = mysql_fetch_array($result);

echo $row['field2'];

?>

topdog
06-25-2009, 07:24 PM
I changed the code where appropriate (my typing error having . instead of, and @ instead of $). The rest of the code I left as presented. (It came from a video by dj) However I still get nothing from the echo command although I have lost the 404.

Something seems to be pointing in the wrong direction. I therefore repeat the other information that I sent in the hope that it can be fixed.

This is the information from DW Site set up

Local Info:
Site Name: dwc
Local Root Folder: C:\Users\CARO\Documents\localroot\test\
Images Folder: C:\Users\CARO\Documents\localroot\test\images\
Links relative to document
HTTP Address; http://localhost


Remote Info:
Access: Local Network
Remote Folder: C:\Users\CARO\Documents\webroot\test\


Testing Server: PHP MYSQL
Access: Local/Network
Testing Server Folder: C:\Users\CARO\Documents\webroot\test\
URL Prefix http://local/test/

I get this error message when setting up the site using the above parameters.

Error Message: The site URL prefix [/test] for the testing server does not match the site URL prefix [] specified in HTTP Address for the site. This may causse pages using site relative links to display incorrectly at runtime. Proceed anyway?

More information - if I look at the www.directory through wamp it does not point to the required file for the php I am trying to load. Or rather, the file I am trying to load is not there - the folders that are there are webroot and website and an index.php file that came from a previous tutorial I was trying.

bee80
06-26-2009, 03:28 PM
have you inserted any data into your database table?? if not it wont return anything.

ps which video is it?

topdog
06-26-2009, 04:32 PM
I have about 50 records in the db and I am now getting a 404 error.

I think the problem may be in the wamp setup. When I first download wamp, I was using a different tutorial which suggested two directories on the desktop - webroot and website (in the www directory in wamp. In the video by dj he suggests setting up the site in the documents folder.

When I click on the wwwdirectory it directs me to the wamp/www/ and not to the documents folder. But I do not know how to change the defaults that I first set up in wamp.

The video is in the beginner php series and is Part 6 although the DW setup is Part 5

Brian