mmmbaileys
mmmbaileys

Reputation: 1243

Display SQL Query Result in a HTML Webpage

I'm comfortable with PHP/SQL, however my experience with HTML and web development in general is limited.

I need to display the results of a SQL query in a simple HTML webpage. I understand this can be done by embedding some PHP code in the HTML document, using <?php.......?>

However my current PHP code contains sensitive login details for my database, and obviously this couldn't be included...

What's the best approach to doing this?

Upvotes: 0

Views: 1463

Answers (2)

Gil
Gil

Reputation: 184

You can use a mvc framework, like yii or codeigniter.. so you don't need to insert that data in the view files, u just have that in configuration files, which is in another folder..

hope it helps

Upvotes: 1

Bobot
Bobot

Reputation: 1118

Well, the appache server pre-processes you .php file, parsing the php code and replacing it by what it should return, so if you do not echo sensitive details, you will don't have problems :)

There is an image will maybe help you to understand : How it works

Well, now you have to understand that Appache will never return itslef the content of the php of your webpage, if it's well configurated, and if you didn't let exploits like free url including (see in php.ini : allow url include or something like that ;) )

I'm talking about apache, but there is other web servers, nginx etc ...

For the displaying of your results, i suggest you print_r() or var_dump().

Upvotes: 0

Related Questions