Jump to content

[SOLVED] UPDATE querys mot working, but SELECT querys work


PC Nerd

Recommended Posts

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

 

 

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.