Help with forum please

Discussion in 'Web Design and Development' started by Cabbit, Feb 3, 2007.

  1. Cabbit macrumors 68020

    Cabbit

    Joined:
    Jan 30, 2006
    Location:
    Scotland
    #1
    ok so i have two files to upload a story to my database, i will try and work out how to display them after i work out how to post them lol. Well the thing is i just dosnt work, witch is a pity im just learning this stuff. And i need it to upload before i can even think of calling the data back. Please help

    this is forum.php
    Code:
    <form name=story action=uploader.php method=post>
    Auther: <input tpye=text name=inp_ather><br>
    Title: <input tpye=text name=inp_title><br>
    Short Decription: <input tpye=text name=inp_short><br>
    Story Body: <textarea name="inp_body" cols="65" rows="25"></textarea>
    <input name="bn_submit" type="button" value="Submit" />
    </form>
    
    this is uploader.php
    Code:
    <?php //story upload
    $host = mysql10.streamline.net
    $dbuser = [username]
    $dbpass = [password]
    $dbname = [dbname]
    $connection = mysql_connect($host,$dbuser,$dbpass);
    $db = mysql_select_db($dvname,$connection);
    
    //grab data form forum
    $ather = $POST(inp_ather);
    $title = $POST(inp_title);
    $short = $POST(inp_short);
    $body = $POST(inp_body);
    
    $connection = mysql_connect ($host,$dbuser,$dbpass);
    $db = mysql_select_db($dbname,$connection);
    $sql = "INSERT INTO story (ather,title,short,body) VALUES ($ather, $title, $short, $body)
    $result = mysql_query($sql)";
    echo "thank you for your submition";
    ?>
    

    this is a screen shot of the data base.
    [​IMG]
    [​IMG]
     
  2. mac-convert macrumors 6502a

    mac-convert

    Joined:
    Nov 2, 2006
    Location:
    Are we there yet?
    #2
    $sql = "INSERT INTO story (ather,title,short,body) VALUES ($ather, $title, $short, $body)
    $result = mysql_query($sql)";

    Fix your quotes, etc and see if this works...

    $sql = "INSERT INTO story (ather,title,short,body) VALUES ($ather, $title, $short, $body)";
    $result = mysql_query($sql);
     
  3. Cabbit thread starter macrumors 68020

    Cabbit

    Joined:
    Jan 30, 2006
    Location:
    Scotland
    #3
    thanks but it still isnt uploading nougat to the database.
     
  4. mac-convert macrumors 6502a

    mac-convert

    Joined:
    Nov 2, 2006
    Location:
    Are we there yet?
    #4
    You still have some formatting problems, I believe.

    Take a look at this site as it has a good example similar to what you are doing.
     
  5. Cabbit thread starter macrumors 68020

    Cabbit

    Joined:
    Jan 30, 2006
    Location:
    Scotland
    #5
    Code:
    <?php //story upload
    $host = "mysql10.streamline.net"
    $username = "username"
    $password = "password"
    $database = "dbname"
    $server = mysql_connect($host, $username, $password);
    $connection = mysql_select_db($database, $server);
    //grab data form forum
    
    $ather = $POST(inp_ather);
    $title = $POST(inp_title);
    $short = $POST(inp_short);
    $body = $POST(inp_body);
    
    $server = mysql_connect($host, $username, $password);
    $db = mysql_select_db($database,$connection);
    $sql = mysql_query"INSERT INTO story (ather,title,short,body) VALUES ($ather, $title, $short, $body)";
    $result = mysql_query($sql);
    echo "thank you for your submition";
    ?>
    
    updated code still dosnt work. i suck at this
     

Share This Page