logo-dw

Go Back   Dreamweaver Club Forums > Dreamweaver forums > Video Tutorials
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 06-02-2008, 05:07 PM   #1
Grazy81
 
Join Date: Jun 2008
Posts: 4
Default Stuck on part 7

Hi guy's i have been following these viedo tutorials in php and have found them to be very clear and well explained. as i am pretty new to this your software set up tutorials were particularly usefull. However i have run into a few problems when running connection.php i am getting error on line 12

<?php


////////////////////
$database * "grazy";
$username * "grazy";
$password * "admin";
//////////////////////


$link * @mysql_connect("localhost", $username, $password);
$db * mysql_select_db($database, $link);


?>
This is the error code i get

Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in C:\wamp\www\web root\test\connections\connection.php on line 12

I was hoping you would be able to shed some light onto this as i am suspecting it is something silly i have messed up or a problem with connecting to the database i have created.

i would appreciate If you could help me with this as it has been driving me nuts for days now lol
Grazy81 is offline   Reply With Quote
Old 06-02-2008, 09:38 PM   #2
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default

please tell me why you have * instead of = when defining your connection variables
__________________
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote
Old 06-02-2008, 10:01 PM   #3
Grazy81
 
Join Date: Jun 2008
Posts: 4
Default

Ahhh that will be because i need to go to specsavers by the looks of it, i have changed it and it appears to be ok, now i will crack on with the rest of them, thanks for the help
Grazy81 is offline   Reply With Quote
Old 06-02-2008, 10:15 PM   #4
Grazy81
 
Join Date: Jun 2008
Posts: 4
Default

I am having problems on the next part too now i am getting error

Quote:
Warning: require_once(Connections/connection.php) [function.require-once]: failed to open stream: No such file or directory in C:\wamp\www\web root\test\connections\query.php on line 5

Fatal error: require_once() [function.require]: Failed opening required 'Connections/connection.php' (include_path='.;C:\php5\pear') in C:\wamp\www\web root\test\connections\query.php on line 5


This is the code i have entered


Quote:
<?php
require_once ("connections/connection.php");

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


echo $row['field3'];

?>


<!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>
However if i skip the connections/connections and just put in the info from the connections.php file it works and gives me the correct output so i'm suspecting there is a problem with accessing that file and i have made sure they are both in the same directory
C:\wamp\www\web root\test\connections\
Grazy81 is offline   Reply With Quote
Old 06-02-2008, 10:27 PM   #5
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default

where are your files located

im guessing you have somehow saved the file with your code into the connections directory

your main page is in your connections dir yet you are still calling in the connections file from a place in your require once which doesnt exist

please read the errors your getting as they are very useful and provide you with information needed
__________________
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote
Old 06-02-2008, 10:36 PM   #6
Grazy81
 
Join Date: Jun 2008
Posts: 4
Default

Yeah i got it now, origionally i had both files in the same folder but now i see where i was going wrong and was trying to call the connections folder from within the connections folder so now i have created the main page from the test directory and is working ok

Thanks again for your help
Grazy81 is offline   Reply With Quote
Old 06-02-2008, 10:39 PM   #7
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default

the errors in php are really good. Gve you lots of info which help
__________________
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:35 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com