Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Error: Out of range value adjusted for column??

Author  Topic 

d00b13630
Starting Member

12 Posts

Posted - 2008-04-26 : 21:41:50
$picid = $_GET['picid'];

$commentby = $_REQUEST['commentby'];
$commentby = filter_text($commentby);
$commentby = mysql_real_escape_string($commentby);
$comment = $_REQUEST['comment'];
$comment = filter_text($comment);
$comment = mysql_real_escape_string($comment);
$action = $_REQUEST['action'];

if($action == 'post_comment'){
$insert_comment = "INSERT INTO comments ( picid, comment, commentdate, commentby) VALUES ('".$picid."', '".$comment."', CURRENT_TIMESTAMP, '".$commentby."')";


if (!mysql_query($insert_comment))
{
die('Error: ' . mysql_error());
}
header("Location: ");
}




returns-
Error: Out of range value adjusted for column 'picid' at row 1

picid is of int datatype :/

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-04-26 : 21:54:40
Doesn't look like SQL Server.
Go to Top of Page

d00b13630
Starting Member

12 Posts

Posted - 2008-04-26 : 21:56:41
mysql....
Go to Top of Page

d00b13630
Starting Member

12 Posts

Posted - 2008-04-27 : 00:26:40
if i change the datatype of the column the field is inserted as a blank. this is drivin me nuts
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-04-27 : 01:34:36
Whats the data type of pcid?
Go to Top of Page

d00b13630
Starting Member

12 Posts

Posted - 2008-04-27 : 02:20:50
int
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-04-27 : 02:39:07
Then i guess its receiving some value which is outside range of integer data type from the varaible. Are you able to trace which value when entered from front end causes this error? May be give a print the entered values from application to see which value on insertion causes the error.
Go to Top of Page

slimt_slimt
Aged Yak Warrior

746 Posts

Posted - 2008-04-27 : 06:27:50
depends on what kind of data are you declaring into picid variable. if someone enters 1.23 this is definitly not integer and there for you are getting out of range error.

try to look on php/mysql error list.
Go to Top of Page

d00b13630
Starting Member

12 Posts

Posted - 2008-04-27 : 14:04:03
its just inserting a regular integer. if i try to insert the same number without using a php variable it inserts fine.. as soon as i use the variable that i'm using the $_GET to define... i get that error.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-04-27 : 14:16:24
I dunno about PHP. But i guess it might be because you are getting value as string from $_GET. Try casting it to int using CAST() function before inserting.
Go to Top of Page

slimt_slimt
Aged Yak Warrior

746 Posts

Posted - 2008-04-27 : 14:55:27
usually $_GET is used to pass information from the URL and there are exceed limitation. Try $_POST or $_REQUEST.
Go to Top of Page

d00b13630
Starting Member

12 Posts

Posted - 2008-04-27 : 15:34:52
cant quit figure out how u mean to use CAST()...

slimt: post breaks the code and request is too vulnerable :/
Go to Top of Page

d00b13630
Starting Member

12 Posts

Posted - 2008-04-27 : 15:38:25
and anyways... REQUEST does the same thing.. btw.. i am trying to pass info from url.. the picid that im trying to insert :)
Go to Top of Page
   

- Advertisement -