Support Forums
Goodness this is REALLY making me mad. - Printable Version

+- Support Forums (https://www.supportforums.net)
+-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87)
+--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18)
+---- Forum: PHP The Hypertext Preprocessor (https://www.supportforums.net/forumdisplay.php?fid=21)
+---- Thread: Goodness this is REALLY making me mad. (/showthread.php?tid=22842)



Goodness this is REALLY making me mad. - ChromeWolf - 10-23-2011

So I'm still working on the CMS part of my project, and I'm adding a feature to where you can edit the homepage's posts.

This is what it looks like :
[Image: b4cT9.png]


When I just put in.

"sdfsdfsdf"

How do I remove the array?

This is the codes :

posts.php
PHP Code:
<?php
require_once("auth.php");
include(
"stylesheet.css");
?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<center><b>Update Homepage Posts.</b></center>
<br>
<br>
<form method="post" action="update.php">

Homepage posts: <br  />
<input type="text" name="fName"  />
<input type="submit" value="Update Database"  />

</form>

</body>
</html> 

Update.php
PHP Code:
<?php
$fName 
$_POST['fName'];
$con mysql_connect("localhost","root","");
if (!
$con)
  {
  die(
'Could not connect: ' mysql_error());
  }

mysql_select_db("database1"$con);

$sql="INSERT INTO news (news)
VALUES
('
$_POST $fName')";

if (!
mysql_query($sql,$con))
  {
  die(
'Error: ' mysql_error());
  }
echo 
"1 record added";

mysql_close($con)
?>

Help is appreciated Smile



RE: Goodness this is REALLY making me mad. - Gaijin - 10-23-2011

What's this;
PHP Code:
('$_POST $fName')"; 
$_POST is the "Array" value, and I'm not really sure what you are trying with that query.


RE: Goodness this is REALLY making me mad. - ChromeWolf - 10-25-2011

@Above

I was being stupid, I wasn't thinking. I thought that I had to use $_POST to echo $fname Tongue

I fixed it now Big Grin