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']);
}


?>

No comments posted yet

Your Answer:

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

Problem related to Creation of PDF File?
Hi All,
I am facing a problem related to creation pdf file. when I am creating a pdf file of do

PHP error. Need help urgently
Hi,

I am programming a php site and have a problem that i just cant find out how to fix. When

button help
i originally had this but realised it is much easier to have a button.

Code: <?php

RTF fomatting to email content
Im trying to sen an email with content is picked up from a rtf-file (file_get_contents('*.rtf'). Mai

Delete Client 066 Earlywatch
Hi all,

in former times client earlywatch was required for SAPs remote access to SAP inst

extract content from a website
i have written a code that will grab the content from the index page..
i would like to know how c

Generate multilayered array from string.
ok so i have a string that looks like this:
Code: [Select]blog:edit_all,delete_all|users:edit_all

include function being weird?
I have a very simple system to grab an IP outputted by a PHP file.. (for a project I have) but it ou

Need help: how to catch acess of undefined class properties
Hello. I am learning OO with PHP and have hit a problem.
Some code runs as perfectly valid code,

Email Form Syantax Issue 2
How to make this look FROM:"OUR TEAM" instead of FROM:abc@mail.com

$headers = "

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