Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2005
    Posts
    190
    Tokens
    0

    Default What wrong with my code ARGH! + Rep

    The code is for a shoutbox +Rep to anyone who can help :0



    PHP Code:
    <? 
    include "config.php"// include the config 
    if($_POST['submit']){ //checks if the form was submitted 
    $name $logged[username]; //posts the username 
    $shout $_POST['shout']; //posts the shout 
    $insert MYSQL_QUERY("INSERT INTO shout (name,shout)"
    "VALUES ('$name', '$shout')"); //inserts into the database 

    $find mysql_query("select * from shout order by id desc limit 5"); //finds the shouts order by id 
    while($r=mysql_fetch_array($find)){ //loop's the shouts 
    $name $r[name]; //name 
    $shout $r[shout]; //shout 
    echo "<b><font size='10px' color='#FF3380' face='verdana'>$name</font></b><br><font size='10px' color='#FF3380' face='verdana'>".$shout."</font><p>";  
    if(
    $logged[username]){ //if the user is logged in display the form 
    echo 
    <form method=post> 
    Shout:<br/> 
    <textarea name=shout cols=28 rows=4>Message here</textarea><br/> 
    <input type=submit value=Shout name=submit><br/> 
    </form>"


    ?>

  2. #2
    Join Date
    Feb 2006
    Location
    Ontario Canada
    Posts
    4,587
    Tokens
    0

    Latest Awards:

    Default

    what error are u getting?

    .:.:#14:.:. .:.: Impossible Is Nothing :.:. .:.: 845 Rep:.:.
    .:.: Stand up for what is right, even if you stand alone:.:.


  3. #3
    Join Date
    Feb 2005
    Location
    Leicestershire / Sheffield
    Posts
    685
    Tokens
    0

    Default

    Well what is it not doing? Any error messages?

    I can see a few things, but if u dont post whats wrong how is anyone ment to help.

  4. #4
    Join Date
    Jul 2005
    Posts
    190
    Tokens
    0

    Default

    Parse error: syntax error, unexpected $end in /home/johno/public_html/shout.php on line 23

  5. #5
    Join Date
    Feb 2005
    Location
    Leicestershire / Sheffield
    Posts
    685
    Tokens
    0

    Default

    PHP Code:
    <? 
    include "config.php"// include the config 
    if($_POST['submit']){ //checks if the form was submitted 
    $name $logged[username]; //posts the username 
    $shout $_POST['shout']; //posts the shout 
    $insert mysql_query("INSERT INTO `shout` (name,shout) VALUES ('$name', '$shout')"); //inserts into the database 

    $find mysql_query("select * from shout order by id desc limit 5"); //finds the shouts order by id 
    while($r=mysql_fetch_array($find)){ //loop's the shouts 
        
    $name $r["name"]; //name 
        
    $shout $r["shout"]; //shout 
        
    echo "<b><font size=\"10px\" color=\"#FF3380\" face=\"verdana\">".$name."</font></b><br><font size=\"10px\" color=\"#FF3380\" face=\"verdana\">".$shout."</font><p>";   
    }
    if(
    $logged[username]){ //if the user is logged in display the form 
        
    echo 
        <form method=\"post\"> 
        Shout:<br/> 
        <textarea name=\"shout\" cols=\"28\" rows=\"4\">Message here</textarea><br/> 
        <input type=\"submit\" value=\"Shout\" name=\"submit\"><br/> 
        </form>"


    ?>
    I also cleaned it up a little

  6. #6
    Join Date
    Jul 2005
    Posts
    190
    Tokens
    0

    Default

    Much appriciated + rep

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •