Ben alanında ('ad_id') ile, bir MySQL tablo var.
PHP ile farklı alanlarda değişkenleri saklamak.
Bu alanlardan biri, yukarıda belirtildiği gibi 'ad_id' alanının, üzerinde aynı kesin nr depolar ve tekrar tekrar, ne olursa olsun "GERÇEK" adı PHP dosyası olduğunu.
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.
Hatta $ ad_id değişken echo, ve aslında 12345 IS, ancak MySQL zaten 11111 değerini saklar.
KOD:
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')