MySQL query - Post ID 197025

User 470292 Photo


Registered User
19 posts

Hi,
Could anyone tell me how can I include a search facility in a website that queries my tables in my MySQL?
For example, let's say I have a table with names and cities. I would like to have a drop down field that the user could be able to select one city and after submitting it would display all records from the table in my database. So I would like to populate the drop down field with all cities that are in the table. I imagine I would need to include a PHP coding?
Could anyone point me to the right direction and give me some examples please?

Many thanks for your help.
User 187934 Photo


Senior Advisor
20,271 posts

To display the php in VSD use an iframe coded into your page then point it at the php page. You can add the php page to your site or just ftp it to your server.
http://www.sitepoint.com/forums/showthr … table-data
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 474778 Photo


Registered User
215 posts

Ricardo,

This will seem a diversionary answer to your direct, practical question, but ... if you are going the self-written PHP route, Google and have a look at XAMPP or (if you're strictly a Windows user) Wampserver. Either choice combines Apache Web server, PHP and MySQL in a form that you can easily install on your own computer.

This will allow you to try out both your own and others' code ideas at zero risk and without publishing and exposing them to the world. Once you have everything working the way you want, you can upload it to your public Web hosting service.

HTML coders can embed PHP directly into their sites. I'll have to take Rolly's word for the best way to accomplish the objective using VSD, since I do not use that CoffeeCup tool.

While the basic PHP / MySQL interface is straightforward, using MySQL effectively and safely (i.e., without opening the door to bad guys who troll for Web vulnerabilities) is a topic in itself. I have enjoyed and can recommend the PHP5 and MySQL Bible (Tim Converse et. al., Wiley Publishing, 2004. ISBN 0-7645-5746-7).
halfnium -AT- alum.mit.edu
Yes, I looked just like that in 1962.
User 464893 Photo


Ambassador
1,611 posts

Ahh! Halfnium a man after my own heart. What would we do without our own server to bat our creations against. One day I may open up the email ability and go live online but there again. There are clever nasties out there waiting for a non expert like me to put his head up.
PHP MySQL I have , would you believe $aud 2 in a Sallies store. must have been a bit heavy for the owner. Pretty much similar I would think.

I would add, it is much easier to edit that type of thing in the Editor especially as you would probably run the page as a php one
The Guy from OZ


User 474778 Photo


Registered User
215 posts

My (CoffeeCup-related) joy would be complete if Scott & Company would accept my none-too-subtle hints to

(1) support routing a page-preview request made at the HTML Editor through 'localhost/MyProject' (and hence through my local development Web server) rather than pass it directly to the browser, and

(2) port the HTML Editor to Linux.

I very much like the CC HTML Editor's work flow, user interface and features. I dislike breaking concentration to recall how to navigate a different editor in Linux, and neither do I like having to leave the CC Editor to go refresh a browser window pointed at 'localhost/MyProject' over and over again.

Extra for experts: Integrate the CC HTML Editor with a PHP debugger and a change-management system.

Alas, CoffeeCup's product direction does not currently seem compatible with these ideas. However, the industry changes all the time (e.g., PHP's object-oriented maturation, the death of Flash, the rise of HTML 5 / CSS 3 and the impending Windows 8 debacle), and product direction must change accordingly. It's a matter of survival.
halfnium -AT- alum.mit.edu
Yes, I looked just like that in 1962.
User 470292 Photo


Registered User
19 posts

Thank you very much Rolly and Halfnium.
I'll give it a try but I might need to come back for more help. :-)

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.