Forum Moderators: coopster

Message Too Old, No Replies

Dynamic PHP & HTML Table from database?

         

nizmo

7:25 pm on Apr 1, 2011 (gmt 0)

10+ Year Member



Hello,

I need data from a mysql database to be able to be displayed on a webpage and was wondering how one goes about it, and wht are the usual options ?

I would like to intergrate user filters, which are essentially queries correct ? so it can be organised by the user of the webpage should they want to.

coopster

12:55 am on Apr 2, 2011 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, nizmo.

The first thing is to set up MySQL on your server. Configure the server next, paying particular attention to security settings. You will then set up users and permissions. Now you move on to the good stuff, databases and tables.

All of this can be found in the MySQL manual pages or you can have somebody else set it up for you. Most hosting providers offer simplified user "Control Panels" that get you started quite quickly with little or no knowledge of what you are doing :P My advice would still be to read the tutorials pages in the MySQL manual.

You may have to offer a little more definition of a "user filter" for us though, not quite tracking on that subject.

nizmo

6:29 pm on Apr 2, 2011 (gmt 0)

10+ Year Member



Hello, thanks for your reply. Yes I have that all set up already, I am using xxamp for local testing, and coding in dreamweaver to access the database.

I already have it connecting to the chosen database, I however dont know the code one would use to access and have it display as a nice table on my website, to which the users can read.

What I meant by user filters is that little drop down box you get almost everwhere where a user can sort the records from least to most expensive, popularity, bestsellers, etc etc. Then the table reloads. - This is why I thought a query is assigned to each, and when user clicks, it runs and re organises the table.

coopster

12:50 pm on Apr 4, 2011 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



To display the data you develop a SELECT query in your PHP code that executes the query on the server. You then loop through the result set to fetch each row that was returned and format your output.