Dynamic Website

This is a discussion on "Dynamic Website" within the PHP Forum section. This forum, and the thread "Dynamic Website are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Oct 13th, 2007, 20:03
Reputable Member
Join Date: Mar 2007
Location: Kenya
Age: 20
Posts: 213
Thanks: 0
Thanked 0 Times in 0 Posts
Dynamic Website

Hi forumz
I have this pdf book im reading and it has this codes that im reading. Its soo good coz im understunding but now im stuck abit there is a code like this which brings an error. (unexpected T_STRING in ...datain.php on line 6)

PHP: Select all

<HTML>
<?php
$db 
mysql_connect("localhost""root","");
mysql_select_db("learndb",$db);
$sql "INSERT INTO personnel (firstname, lastname, nick, email, salary) VALUES ('$first','$last','$nickname','$$result = mysql_query($sql)";
echo 
"Thank you! Information entered.\n";
?>
</HTML>

and the combined form of this and the html to post some data in a database is this which is also giving out an error (unexpected T_STRING in ...datain.php on line 6)

PHP: Select all

<HTML>
<?php
if($submit)
{
$db mysql_connect("localhost""root","");
mysql_select_db("learndb",$db);
$sql "INSERT INTO personnel (firstname, lastname, nick, email, salary) VALUES ('$first','$last','$nickname','$result = mysql_query($sql);
echo "
Thank youInformation entered.n";
}
else
{
?>
<form method="
post" action="input.php">
First name:<input type="
Text" name="first"><br>
Last name:<input type="
Text" name="last"><br>
Nick Name:<input type="
Text" name="nickname"><br>
E-mail:<input type="
Text" name="email"><br>
Salary:<input type="
Text" name="salary"><br>
<input type="
Submit" name="submit" value="Enter information"></form>
<?
}
?>
</HTML>

Someone please help Im a learner in php. Im using wamp and the database is working
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Oct 13th, 2007, 20:08
alexgeek's Avatar
Moderator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,812
Blog Entries: 9
Thanks: 2
Thanked 2 Times in 2 Posts
Re: Dynamic Website

Change this line:
PHP: Select all

mysql_select_db("learndb",$db);
$sql "INSERT INTO personnel (firstname, lastname, nick, email, salary) VALUES ('$first','$last','$nickname','$result = mysql_query($sql);
echo "
Thank youInformation entered.n";


to:

PHP: Select all

mysql_select_db("learndb",$db);
$sql "INSERT INTO personnel (firstname, lastname, nick, email, salary) VALUES ('$first','$last','$nickname','$result = mysql_query($sql)";
echo 
"Thank you! Information entered.n";


You just missed an " mate!
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Oct 13th, 2007, 22:22
Rakuli's Avatar
SuperMember

SuperMember
Join Date: Sep 2007
Location: Australia
Age: 24
Posts: 956
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Dynamic Website

Alex has it spot on there. You have to make sure you close your quotes.

This sort of error is much easier to spot if you use a text editor with code sytax highlighting. If you take a look at your code, you will see all the code after the error is red meaning a literal string so it is easy to trace back to the source of the problem.

This thread http://www.webforumz.com/php-forum/6...ext-editor.htm has what PHP coders prefer as their editors. Would be worth taking a look.

Cheers,
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools

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
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a Dynamic Div with JS jwalker80 JavaScript Forum 1 Feb 13th, 2007 18:59
Dynamic website construction selvamcbe Web Page Design 4 Dec 9th, 2006 04:35
Dynamic Website Need Designer Mindgamer2 Job Opportunities 0 Nov 7th, 2006 18:45


All times are GMT. The time now is 11:15.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42