PC Nerd Posted March 5, 2007 Author Share Posted March 5, 2007 ok. this is the entire code. ive commented out the section that i originally had, so that i can still use it l8a if i need. its long, and im leaving in the html tags outside of the php, so you can et a feel for where te code is exdecuted, compared to where it is displayed. goodluck. <?php require("inc_files/Database_link.inc"); require("inc_files/Page_Data.inc"); # # #function sensor_words() { # # # $New_Message = $_POST['Message_Body']; # $Sensor_list = array("####"); # $Sensor_Char_list = array("!", "@", "#", "$", "%", "^", "&", "*"); # # # $loop = 1; # # while($loop<=4) { # # $Sensor_Char_Index = rand(0, ; # # $Sensor_Char_Replace = $Sensor_Char_Replace . $Sensor_Char_list[$Sensor_Char_Index]; # $loop ++; # # } # # #$New_Message = str_replace(); # # #$Sensor_Char_Replace = rand($Sensor_Char_list, 1).rand($Sensor_Char_list, 1).rand($Sensor_Char_list, 1).rand($Sensor_Char_list, 1); # foreach($Sensor_list as $Sensor_Word) { # # $New_Message = str_replace($Sensor_Word, $Sensor_Char_Replace, $New_Message); # return $New_Message; # } #$New_Message = sensor_words(); #$to_Name = $_POST['To_Name']; #$to_ID = $_POST['To_ID']; #$from_Name = $_POST['From_Name']; #$from_ID = $_POST['From_ID']; #$Subject = $_POST['Subject']; #$Message_SQL = "INSERT INTO individual_messages ( `User_ID` , `To` , `From` , `From_ID` , `Message_Body` ) VALUES($to_ID, $to_Name, $from_Name, $from_ID, $New_Message)"; #$Message_SQL = "INSERT INTO individual_messages ( `User_ID` , `To` , `From` , `From_ID` , `Subject` , `Message_Body` ) VALUES ('".$to_ID."', '".$to_Name."', '".$from_Name."', '".$from_ID."', '".$Subject."' , '".$New_Message."')"; #$Message_Query = mysqli_query($Message_SQL, $DB_Server) or die(mysql_error()); # or die("ERROR 14 Your Message could not be sent"); #$SQL14 = "INSERT INTO individual_messages (`User_ID` , `To` , `From` , `From_ID` , `Subject` , `Message_Body` ) VALUES ('$to_ID', '$to_Name', '$from_Name', #'$from_ID, '$Subject' , '$New_Message' "; #$result14 = mysqli_query($SQL14, $DB_Server) or die(mysql_error()); #} ?> <html> <head> <link rel="stylesheet" type="text/css" href="B_A-CSS.css"> <title>Battle Ages Messages</title> </head> <body> <table> <thead> <td> <img src="Graphics\Small_Logo.GIF" alt="Logo" width = "75%" hight = "75%" align = "left"> </td> <td> </td> <td> <img src="Graphics\Small_Logo.GIF" alt="Logo" width = "75%" hight = "75%" align = "right"> </td> </thead> <tbody> <tr> <td class = "left"> <?php include("inc_files/B_A-Game_Side_Links.inc"); ?> </td> <td class = "centre"> <b><center><h1>Messages</h1></center></b> <?php #$Message_body = $_POST['Message_Body']; #echo "<p>MESSAGE SENT:</p>"; #echo "<br><br>\n"; #$New_Message = sensor_words(); #echo $New_Message; #echo "<br><br><br><br>"; #echo $Message_Query; ?> <?php error_reporting(E_ALL); #require("inc_files/Database_link.inc"); #require("inc_files/Page_Data.inc"); $To_Name =addslashes($_POST['To_Name']); $To_ID =addslashes($_POST['To_ID']); $From_Name =addslashes($_POST['From_Name']); $From_ID =addslashes($_POST['From_ID']); $Subject =addslashes($_POST['subject']); $New_Message = addslashes($_POST['Message_Body']); #if($_POST['submit']){ $SQL14 = "INSERT INTO individual_messages (`User_ID` , `To` , `From` , `From_ID` , `Subject` , `Message_Body` ) VALUES ('$To_ID', '$To_Name', '$From_Name', '$From_ID, '$Subject' , '$New_Message' )"; echo $SQL14; $result14 = mysqli_query($DB_Server, $SQL14) or die(mysql_error()); #} ?> </td> <td> </td> </tr> </tbody> </table> </body> </html> thats it. ive already posted the form to send data, and that hasnt changed. also on a quick side note, on that form. the drop down menu is right rext to the button. but i cant seem to drop the button down a line, so that it looks like |menu|=| |BUTTON| thanks for all your help Quote Link to comment Share on other sites More sharing options...
PC Nerd Posted March 6, 2007 Author Share Posted March 6, 2007 anything else i should try ??? the code isnt actually that long, its mostly commented out old code. by the way, what does the addslashes() thingy do??? i put it in, but i dont know what it does Quote Link to comment Share on other sites More sharing options...
Greaser9780 Posted March 6, 2007 Share Posted March 6, 2007 It protects your database. It helps stop people trying to enter mysql commands where they should post things like name and the like. Quote Link to comment Share on other sites More sharing options...
PC Nerd Posted March 6, 2007 Author Share Posted March 6, 2007 thankx so does anyoe know how to fix this problem...... out of the current code, or even the oldercode commented out. if anyone could help me solve this problem, i would really appreciate it, becauase this problem has been annoying me for a week now.... thanks a heap Quote Link to comment Share on other sites More sharing options...
PC Nerd Posted March 7, 2007 Author Share Posted March 7, 2007 ***bump*** anything ???? Quote Link to comment Share on other sites More sharing options...
PC Nerd Posted March 7, 2007 Author Share Posted March 7, 2007 anything. could this errror be with y mysql database, or is it my sql syntax. thanks for your help, but is this an error not related to the php or SQL ??? thankx Quote Link to comment Share on other sites More sharing options...
btherl Posted March 7, 2007 Share Posted March 7, 2007 There is a problem in the output you posted: INSERT INTO individual_messages (`User_ID` , `To` , `From` , `From_ID` , `Subject` , `Message_Body` ) VALUES ('1', '', 'Administration', '1, 'Quick Message' , 'thshadflusi gfolbay g' ) Notice the "'1". If that column is a string, it should be '1'. If it is an integer, it should be just 1, no quotes. The same for User_ID. If it's an integer, it should be just 1. If it's a string (varchar) it should stay as '1'. Try fixing that in your mysql query and see if it helps! If it doesn't, post the output you get here again, along with your modified query. Quote Link to comment Share on other sites More sharing options...
PC Nerd Posted March 8, 2007 Author Share Posted March 8, 2007 ok i played around with the strings, and integars etc and ive got it working.. thankx to all that helped 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.