MySQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMySQL 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 April 5th, 2005, 08:24 AM
ezta ezta is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 2 ezta User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 16 m 13 sec
Reputation Power: 0
Smile Mysql driven chat script didnt work

hi..can anyone help me to solve my problem? i just use the mysql driven chat script and i got this problemURL..

'An error occured while requesting the document from the testing server:'

i am using php5.0.3, mysql4.1.7 and apache2.0 and macromedia mx 2004

thanks a lot..URL

Reply With Quote
  #2  
Old April 5th, 2005, 12:12 PM
Madpawn Madpawn is offline
My beat is correct.
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 339 Madpawn User rank is Private First Class (20 - 50 Reputation Level)Madpawn User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 2 Days 22 h 3 m 33 sec
Reputation Power: 4
I'm gonna be ignorant here and say, "What's the mysql driven chat script?"

Reply With Quote
  #3  
Old April 6th, 2005, 09:52 AM
ezta ezta is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 2 ezta User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 16 m 13 sec
Reputation Power: 0
Smile

I am really sorry about that..here is the script..
<?
create database chat

create table chatScript
(
pk_Id int unsigned auto_increment,
theText varchar(100) not null,
theNick varchar(20) not null,
primary key(pk_Id),
unique id(pk_Id)
);
connect chat;
insert into chatScript values(0, 'This is a test message', 'TestUser');

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

function Login() {

global $chat;
global $nick;

session_start();
session_register("nick", $nick);
?>

<frameset rows="563,62" cols="*">
<frame name="posts" src="chat.php?action=posts&nick=<?php echo $nick; ?>&chat=<?php echo $chat; ?>">
<frame name="form" src="chat.php?action=form&nick=<?php echo $nick; ?>">
</frameset>

<noframes>
<body>

<p>This page uses frames, but your browser doesn't support them.</p>

</body>
</noframes>
</frameset>

<?php
}

function doSubmit()
{

if(document.chatform.chat.value == '') {
alert('Please enter some text!');
document.chatform.chat.focus();
return false;

}

document.chatform.submit();
document.chatform.chat.focus();

return true;

}
function GetInput() {

global $HTTP_SESSION_VARS;
global $chat;
global $nick;

?>

<form onSubmit="return doSubmit" name="chatform" method="post" action="chat.php" target="posts">
<input type="text" name="chat">
<input type="hidden" name="nick" value="<?php echo $nick; ?>">
<input type="button" onClick="doSubmit()" name="Submit" value="Say">
<select name="col">
<option>Black</option>
<option>Red</option>
<option>Green</option>
<option>Blue</option>
<option>Orange</option>
</select>

<input type="button" name="DoFace1" value=" " onClick="sendFace(1)">
<input type="button" name="DoFace2" value=" " onClick="sendFace(2)">
<input type="button" name="DoFace3" value=" " onClick="sendFace(3)">
<input type="hidden" name="action" value="posts">
</form>

<script language="JavaScript">

function sendFace(faceNum)
{
switch(faceNum)
{
case 1:
document.chatform.chat.value = '';
break;
case 2:
document.chatform.chat.value = '';
break;
case 3:
document.chatform.chat.value = '';
break;
}

document.chatform.submit();
document.chatform.chat.value = '';
}

function doSubmit()
{

if(document.chatform.chat.value == '') {
alert('Please enter some text!');
document.chatform.chat.focus();
return false;

}

document.chatform.chat.value = '<font color="'+document.chatform.col[document.chatform.col.selectedIndex].text+'">'+document.chatform.chat.value+'</font>';

document.chatform.submit();
document.chatform.chat.value = '';
document.chatform.chat.focus();

return true;

}

</script>

<?php
}
global $HTTP_SESSION_VARS;
global $chat;
global $nick;
print '<meta http-equiv="refresh" content="10;url=chat.php?action=posts&nick=<?php echo $nick; ?>">';
$svrConn = mysql_connect("localhost", "root", "admin") or die("<b>Error:</b> Couldnt connect to database server");

$dbConn = mysql_select_db("chat", $svrConn) or die ("<b>Error:</b> Couldnt connect to database");
if(!empty($chat)) {
$strQuery = "insert into chatScript values(0, '$chat', '$nick')";
mysql_query($strQuery);
}
$strQuery = "select theText, theNick from chatScript order by pk_Id desc limit 20";
$chats = mysql_query($strQuery);
while($chatline = mysql_fetch_array($chats)) {
print "<b>" . $chatline["theNick"] . ":</b> " . swapFaces($chatline["theText"]) . "<br>";
}
function swapFaces($chatLine) {

$chatLine = str_replace("", "<img src='smile.gif'>", $chatLine);
$chatLine = str_replace("", "<img src='frown.gif'>", $chatLine);
$chatLine = str_replace("", "<img src='bigsmile.gif'>", $chatLine);

return $chatLine;
}
if (empty($action))
ShowLoginForm();
elseif ($action == "posts")
ShowAddPosts();
elseif ($action == "form")
GetInput();
elseif ($action == "enter")
Login();
?>

thanks a lot...URL

Reply With Quote
  #4  
Old April 6th, 2005, 04:15 PM
Madpawn Madpawn is offline
My beat is correct.
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 339 Madpawn User rank is Private First Class (20 - 50 Reputation Level)Madpawn User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 2 Days 22 h 3 m 33 sec
Reputation Power: 4
PHP can't directly interact with the db without using the mysql_query() function, so the lines at the very beginning of your script are going to break. You should be getting a parse error, though, unless you've got some error-handling set up on your server that's masking it and just giving you a generic error message. You may want to talk to your admin.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > Mysql driven chat script didnt work


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 6 hosted by Hostway
Stay green...Green IT