URL not found on the server
Posted by: peterkn (---.0.fullrate.dk)
Date: August 02, 2013 03:15PM

I've created a db with phpmyadmin called tests.
My version of wampserver is 2.4. I have just installed it and not changed anything.
Now i have tried to run this code with: localhost/test/testdb.php

<?php
$conn = mysql_connect("localhost," "root," ""winking smiley or die(mysql_error());
mysql_select_db("tests"winking smiley;
$sql = "
CREATE TABLE books (
idnumber INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR (75),
author VARCHAR (50)
); ";
$sql2 = "
INSERT INTO books VALUES
(null, 'Oliver Twist', 'Charles Dickens');
";
mysql_query($sql, $conn) or die(mysql_error());
mysql_query($sql2, $conn) or die(mysql_error());
?>

-but the result is Not Found the requested URL /test/testdb.php was not found on this server.

The total URL on my computer is c:/wamp/www/test/testdb.php

Can anybody help me?

Options: ReplyQuote
Re: URL not found on the server
Posted by: RiggsFolly (---.as13285.net)
Date: August 02, 2013 04:38PM

What colout is your WampManager icon in the system tray?

Have you looked in the php error log?

Options: ReplyQuote
Re: URL not found on the server
Posted by: peterkn (---.0.fullrate.dk)
Date: August 02, 2013 05:27PM

Aha, my icon is green.
The php-log is blank, BUT the Apache log:

[Fri Aug 02 15:13:23.948868 2013] [:error] [pid 6124:tid 1532] [client ::1:58343] PHP Parse error: syntax error, unexpected '"root,"' (T_CONSTANT_ENCAPSED_STRING) in C:\\wamp\\www\\test\\testsdb.php on line 2

[Fri Aug 02 15:13:37.552092 2013] [:error] [pid 6124:tid 1532] [client ::1:58352] script 'C:/wamp/www/test/testdb.php' not found or unable to stat

What is the correct syntax in line 2?

Options: ReplyQuote
Re: URL not found on the server
Posted by: peterkn (---.0.fullrate.dk)
Date: August 02, 2013 05:41PM

I tried this
$conn = mysql_connect('localhost','root','');

Now thee is no fault in the logs, but the result says: No database selected.

Options: ReplyQuote
Re: URL not found on the server
Posted by: peterkn (---.0.fullrate.dk)
Date: August 02, 2013 06:28PM

I gave result when i created a database manually in phpmyadmin called tests.

Options: ReplyQuote
Re: URL not found on the server
Posted by: RiggsFolly (---.as13285.net)
Date: August 03, 2013 12:25AM

Best do a quick tutorial on PHP and MySQL. The PHP site is a good place to start


'$conn = mysql_connect('localhost', 'root', '');'

'mysql_select_db ( 'test' );'

Options: ReplyQuote


Sorry, only registered users may post in this forum.