Guteman Posted August 4, 2006 Share Posted August 4, 2006 I cannot make the SQL statment insert the information (message).[code]<?php if($logged['login']) { switch($_GET['page']) { case 'createmessage': if(isset($_POST['createmessage'])) { ?> <div style="text-align: right; margin: 0 10px 0 0;">Create a New Message</div> <?php $checkname = mysql_query("SELECT login FROM clients") or die ("MySQL query error."); $checkname= mysql_fetch_array($checkname); if(strlen($_POST['recipient']) <= 0) { $error_message .= '<p class="failure">Error: You did not enter a Recipient.</p>'; } else if($checkname['login'] != $_POST['recipient']) { $error_message .= '<p class="failure">Error: Username does not exist.</p>'; } if(strlen($_POST['subject']) <= 0) { $error_message .= '<p class="failure">Error: You did not enter a Subject.</p>'; } if(strlen($_POST['message']) <= 0) { $error_message .= '<p class="failure" style="margin: 0 0 10px 0;">Error: You did not enter a Message.</p>'; } if(isset($error_message)) { echo("$error_message"); } if(!isset($error_message)) { $subject = htmlspecialchars($_POST['subject']); $message = htmlspecialchars($_POST['message']); $recipient = htmlspecialchars($_POST['recipient']); $from = htmlspecialchars($logged['login']); $query = mysql_query("INSERT INTO pms (subject, message, recipient, from, status) VALUES('$subject','$recipient','$message','$from','unread')") or die ("MySQL Problem"); echo("Message Sent!"); } }?>[/code] Quote Link to comment Share on other sites More sharing options...
PHPSpirit Posted August 4, 2006 Share Posted August 4, 2006 Perhaps the account does not have the permissions, or the syntax is incorrect. Try this:[code]INSERT INTO `pms` (`subject`, `message`, `recipient`, `from`, `status`) VALUES('$subject','$recipient','$message','$from','unread');"[/code] Quote Link to comment Share on other sites More sharing options...
Guteman Posted August 4, 2006 Author Share Posted August 4, 2006 what you mean by syntax Quote Link to comment Share on other sites More sharing options...
Guteman Posted August 4, 2006 Author Share Posted August 4, 2006 fixed it.. nevermind Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.