Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8089349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:22:03+00:00 2026-06-05T19:22:03+00:00

I’m integrating my site with another website using their API. From one of the

  • 0

I’m integrating my site with another website using their API. From one of the API calls, I want to insert the response into a table. I’m using cURL to query their API, and PDO to insert it into my MySQL database.

Here’s the relevant code:

// Upload the file to RapidShare
$uploadID = mt_rand(1000000000, 9999999999);
$url = 'http://rs' . $uploadServer . '.rapidshare.com/cgi-bin/rsapi.cgi?uploadid=' . $uploadID;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
$postFields = array('sub' => 'upload',
                    'login' => 'mylogin',
                    'password' => 'mypassword',
                    'uploadid' => $uploadID,
                    'filename' => $filename,
                    'filecontent' => '@' . $targetDir . '/' . $id);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
if(!$resp = curl_exec($ch)) {
    error('upload call failed');
}

Then, I have the variable called $uploadDetails which is an array of the API response which holds the file ID, file name, file size and md5 value of the file. I’m inserting the file ID into my database with this query:

// Database shinanagans
try {
    $dbh = new PDO('mysql:host=localhost;dbname=mytable', 'root', '');

    $query = 'INSERT INTO `files` (f_id, s_id, u_id, name, size, uploaded, rs_fileid)
              VALUES (?, (SELECT s_id FROM `servers` WHERE name = ? LIMIT 1), (SELECT u_id FROM `users` WHERE username = ?), ?, ?, ?, ?)';

    $sth = $dbh->prepare($query);
    $sth->execute(array($id, $server, 11, $uploadDetails[1], $uploadDetails[2], date('c'), $uploadDetails[0]));

    $dbh = null;
} catch(PDOException $e) {  
    error($e->getMessage());  
} 

Each API response has a unique file ID, I know that for sure. And I know I’m getting the correct and unique file ID back from the API call. I’ve verified that by echo’ing the response. However, for some reason, PDO keeps inserting this value under the rs_fileid column: 2147483647.

For clarification, here’s a sample response from the API call:

Array
(
    [0] => 3294575677
    [1] => Untitled_1.png
    [2] => 478923
    [3] => ae83e53e5bf26406715daed0d44adc45
)

And here’s the relevant database row:

enter image description here

As you can see, all the field values for the rs_fileid column are the same, when they should be unique, and the API is responding with a unique value.

Anyone know what could be going on? Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T19:22:05+00:00Added an answer on June 5, 2026 at 7:22 pm

    Note, 2147483647 is the maximum value for a 32-bit signed integer — and the file ID in your sample is significantly above that. Not sure about how PHP will handle it, as that depends on whether your PHP is 32- or 64-bit (and whether it bothers to try and intify the data), but MySQL will clamp the number to the range of the field it goes into.

    Check to make sure your database column is a BIGINT or at least UNSIGNED INT — or, unless you really need that column to be numeric, a VARCHAR field of appropriate length would work as well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I'm making a simple page using Google Maps API 3. My first. One marker
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am reading a book about Javascript and jQuery and using one of the
I am currently running into a problem where an element is coming back from
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.