11-03-06, 08:39 AM
Wannabe Coder
Join Date: Sep 2005
Posts: 223
Thanks: 0
Thanked 0 Times in 0 Posts
Update Function Error
PHP Code:
function editform () {
global $database_blog_oconn , $blog_oconn , $session_id ;
if (! function_exists ( "GetSQLValueString" )) {
function GetSQLValueString ( $theValue , $theType , $theDefinedValue = "" , $theNotDefinedValue = "" )
{
$theValue = get_magic_quotes_gpc () ? stripslashes ( $theValue ) : $theValue ;
$theValue = function_exists ( "mysql_real_escape_string" ) ? mysql_real_escape_string ( $theValue ) : mysql_escape_string ( $theValue );
switch ( $theType ) {
case "text" :
$theValue = ( $theValue != "" ) ? "'" . $theValue . "'" : "NULL" ;
break;
case "long" :
case "int" :
$theValue = ( $theValue != "" ) ? intval ( $theValue ) : "NULL" ;
break;
case "double" :
$theValue = ( $theValue != "" ) ? "'" . doubleval ( $theValue ) . "'" : "NULL" ;
break;
case "date" :
$theValue = ( $theValue != "" ) ? "'" . $theValue . "'" : "NULL" ;
break;
case "defined" :
$theValue = ( $theValue != "" ) ? $theDefinedValue : $theNotDefinedValue ;
break;
}
return $theValue ;
}
}
$editFormAction = $_SERVER [ 'PHP_SELF' ];
if (isset( $_SERVER [ 'QUERY_STRING' ])) {
$editFormAction .= "?" . htmlentities ( $_SERVER [ 'QUERY_STRING' ]);
}
if ((isset( $_POST [ "MM_insert" ])) && ( $_POST [ "MM_insert" ] == "form1" )) {
$insertSQL = sprintf ( "INSERT INTO comments (`comment`, entrie, `user`, `date`) VALUES (%s, %s, %s, %s)" ,
GetSQLValueString ( $_POST [ 'comment' ], "text" ),
GetSQLValueString ( $_POST [ 'session_id' ], "text" ),
GetSQLValueString ( $_POST [ 'user' ], "text" ),
GetSQLValueString ( $_POST [ 'date' ], "text" ));
mysql_select_db ( $database_blog_oconn , $blog_oconn );
$Result1 = mysql_query ( $insertSQL , $blog_oconn ) or die( mysql_error ());
$insertGoTo = "entrie_detail.php?session_id= $session_id " ;
if (isset( $_SERVER [ 'QUERY_STRING' ])) {
$insertGoTo .= ( strpos ( $insertGoTo , '?' )) ? "&" : "?" ;
$insertGoTo .= $_SERVER [ 'QUERY_STRING' ];
}
header ( sprintf ( "Location: %s" , $insertGoTo ));
}
$colname_subscribers = "-1" ;
if (isset( $_SESSION [ 'MM_Username' ])) {
$colname_subscribers = ( get_magic_quotes_gpc ()) ? $_SESSION [ 'MM_Username' ] : addslashes ( $_SESSION [ 'MM_Username' ]);
}
}
Description: im passing the session_id and the email from a form from the previous page.... i already echoed them out and they return no problems... im basically trying to update the record thats === to my session_id
also i`m not recieving any errors.
RESULT: it runs through the script but doesnt update the certain record.
any suggestions.