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 12-11-2007, 11:33 PM   #1
irock
 
Join Date: Dec 2007
Posts: 6
Default Stuck on PHP Video Tutorial - unexpected T_VARIABLE

Anyone able to help me on this.

I'm just following a basic video tutorial, I'm new to PHP.
I've checked my code and passwords etc over and over again.

When I preview I get

"Parse error: syntax error, unexpected T_VARIABLE in C:\wamp\www\Local Root\Test\dwc.php on line 5"

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



?>


<!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>
My connection file looks like this:

Code:
<?php
//////////////////////////////////////////////
$database = "dwc";
$username = "shane";
$password = "I put my password here";
/////////////////////////////////////////////


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

?>
Any help would be greatly appreciated.
I'm guessing that the problem is with the "sprintf" - but I'm not sure.
I've messed around for a while now trying to fix it but no luck yet.

Thanks


iRock
irock is offline   Reply With Quote
Old 12-11-2007, 11:41 PM   #2
irock
 
Join Date: Dec 2007
Posts: 6
Default Problem Solved

I found the problem, missing the ;
irock is offline   Reply With Quote
Old 12-12-2007, 06:38 AM   #3
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default

remember that error

you will see that allot
__________________
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 12:19 AM.


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