Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Cabbit

macrumors 68020
Original poster
Jan 30, 2006
2,128
1
Scotland
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.
1.jpg

2.jpg
 
$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);
 
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
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.