FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

whats wrong?

 


devroom
I dont know why it wont put things in the table. see the following code pls:
Code:
if ($_POST['to_user']) {
$_POST['message']=nl2br(addslashes($_POST['message']));
$date = date('Y-m-d H:i:s');
#timedate

$send = "INSERT INTO #__cpms_inbox  (id,username,from_user,readed,replied,denyreply,trash,subject,message,senddatetime) VALUES ('','$_POST[to_user]','$my->username','','1','','','$_POST[subject]','$_POST[message]','')";
$database->setQuery($send);
$result = $database->query();

### send email notify to recipient (by tassoman.com)
//$sqlEmailRecipient = "SELECT name, email FROM #__users where username='$_POST[recip]'";
//$database->setQuery($sqlEmailRecipient);
//$rows = $database->loadObjectList();
//$recipientName  = $rows[0]->name;
//$recipientEmail = $rows[0]->email;
//mail( $recipientEmail, _PMS_MSG_NOTIFY_SUBJ, _PMS_MSG_NOTIFY_BODY, "From: Cellu.org <info@cellu.org>\r\nReply-To: \r\n");
  ### end sends email notify

header("Location: ".$base_url."&func=inbox&mosmsg="._CPMS_MESSAGE_SENT);
} else {

if ($_GET['reply_id']!=0) {
$reply_id = $_GET['reply_id'];
$reply = 1;}

echo '<tr>
   <td width="60%">
<form name="pm" action="'.$base_url.'&func=new" method="post">
<input name="reply" type="hidden" value="'.$reply.'" />
<table style="padding-bottom:5px;">
   <tr>
      <td>'._CPMS_TO.'</td><td><input name="to_user" type="text" size="30"></td>
   </tr>
   <tr>
      <td>'._CPMS_SUBJECT.'</td><td><input name="subject" type="text" size="30" maxlength="30"></td>
   </tr>
   <tr>
      <td>'._CPMS_MESSAGE.'</td><td><textarea name="message" cols="40" rows="15">'._CPMS_MAX_MESSAGE_LENGTH.'</textarea></td>
   </tr>
   <tr>
      <td colspan="2"><input type="submit" value="'._CPMS_SUBMIT.'" />&nbsp;&nbsp;<input type="reset" value="'._CPMS_RESET.'" /></td><td>&nbsp;</td>
</table>
</form>
   </td>
   <td width="40%">userlist</td>
</tr>';
}

its not finished yet, but it should be putting things in the table
DudeAmI0
Try putting ` around your col names, sometimes those mess up MySQL, And i see the id col doing just that
Marston
Code:
$send = "INSERT INTO #__cpms_inbox
I think that PHP is reading your "#__cpms_inbox" table as a comment.

Might want to change the name of the table.
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.