Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have land buy/sell related website. So I want to store land area units in India and their conversion in other in units in mysql table. When user from specific area see properties list on website and if he selects acre in dropdown list then he can see the every property area in the acre though the property was listed in another unit.
So How Do I do this??
A simple two table can do this .. if you like..
Table 1:Units[id,UnitName]
Table 2:ConversionUnit[conversionId,fromUnitId,toUnitId,offset]
such as
table 1: [1,Centimetre],[2,Mitre],[3,kilometre]
table 2: [1,1,2,100],[1,3,1,0.000001]
First entry in the table to for converting CM to M and second row is to convert from KM to CM.
Hope it helps..
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
So I have this database:
John 4.2
Robert 6
Maria 3.2
What I would want is lets say I refresh a website. And in every refresh I will get a random name from that database based on the chance of showing-> that would mean that Robert would appear more times than the other people(because of his chance)
Any way to do this? I just can't think of anything.
I've create your table with columns name and weight.
The following request return on name, depending on the weight:
SELECT name FROM table ORDER BY RAND()*weight DESC LIMIT 1;
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have a property website.
At the moment, on the listing, and in search results, it says Number of bedrooms: [pulls the number from the database]. It uses an array variable, $a1[rooms].
Instead, I want to display a small icon of a bed for the number of bedrooms. So if three bedrooms then it should say, Number of bedrooms: [bed img] [bed img] [bed img]. [bed img] of course being a small icon/image of a bed.
So whether there are 1 bedrooms or 5 bedrooms, this is the number of times I want the icon displayed. The number of bedrooms is stored here: $a1[rooms].
Fairly simple really.
Thanks in advance.
Something like this will do the trick:
for ($bed_counter = 1; $bed_counter <= $a1['rooms']; $bed_counter++) {
print '<img src="bed.jpg">';
}
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have a textarea and I want to insert values of that textarea to a mysql table. But I want to insert each line to each field. Like the textarea has 3 lines...each line should be inserted in 3 each field in the table. Can anyone please help me with this.
Regards,
Explode the value of the textarea (see PHP manual for the syntax of explode). You will end up with a string array with 3 items. Now you can process each of these items individually.
Do you really mean columns (fields) and not rows? If someone enters 100 lines in the textarea you would neet 100 columns. This is considered to be bad data design.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Say I have a MySQL table like the one below with a list of names in an organisation, and IDs for each.
id name
1 John Doe
2 Richard Smith
3 Jane Market
... ...
Given user will query for the person's first and/or last name (with the possibility of typos and nicknames used) and php should return the closest match to their query.
For example, if a user enters "ricky" (nickname for Richard), it should return the ID for Richard Smith.
For nicknames, you have to create a separate MySQL table, with lookups (Many-to-One relationship).
For typos, you will have to loop all of your names and compare them to what the user has entered using the levenshtein function, or the similar_text function. The User Contributed Notes will help.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
Sorry for grammar mistakes. I want to create a currency table for my project which will use for adding currencies of different countries. This is my currency table but I'm confuse that this will good or not for project, so should I delete or add more columns in this table? Please help me.
currency
id | symbol | description | country | date_added | date_updated
I believe you better should have two tables.
One table for currency descriptions with fields id, symbol, description, country and other table related to this for daily currency rates with fields currency_id, rate, time_updated.
The question is if you really need the date_added. I think this is a information which is not really required.
If you want to update it regulary, I would implement a column "rate", which gives you the value in comparison of Euro or US$ as example. This way people can get a better impression how much 1 Unit of the currency is worth.
Otherwise this looks to be quite okay.