Jump to content

invalid input syntax for integer


jeanke2

Recommended Posts

Hi,
I'm receiving following error:
Warning: pg_query() [function.pg-query]: Query failed: ERROR: invalid input syntax for integer: "Id nummer"

In my code I'm getting a value with post from a drop down list, which gives me a groupname. Then I'm going to the table of this group to perform a query to get the groupID. This id should then be inserted into an other table. When I execute the form I always get the error above.
Here's my code:

//here we get the group name from my form and get the groupid with the query
$itemgroup = pg_escape_string($_POST['voorwerpgroep']);
$querygroupid = "SELECT item_group_id FROM  item_groups WHERE item_group_name= '" . $itemgroup . "'";
$result1 = pg_query($querygroupid);
while ($info = pg_fetch_array( $result1 )){
   $itgroupid = $info['item_group_id'];
   settype($itgroupid,  "int");
}

//now we insert the id in an another table:
$query = "INSERT INTO item ( item_group_id) VALUES('" . $itgroupid . "')";
$result = pg_query($query);
Link to comment
https://forums.phpfreaks.com/topic/27676-invalid-input-syntax-for-integer/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.