Jump to content

Select returns IDs up to 127


Manixat
Go to solution Solved by Barand,

Recommended Posts

Hello freaks,

 

I have an insert query that uses a select query to find values to insert. To make it more clear I have around 4000 cities stored in a database and when a user registers the name of the city is sent to PHP but I need to record the ID and then my query looks something like this

 

 

 

INSERT INTO `users` (`blablabla`,`blablabla`,`CITY`) VALUES (`blablabla`,`blablabla`,(SELECT `ID` FROM `cities` WHERE `Name`='$phpvariable'))
 

The problem is that it retrieves cities up to ID 127. I suppose that is due to the data limit of TINYINT. My question is how do I get around that, or in other words how can I change the data type the SELECT query returns ?

Edited by Manixat
Link to comment
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.