Hi, I have the following problem:
I have a html form for articles and another file that insert data into database. I want to write in the database the id of the author and in the file that insert information in the database I got this code:
And in the query the $author, but don't work, write 0 in the author_id field but the id of my account in the users table is 5.
How can I make this to write the good id?
Sorry for my english and thanks in advance!
I have a html form for articles and another file that insert data into database. I want to write in the database the id of the author and in the file that insert information in the database I got this code:
PHP Code:
$sname = $_SESSION['username'];
$select = "SELECT * FROM users WHERE name = '$sname'";
$result = mysql_query($select) or die (mysql_error());
while ($curent_user = mysql_fetch_assoc($result)){
$author = $curent_user['id'];
}
How can I make this to write the good id?
Sorry for my english and thanks in advance!
Comment