PDA

View Full Version : Help with forum please




Cabbit
Feb 3, 2007, 11:45 AM
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
<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
<?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.
http://jennifersplaygroup.co.uk/site_images/1.jpg
http://jennifersplaygroup.co.uk/site_images/2.jpg



mac-convert
Feb 3, 2007, 02:01 PM
$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);

Cabbit
Feb 3, 2007, 02:16 PM
thanks but it still isnt uploading nougat to the database.

mac-convert
Feb 3, 2007, 02:42 PM
You still have some formatting problems, I believe.

Take a look at this site (http://www.morrowland.com/apron/tutorials/web/php/database/index.php) as it has a good example similar to what you are doing.

Cabbit
Feb 3, 2007, 03:09 PM
<?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