What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » Who knows something about SQL and PHP

Pages: (2): « First [ 1 ] 2 » Last »
Who knows something about SQL and PHP
Author: Message:
Exca
Senior Member
****

Avatar
Not illiteral, just ignoring you

Posts: 509
Reputation: 12
36 / Male / –
Joined: Mar 2004
Status: Away
O.P. Who knows something about SQL and PHP
Okay, here i'm back again with my website (http://www.exca.be)

I have a problem with the shoutbox.
It stores all the data into the SQL itself. When you put in a message, it's all in CAPITALL LETTERS. I don't know why, but I have to rewrite all messages in myphpadmin to normal, because that's so ugly.

Secondly; I would like the names to appear in blue color (I guess that has to be done in the red sentence in the code below).
Third problem: in the statusbar you can see that the when on the page of the shoutbox the website is loading, and loading, and loading... and keeps on loading (it bothers me)

Please help, this can't be much for someone who knows it.

To be complete:
Below are the codes used on for the shoutbox if you would need them:

ACTIONSCRIPT GENERAL:
code:
instname.onSetFocus= function() { if (instname.text=="Name") { instname.text=""; } };
instmessage.onSetFocus= function() { if (instmessage.text=="Message") { instmessage.text=""; } };

content.text = "Loading Shouts...";
myData = new LoadVars();
myData.onLoad = Fillvalues;
myData.load("http://www.exca.be/website/shout.php");

function Fillvalues() {
            content.text = eval("myData.content");
            error = eval("myData.error");
}

ACTIONSCRIPT ON THE SHOUT BUTTON
code:
on (release) {
    if (name eq "Name" || name eq "" || shout eq "Message" || shout eq "") {
        error = "REQUIRED FIELDS MISSING";
    } else {
        myData.name = name;
        myData.shout = shout;
        myData.sendAndLoad("http://www.exca.be/website/shout.php", myData, "POST");
        error = "SENDING DATA";
        myData.onLoad = Check;
    }
    function Check() {
        myData.load("http://www.exca.be/website/shout.php");
        myData.onLoad = Fillvalues;
    }
}


SHOUT.PHP
code:
<?
// BEKIJK README VOOR DETAILS

require("config.php");

if (!empty($_POST['name']) && !empty($_POST['shout'])) {
    $name=strtoupper($_POST['name']);
    $shout=strtoupper($_POST['shout']);
    $now=time();
    $sql=mysql_query("INSERT INTO shoutbox (id,date,name,shout) VALUES ('','$now','$name','$shout')")
     or die("&error=ERROR: ERROR INSERTING&content=SEE ERROR DETAILS");
   
    echo"&error=RECEIVED YOUR SHOUT";
}
else {
    $sql=mysql_query("SELECT * FROM shoutbox ORDER BY id DESC LIMIT 50")
     or die("&error=ERROR: WRONG QUERY&content=SEE ERROR DETAILS");
   
    if(mysql_numrows($sql)==0) {
        echo"&error=ERROR: RETURNED EMPTY&content=SEE ERROR DETAILS";
    }
    else {
        while($row=mysql_fetch_array($sql)) {
            $content="$content"."$row[name]:\n$row[shout]\n\n";
        }
        echo"&content=$content";
    }
}
?>

CONFIG.PHP
code:
<?
$host="localhost";
$user="exca_be";
$pass="***************";
$db="exca_be";

mysql_connect($host,$user,$pass) or die("&error=ERROR: CAN'T CONNECT&content=SEE ERROR DETAILS");
mysql_select_db($db) or die("&error=ERROR: CAN'T SELECT DB&content=SEE ERROR DETAILS");
?>



Thanks in advance :)

This post was edited on 01-05-2008 at 04:41 PM by Exca.
But that is my opinion!

[Image: djexcaround.gif]
01-05-2008 04:31 PM
Profile E-Mail PM Web Find Quote Report
NanaFreak
Scripting Contest Winner
*****


Posts: 1476
Reputation: 53
32 / Male / Flag
Joined: Jul 2006
RE: Who knows something about SQL and PHP
quote:
Originally posted by Exca
SHOUT.PHP
code:
<?
// BEKIJK README VOOR DETAILS

require("config.php");

if (!empty($_POST['name']) && !empty($_POST['shout'])) {
    $name=strtoupper($_POST['name']);
    $shout=strtoupper($_POST['shout']);
    $now=time();
    $sql=mysql_query("INSERT INTO shoutbox (id,date,name,shout) VALUES ('','$now','$name','$shout')")
     or die("&error=ERROR: ERROR INSERTING&content=SEE ERROR DETAILS");
   
    echo"&error=RECEIVED YOUR SHOUT";
}
else {
    $sql=mysql_query("SELECT * FROM shoutbox ORDER BY id DESC LIMIT 50")
     or die("&error=ERROR: WRONG QUERY&content=SEE ERROR DETAILS");
   
    if(mysql_numrows($sql)==0) {
        echo"&error=ERROR: RETURNED EMPTY&content=SEE ERROR DETAILS";
    }
    else {
        while($row=mysql_fetch_array($sql)) {
            $content="$content"."$row[name]:\n$row[shout]\n\n";
        }
        echo"&content=$content";
    }
}
?>

there is your problem ;)
01-05-2008 04:40 PM
Profile PM Find Quote Report
Exca
Senior Member
****

Avatar
Not illiteral, just ignoring you

Posts: 509
Reputation: 12
36 / Male / –
Joined: Mar 2004
Status: Away
O.P. RE: Who knows something about SQL and PHP
Wow, and what does there has to be? Nothing or something else?
But that is my opinion!

[Image: djexcaround.gif]
01-05-2008 04:42 PM
Profile E-Mail PM Web Find Quote Report
NanaFreak
Scripting Contest Winner
*****


Posts: 1476
Reputation: 53
32 / Male / Flag
Joined: Jul 2006
RE: Who knows something about SQL and PHP
nothing,

this is what that function does: http://php.net/manual/en/function.strtoupper.php
01-05-2008 04:43 PM
Profile PM Find Quote Report
Exca
Senior Member
****

Avatar
Not illiteral, just ignoring you

Posts: 509
Reputation: 12
36 / Male / –
Joined: Mar 2004
Status: Away
O.P. RE: Who knows something about SQL and PHP
Okay thanks! Do you also know something about problem two and three?

quote:
Secondly; I would like the names to appear in blue color (I guess that has to be done in the red sentence in the code below).
Third problem: in the statusbar you can see that the when on the page of the shoutbox the website is loading, and loading, and loading... and keeps on loading (it bothers me)
But that is my opinion!

[Image: djexcaround.gif]
01-05-2008 04:45 PM
Profile E-Mail PM Web Find Quote Report
NanaFreak
Scripting Contest Winner
*****


Posts: 1476
Reputation: 53
32 / Male / Flag
Joined: Jul 2006
RE: Who knows something about SQL and PHP
2:
$content="$content"."<span style='color:#0000ff'>$row[name]</span>:\n$row[shout]\n\n";

i think that should do it...

dont know about number 3 sorry
01-05-2008 04:48 PM
Profile PM Find Quote Report
Exca
Senior Member
****

Avatar
Not illiteral, just ignoring you

Posts: 509
Reputation: 12
36 / Male / –
Joined: Mar 2004
Status: Away
O.P. RE: Who knows something about SQL and PHP
OKay thank you very much!
But that is my opinion!

[Image: djexcaround.gif]
01-05-2008 04:53 PM
Profile E-Mail PM Web Find Quote Report
Exca
Senior Member
****

Avatar
Not illiteral, just ignoring you

Posts: 509
Reputation: 12
36 / Male / –
Joined: Mar 2004
Status: Away
O.P. RE: Who knows something about SQL and PHP
Too bad... the code doesn't seem to work (http://www.exca.be)
But that is my opinion!

[Image: djexcaround.gif]
01-05-2008 04:57 PM
Profile E-Mail PM Web Find Quote Report
NanaFreak
Scripting Contest Winner
*****


Posts: 1476
Reputation: 53
32 / Male / Flag
Joined: Jul 2006
RE: Who knows something about SQL and PHP
oh, that code is for html... i forgot that your site is flash, sorry that wont work
01-05-2008 05:00 PM
Profile PM Find Quote Report
Exca
Senior Member
****

Avatar
Not illiteral, just ignoring you

Posts: 509
Reputation: 12
36 / Male / –
Joined: Mar 2004
Status: Away
O.P. RE: Who knows something about SQL and PHP
Well actually its the shout.php file which builds the text in the dynamic text field...

There must be a way :)
But that is my opinion!

[Image: djexcaround.gif]
01-05-2008 05:04 PM
Profile E-Mail PM Web Find Quote Report
Pages: (2): « First [ 1 ] 2 » Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On