| | |
PHP MySQL problem
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
Quick aside: Place code tags around code to maintain formatting. It really helps readability.
The part you'll need to change is I'm not certain how that table is structured, but you will need to add the user id something like this $userId could be held in the session along with your other properties $_SESSION['userId']. You'll also need to make sure that the query which display the messages returns the user name along with the message and use that instead of the logged in user name from the session.
Does that clear it up a bit?
The part you'll need to change is
PHP Syntax (Toggle Plain Text)
$insertSQL = sprintf("INSERT INTO messages (message) VALUES (%s)", GetSQLValueString($_POST['textarea'], "text"));
PHP Syntax (Toggle Plain Text)
$insertSQL = sprintf("INSERT INTO messages (userId, message) VALUES (%d,%s)", $userId, GetSQLValueString($_POST['textarea'], "text"));
Does that clear it up a bit?
You will need to store the user id in the session when they log in and retrieve it as needed
PHP Syntax (Toggle Plain Text)
$userId = $_SESSION['userId'];
Last edited by Ezzaral; Aug 21st, 2007 at 2:54 pm.
![]() |
Similar Threads
- Apache (Linux Servers and Apache)
- Double Dropdown Submit ,PHP ,MYSQL (PHP)
- PHP/Mysql Flash problem !!!!1 (PHP)
- php mysql problem (PHP)
- PHP-MySQL Conn Problem in Win XP (PHP)
- PHP + MySQL Problem (PHP)
- installing php and mysql properly (Windows Servers and IIS)
- php mysql help (PHP)
- Using PHP, MySQL and Apache Server (PHP)
Other Threads in the PHP Forum
- Previous Thread: How to print a page from a form details???
- Next Thread: storing multiple email address problem
| Thread Tools | Search this Thread |
apache api array beginner beneath binary broadband broken button cakephp checkbox class cms code countingeverycharactersfromastring crack cron curl database date display dynamic echo email error fcc file files folder form forms freelancing function functions google href htaccess html image include incode insert integration ip javascript joomla limit link login mail match menu method mlm mod_rewrite multiple mysql oop pageing pagerank paypal pdf php problem query radio random recursion recursiveloop remote script search server sessions sms smtp soap source space sql strip_tags subversion support! survey syntax system table template tutorial undefined update upload url validator variable video virus web window.onbeforeunload=closeme; youtube






