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 04-08-2007, 12:49 AM   #1
larryl
 
Join Date: Apr 2007
Posts: 3
Default trouble with php coding

I have follow the video tutorial up to part seven with no problems. However when I go to preview the code at the end of the lesson, as instructed, I get this error,
Quote:
Parse error: syntax error, unexpected T_VARIABLE in C:\wamp\www\Web Root\Test\Connections\connection.php on line 9

Besides the fact that I did not set an alias to the My Documents folder (opting to use the WWW folder in Wamp5) I believe I followed your instructions to the letter, however I still am receiving this syntax error stating that there is something wrong with my connection code.

Here is the connection code I have:
PHP Code:
<?php
//database connection script////////////
$database "dwc";
$username "lj";
$password "12345678"
////////////////////////////////////////
 
 
$link = @mysql_connect('localhost'$username$password);
$db mysql_select db($database$link);
 
?>
And here is my dwc.php test file
Code:
 
<?php
require_once("connections/connection.php"); ///database connection
 
/////////////////////////////////////////////////////////
$query = sprintf("SELECT * FROM table 1");
$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=iso-8859-1" />
<title>Untitled Document</title>
</head>
 
<body>
</body>
</html>
Any help would be greatly appreciated.

Larry Levins
larryl is offline   Reply With Quote
Old 04-08-2007, 10:20 AM   #2
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default

you havnt terminated the line which sets your password variable

PHP Code:
$password "12345678"//<< semicolon missing 



__________________
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote
Old 04-09-2007, 02:06 AM   #3
larryl
 
Join Date: Apr 2007
Posts: 3
Default

Now I am getting this.

Quote:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\wamp\www\Web Root\Test\dwc.php on line 7

PHP Code:
<?php
require_once("connections/connection.php"); ///database connection
 
/////////////////////////////////////////////////////////
$query sprintf("SELECT * FROM table 1");
$result = @mysql_query($query);
LINE 7 $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=iso-8859-1" />
<title>Untitled Document</title>
</head>
 
<body>
</body>
</html>
By the way, thank you for the help. I usually can figure this type of stuff out on my own, but boy am I stumped.
larryl is offline   Reply With Quote
Old 04-09-2007, 08:22 AM   #4
seco
 
Join Date: Apr 2007
Posts: 11
Default

dont use wamp server it goes bad !!
user other

good luck
seco is offline   Reply With Quote
Old 04-09-2007, 09:56 AM   #5
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default

Quote:
dont use wamp server it goes bad
how does it do that? past its sell by date? like a tomato

do you have any intelligent argument to back this up because i, and the members would like to hear your professional opinion with examples of bugs and "Badness" as you put it. If you have issues with WAMP5 let us know and if you convince me that its BAD! then i will withdraw my interest in it. The stage is yours.........

[[tumbleweed]]


anyhoo...
Quote:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\wamp\www\Web Root\Test\dwc.php on line 7
this is warning which is displaying correctly. Just supress it by using an @

example...

PHP Code:
$row = @mysql_fetch_array($result); 
NOTE: it had nothing to do with wamp5 being bad!
__________________
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 05:18 PM.


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