PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old October 5th, 2004, 01:17 PM
o2mlab o2mlab is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Location: Halden, Norway
Posts: 5 o2mlab User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to o2mlab Send a message via AIM to o2mlab Send a message via MSN to o2mlab
Chatscript error in script by Tim Pabst

I was trying to get the chatscript to work, taken from the tutorial on http://www.devarticles.com/c/a/MySQL/A-MySQL-Driven-Chat-Script/

I'm happy to see the code have been put in to use as well, as I'm a designer, not a programmer. But I get some problems along the way. I figure some of this code might be wrong?

I use the first piece of code as an exampel:

function ShowLoginForm() {

?>

<b>Enter Your NickName</b>

<form name="chat" method="post" action="chat.php" target="_top">

<input type="text" name="nick" size="20">

<input type="hidden" name="action" value="enter">

<input type="hidden" name="chat" value="<font color=FF0000><b>Enters the Room</b></font>">

<input type="submit" name="Submit" value="Submit">

</form>

<?php

}


I get that the bottom } is misplaced, and I can't see any logic in ?> being placed in top of the code and <?php in the bottom?
This is done on several or all (I don't remember as I write) of the functions made in this tutorial?!

Can someone help me, please??

Reply With Quote
  #2  
Old October 8th, 2004, 10:41 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
its in the right place... since it closes off the function
if you notice, right after the function declaration, function ShowLoginForm() { , there's a break in the PHP, ?> .
This is where the HTML is... the idea being that it's easier than typing echo statements before each line of HTML...
Finally, after the HTML we come back to the PHP, <?php , and close the function...
The code you've presented is correct. Well, the only error i see is the grammatical mistake "Enters the Room"... heh... but that won't affect anything...

Are you receiving an error when you try to run the code? if so, what's the error?

Reply With Quote
  #3  
Old October 8th, 2004, 10:46 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
In an effort to compare and contrast the two different styles of writing that function...
i've coded what it might look like using echo statements...
but again, from what I can tell, the function as you've pasted it is correct.

PHP Code:
function ShowLoginForm() {

    echo 
"<b>Enter Your NickName</b>\n";
    echo 
"<form name=\"chat\" method=\"post\" action=\"chat.php\" target=\"_top\">\n";
    echo 
"<input type=\"text\" name=\"nick\" size=\"20\">\n";
    echo 
"<input type=\"hidden\" name=\"action\" value=\"enter\">\n";
    echo 
"<input type=\"hidden\" name=\"chat\" value=\"<font color=FF0000><b>Enters the Room</b></font>\">\n";
    echo 
"<input type=\"submit\" name=\"Submit\" value=\"Submit\">\n";
    echo 
"</form>\n";




Its really just a question of style and which way the programmer prefers...
Again I ask, are you receiving an error when you try to run the code? if so, what's the error?

Reply With Quote
  #4  
Old October 8th, 2004, 12:25 PM
o2mlab o2mlab is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Location: Halden, Norway
Posts: 5 o2mlab User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to o2mlab Send a message via AIM to o2mlab Send a message via MSN to o2mlab
Okay, thanks for sorting that out, the thing with the <?php! Now it's understandable why it's placed in the position it appears
But as I said in the first post, as an error message when trying to run the script I get that the bottom } (the symbol } that's supposed to close the function) is misplaced...
You can check the error message at http://marius.o2mlab.com/chat/test.php , maybe that will be more helpful?!

Thanks for your help so far, appreciate it I really hope we can get this sorted out, would love to have a great chat at the website...

Peace Out for now...

Reply With Quote
  #5  
Old October 10th, 2004, 02:51 AM
Itsacon's Avatar
Itsacon Itsacon is offline
Command Line Warrior
Click here for more information
 
Join Date: Aug 2004
Location: Sector ZZ9 Plural Z Alpha
Posts: 995 Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)  Folding Points: 805281 Folding Title: Super Ultimate Folder - Level 2Folding Points: 805281 Folding Title: Super Ultimate Folder - Level 2Folding Points: 805281 Folding Title: Super Ultimate Folder - Level 2Folding Points: 805281 Folding Title: Super Ultimate Folder - Level 2Folding Points: 805281 Folding Title: Super Ultimate Folder - Level 2Folding Points: 805281 Folding Title: Super Ultimate Folder - Level 2Folding Points: 805281 Folding Title: Super Ultimate Folder - Level 2
Time spent in forums: 6 Days 13 h 57 m 35 sec
Reputation Power: 5
Send a message via ICQ to Itsacon
is the script displayed your ENTIRE script?
if it is, I suggest putting another <?php at the very beginning and another ?> at the very end.
If not, could you post the rest of it too?

Reply With Quote
  #6  
Old October 10th, 2004, 01:02 PM
o2mlab o2mlab is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Location: Halden, Norway
Posts: 5 o2mlab User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to o2mlab Send a message via AIM to o2mlab Send a message via MSN to o2mlab
No, that's not close to the entire code, that was just an exampel of why I thought something was wrong...

But yeah, I did forget the start and end <?php and ?>...

Now, with some editing work, I'm getting closer, but still get som errors... The code may bee seen at http://marius.o2mlab.com/chat/chatcode.txt, and the script with the code as shown over can be tested at http://marius.o2mlab.com/chat/chat.php.

PS: the password's kept for safety in the codetext.php, it's used in the code on chat.php...

Maybe that may clear things up even more...?!

Reply With Quote
  #7  
Old October 11th, 2004, 04:14 PM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
is this the error you're referring to?
Fatal error: Call to undefined function: showaddposts()

check the spelling, or even if thefunction exists...

Reply With Quote
  #8  
Old October 12th, 2004, 01:56 AM
o2mlab o2mlab is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Location: Halden, Norway
Posts: 5 o2mlab User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to o2mlab Send a message via AIM to o2mlab Send a message via MSN to o2mlab
I got another error before this error leads me to the page telling me that the showAddForm doesn't exist... and according to the code i put in the post over, this function exists, doesnt it?

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > Chatscript error in script by Tim Pabst


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT