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

SAP Project Module
I have seen in the SAP Project Module,plan cost and budget are not equal and even difference is sign

What do you call the "token" thing?
You know how some sites have links that run on tokens? Tokens are links that only stay alive for a c

Inserting a check in checkbox from array value
Hello all,
I have a bit of code that works for a select option box, but does not work for my chec

Creating Images from images in PHP
Okay well I am trying to make a 'dynamic' calender image with PHP.

I have images like this:

Code Help.. If txt input box empty search X instead..
I am having a problem with my search script. At current it will simply search by a selected date whi

Does design fit in FPGA ?
Hi all,

I've made a large HCC-Design. Because of the program-size the compile process with th

array_map() probably obvious mistake
The code below is part of a class to escape strings, but should also accept an array, using array_ma

is this the proper use of mysql_real_escape_string() to prevent sql injections?
i was wondering is this the proper use of mysql_real_escape_string() to prevent sql injections? any

switch not getting value
what am i doing wrong?
i want to populate the country list according to the category
i want to

Query failed issue with php script but works fine in mssql manager!
hi i have the script below which copies data from one table to another but will only insert new data

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