help with using MVC approach to fill php with mysql data

Hello everyone, I need some help regarding a scenario where I have to eventually display the data as a pdf in my browser. This is my first attempt at coding in php, so pls be a little nice and not too over-technical ;D

Scenario (using php):

  1. Verify is user is logged in to site, and if so, retrieve his details from the Member (MemberID, Name, Email) and Address (MemberID[FK to Member table], Street, Country) tables

  2. Fetch the info the the php file

  3. Fill html spaces with the fetched data (see the doc on [php]http://www.keepandshare.com/doc/3212100/exampledoc-doc-october-21-2011-11-55-am-40k[php] for template example to be filled) In fact, referring to the doc in the link, the blue-colored part and the Autofill parts are the ones to be filled using the mysql data

  4. Render the php as a pdf file in the web-browser

Any help on how to start from scratch from this will be much appreciated…

To verify that a user is logged in to your site:

Verifying a user is currently logged in to your site:

Typically this is done by setting a session variable after the user logs in. If you set the variable value to say, the user’s ID in the database, it helps with your second step:

Retrieving/Displaying User Information:

If the session variable containing a user id is set, you can use that ID to perform a SQL lookup and get back your user data. There are a number of ways/formats to pull data from a database using PHP, you’ll need to read up on them. Once you have your result set, you can just echo the results straight in to your HTML.

As to rendering the page as a PDF, there are all kinds of PHP libraries that offer that functionality, again, it’s just a matter of picking one that works for you.

Sponsor our Newsletter | Privacy Policy | Terms of Service