Jump to content

Creating a webpage to search a database (possibly SQL)


Recommended Posts

Posted

Hi,

 

I'm wanting to create a webpage, that basically has nothing but a search bar and a little bit of text, the search bar should allow the user to search a database (I assume SQL would be best, considering it's web based) and will return the information - example:

 

[table=width: 500]

[tr]

[td]Name[/td]

[td]Photo[/td]

[td]ID No.[/td]

[/tr]

[tr]

[td]Jeff[/td]

[td] Photo of Jeff here [/td]

[td] 001 [/td]

[/tr]

[tr]

[td]Steve[/td]

[td] Photo of Steve here [/td]

[td] 002 [/td]

[/tr]

[/table]

 

The above is basically the structure of the database, I then want the user to be able to type into the search bar 001 and it return a a small bio of Jeff, IE his name, photo, ID no. and anything else we decide to put in there.

 

What I'm wondering is the best way to achieve this search and display results in a web page - I've had a search but seem to be coming up with mainly irrelevant results or half explained answers - anyone offer some help? Small example if you've done this or something similar in the past or a link to a decent tut would be highly appreciated.

 

I dabble in a bit of web design, but never had to write anything to perform SQL queries... Anything I've done with web based SQL in the past has been basically, Wordpress type installs etc

 

Thanks,

Grant

Posted

You need a web server which has the ability to run some kind of cgi. That might be PHP, Python, ASP, perl or any number of web scripting languages. PHP is probably a good bet, you can run it on windows, mac or linux.

 

W3Schools Online Web Tutorials has some excellent tutorials which will lead you through the process of getting PHP to talk to a MySQL database. Have a go at those and if you get stuck, someone will I'm sure be willing to help.

  • Thanks 1
Posted

Appreciated cheers - I've got a CPanel hosting account, can run all of the above so shouldn't be an issue.

 

I'll have a look at the tuts! :D

Posted

That's actually really helpful - Not exactly what I want to do, but should help me massively in understanding how it's done.

 

I'm liking the login section for possibly allowing users to input DB entries using some of the code from W3Schools - Not had that idea until seeing this script.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...