Save username into DB


Posted on 16th Feb 2014 07:03 pm by admin

OkaY so I got my blog to actually save the posts and whatever, all I need now is for it to keep the right posted. That database is set up to keep post id, title, subject, date, and author. The only problem is author. It won't post the right author, i need it to put the username of the poster in that spot but it either puts nothing or if I put it to ["user"] it puts Array in the field.... so please help, how do I save the username? Here is my code in post.php

<?php include "../config.php"; include "../func.php"; include "../english.php";

$subject=clean($_POST["subject"]);
$name=($_SESSION["name"]);
$inhoud=clean($_POST["inhoud"]);

if (($_POST['post'])&&($_SESSION["code"]==$_POST["code"])) {
$query="insert into `babys` (`name`, `subject`, `content`, `date`) values('".$name."', '".$subject."', '".$inhoud."', now())";
$result = mysql_query($query);
if ($result) header('Location: index.php');
else msg("Failed.".mysql_error());
} else {
msg($lang['incorCode']);
}


?>

196 Like 33 Dislike
Previous php-forum Next php-forum
Other php-forum

Placing and array within an array then sorting it!
I have a page that runs two large mysql queries and saves the results into arrays, in php I then per

Links not updating
I'm trying to fuel a simple navigation system for a news section. It works fine when it comes to ret

Getting the full city list from maxminds geoip database
I am suprised I can't find any references to this.

I have maxminds geoip lite installed and i

How can you detect variable string in a massive string?
Ok guys, i need some help with this one.

I am going to be getting a large string, like 10-20

writing a screen scraper
Hello,

I'm writing a screen scraper application and want to be able to get absolute addresses

mySQL and PHP search
Hello,
I am trying to code a project and ran into a brick wall with one of my pages. I am pretty

A little help needed passing hidden values to next page
I have a page that has hidden values in a form.

example
Code: <input name='signupID

Please help with code for SMTP authenticated PHP email form
Hello, I'm creating a PHP email form, and for this particular server, I have to use SMTP Authenticat

Variables and Include
Code: [Select]<?php

$header = $_COOKIE['mss']['header'];
$body = $_COOKIE['mss']['b

Join Query Help
Hi all,

I am having problems with the below code, which we shall call 'my first join query'!

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash