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

  • Home
  • SEARCH
  • 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 460821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T22:54:44+00:00 2026-05-12T22:54:44+00:00

I have a MySQL table, with the field (‘ad_id’). I store variables in different

  • 0

I have a MySQL table, with the field (‘ad_id’).

I store variables in different fields with PHP.

One of these fields, the ‘ad_id’ field as mentioned above, stores the same exact nr over and over again, no matter what the “REAL” name is in the PHP file.

Example: $ad_id= 12345;
When trying to store this, the number 11111 is stored. ALWAYS, no matter what I change the $ad_id variable to.

I even echo the $ad_id variable, and it actually IS 12345, but MySQL stores a value of 11111 anyway.

CODE:

mysql_query("INSERT INTO cars_db 
       (ad_id, area, area_community, price, year, mileage, gearbox, fuel, poster_name, poster_email, poster_tel, poster_password, private_or_company, headline, description, salebuy, total_pics, changeable, hide_tel)
VALUES ('$ad_id', '$area', '$kommun', '$price', '$year', '$mile', '$gearbox', '$fuel', '$name', '$email', '$tel', '$ad_passw', '$priv_or_comp', '$headline', '$ad_text', '$forsale', '$nr_of_pics', '$changeable', '$hide_tel')");

Update with MySQL table info:

CREATE TABLE `cars_db` (
 `id` int(7) NOT NULL AUTO_INCREMENT,
 `ad_id` int(13) NOT NULL,
 `area` varchar(40) COLLATE utf8_swedish_ci NOT NULL,
 `area_community` varchar(50) COLLATE utf8_swedish_ci NOT NULL,
 `price` int(9) NOT NULL,
 `year` int(4) NOT NULL,
 `mileage` int(6) NOT NULL,
 `gearbox` varchar(12) COLLATE utf8_swedish_ci NOT NULL,
 `fuel` varchar(12) COLLATE utf8_swedish_ci NOT NULL,
 `insert_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
 `poster_name` varchar(40) COLLATE utf8_swedish_ci NOT NULL,
 `poster_email` varchar(50) COLLATE utf8_swedish_ci NOT NULL,
 `poster_tel` varchar(20) COLLATE utf8_swedish_ci NOT NULL,
 `poster_password` varchar(15) COLLATE utf8_swedish_ci NOT NULL,
 `private_or_company` int(2) NOT NULL,
 `headline` varchar(60) COLLATE utf8_swedish_ci NOT NULL,
 `description` text COLLATE utf8_swedish_ci NOT NULL,
 `salebuy` int(2) NOT NULL,
 `total_pics` int(2) NOT NULL,
 `changeable` int(1) NOT NULL,
 `hide_tel` int(1) NOT NULL,
 PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=134 DEFAULT CHARSET=utf8 COLLATE=utf8_swedish_ci

Update again:

I tried setting the $ad_id=012345678901 (12 digits) and it didn’t work. Once again same problem. But then I tried setting $ad_id=555555 and it worked, MySQL stored that information…
The length is the problem I think.
Is there a maximum or something?
Is there hidden decimals I don’t know about. If so, how can I round it?


Update string insert into:
All looks fine. Even the value of the $ad_id is ok, 12 digits, but that’s not what’s inserted into MySQL, because that’s a different nr and it is only 10 digits!

- AC
- STEREO
- VINTERDÄCK', 'Säljes', '0', '0', '0') 
  • 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-05-12T22:54:44+00:00Added an answer on May 12, 2026 at 10:54 pm

    Camran you number is too big
    if you take a look at mysql documentation here it says:

    Type  N byte  min value     max value 
    INT   4   -2147483648        2147483647
    

    You should generate a smaller random number also if you need that to be random you can use the MySQL RAND function.

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

Sidebar

Related Questions

I have multiple entries in a mysql table field, these are separated with commas;
I have a mysql table that has two fields that store the same type
I have a MySQL table LOGIN_LOG with fields ID, PLAYER, TIMESTAMP and ACTION. ACTION
I have a table in MySQL that has 3 fields and I want to
I have a MySQL table with approximately 3000 rows per user. One of the
I have a MySQL table that will only have one row. What should my
I have a mysql table field set as time type which stores data in
I have a mysql table containing a field name dtt_date and have values like
I have a mysql table that contains a date field in epoch time format.
I have a MySQL table with an auto-increment ID field. I'm filling the table

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.