I'm looking for some advice on how to approach the redevelopment of my site. It's a custom made membership system that currently works as intended, although as it was developed over a year and a half, during which time I obviously learned a bit 😉 it ranges from inefficient to half-decent.
I'm now in the process of reworking the entire system, recreating it from scratch as it really is a bit of a bombsite code-wise!
.php or .html or even .shtml? the site is a mix of static info pages and dynamic select pages. Currently every page is a php page with all html in echos (lovely I know) and the html head and foot of the page in a included php file for ease of editing. The html head and foot are identical on every page, the php scripts on every page are unique and custom. The static info pages currently have no php on them - they are written as html in php (bad kaiya slaps).
My plan was to take the static pages and add them to a page table, with one php page accessing that table for the pages. As I'm not sure about the security risks with eval() I think I can only do that with static pages, not with dynamic pages. So the plan for dynamic pages was to keep them as they are - .php.
From what I've read here, .php pages with html in echoes is poor design. What's the best way to deal with html within php? Have .html files with internal php (in which case, does the page.html?page_id=$var method of linking work?) or have .php files with the html as variables calling from another table?
My second efficiency/design question is is this:
$sql = mysql_query("SELECT * FROM table WHERE field = '1' limit 1");
$numrows=mysql_num_rows($sql);
while ($row = mysql_fetch_array($sql))
{
foreach( $row AS $key => $val )
{
$$key = stripslashes( $val );
}
echo "$variable $variable2 etc";
}
considered acceptable? I used to use mysql_fetch_row but as almost every query has 1-2 left joins it became very difficult to modify many php pages when I changed a table.
Thanks!