Jump to content

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

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.