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";

Did you know?Explore Trending and Topic pages for more stories like this.
$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']);
}


?>
No comments posted yet

Your Answer:

Login to answer
196 Like 33 Dislike
Previous forums Next forums
Other forums

Display data returned from Ajaxservices!!
I have a question about displaying results using ajax. I have part of the code below.
$.ajax({

Need help making a script that moves data into acrhive table
Hi,

I'm kinda new to php/mysql

And i wrote a simple script to store sales lead for a b

How do I use a global footer..?
If my index.php has a bole bunch of if functions and exit's in them

What is SAP Avatar ?
Hi All,

This G.Satish , my boss asked me to explore on SAP Avatar. I searced in internet

registration form
first time posting. did some searches but didnt find exactly what i am looking for. dont flame cause

DataTable Help Required
Hi all I am creating an app that utilises and MS Access back end and queries it quite a bit at vario

Header redirect
Hello ive got a problem ive got form with its action set to itself.
Code: <form id="f

Display search result
Hi!

I have a SQL database with information about albums and track (music).

This is wh

help with php
It's not displaying or pulling anything out of the database.


Code: <html><

php include email form with attachment
I have had no luck with finding a email form all over the Internet for various reasons. Some insecur

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