boomtree Posted November 25, 2014 Share Posted November 25, 2014 Hello all, I haven't worked with PHP and MySQL very much, but have been working with HTML and JavaScript for years. This time, I want to build a simple website that allows users to query a database of coins. I just want to make sure that I approach this in the right direction. I'd like to describe what I'm trying to do and hopefully someone can prevent me from becoming a failure. For the database, each coin has an ID and row, the first column of which is the date, and the following columns attributes of that particular coin. Several entries can exist with the same date. Anyway, there will basically be three types of pages: 1. A query page from which users will click a date or enter a term in a search box. 2. A query result page displaying a list of search results, like '1909' or 'Lincoln'. Each result will be linked to an individual page for that coin. 3. An individual page. This template page will have an html table whose cells are each defined by the values for that coin in the database. So for instance, the user searches or clicks on '1909' on the query page and sees 10 records listed in the database on the result page. The user can then click one of those 10 records and view a new page that displays more information on that particular coin. Quote Link to comment Share on other sites More sharing options...
boomtree Posted November 25, 2014 Author Share Posted November 25, 2014 By the way, I'm trying to avoid creating a page for each coin in the database. The idea is to make changes in the database and not the website. If I want to add a coin to the website, I just add it to the database. My intent is to find a way to create a way to share and navigate the information in my database, and do it with style in HTML and CSS. Quote Link to comment Share on other sites More sharing options...
QuickOldCar Posted November 25, 2014 Share Posted November 25, 2014 Hard to explain how to build an entire site with a search and also pagination. First lets link you to the php tutorial so you can look it over, get familiar with some syntax and functions. http://php.net/manual/en/tutorial.php Instead of having just a single page with a table.... Can use a simple php template system or something like twig or smarty A framework like laravel or symphony for the more complex cms items. If the entire making a cms is too much, you can still produce a simple single page of any design you like with a search that could fetch data. All depends if you want users, single pages, be found in search engines and so on. You know...like a real website. You want to use mysqli_* or pdo for making connections and fetching data from your database Use phpmyadmin to aid in setting your tables up. Personally I would use MyISAM as the storage engine and fulltext in boolean mode to make the search process a lot simpler. Set the id column as primary and autoincrement, the rest of the columns name and select what type of data expect. For pagination there is an older tutorial at phpfreaks using the mysql_* functions which is the same idea. http://www.phpfreaks.com/tutorial/basic-pagination As for the search, the inserted search terms would become dynamic values in the query coming from the form and/or address bar. Depends if you use POST or GET in your form. Once you got something going feel free to ask particular questions on the forum. It's a lot easier to get help when ask a specific question and an example of code to go along with it. I can help you out with integrating the search aspect when get to that point. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.