PDA

View Full Version : yea another problem


MintDanny
02-08-2007, 04:31 PM
Hey,

i am currently up to the stage of getting a result from the database i have created,

here is the error i get

Warning: require_once(Connections/connection.php) [function.require-once (http://localhost/Local%20Root/Test/Image/function.require-once)]: failed to open stream: No such file or directory in C:\Documents and Settings\Owner\My Documents\Local Root\Test\Image\dwc.php on line 2

Fatal error: require_once() [function.require (http://localhost/Local%20Root/Test/Image/function.require)]: Failed opening required 'Connections/connection.php' (include_path='.;C:\php5\pear') in C:\Documents and Settings\Owner\My Documents\Local Root\Test\Image\dwc.php on line 2

Here is the code i am using;

<?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'];


?>Thanks in advance

Danny

domedia
02-08-2007, 04:37 PM
uhm.. did you read the error message? ;)

Connections/connection.php...

No such file or directory in C:\Documents and Settings\Owner\My Documents\Local Root\Test\Image\dwc.php

MintDanny
02-08-2007, 04:40 PM
Hey,

i thought the connection.php was supose to be located here;

C:\Documents and Settings\Owner\My Documents\Local Root\Test\Connections\connection.php

not

C:\Documents and Settings\Owner\My Documents\Local Root\Test\Image\dwc.php

Danny

domedia
02-08-2007, 04:49 PM
You just referred to 2 different files, so I'm not sure what to make out of it.

More importantly, if you read the error messages you are getting; are you able to understand what they mean?

domedia
02-08-2007, 04:50 PM
hint.. look at the path for connection.php

MintDanny
02-08-2007, 04:54 PM
thats why i am posting here, i do not understand what the error message is telling me to do, i have saved all the files where the tutorials told me so i do not see what is going wrong

Danny

davidj
02-08-2007, 07:21 PM
the first error message indicates that it cant pull in the connections script...

C:\Documents and Settings\Owner\My Documents\Local Root\Test\Image\dwc.php

this is because the dwc.php is in your image dir which means the the path to your connection script is incorrect

the next error is just a symptom of the first error.

your dwc.php file should be located in the root of the dir not in root/image as you have it and the connection script should be in root/Connections/