/* if order is not set, or it is not in the allowed
* list, then set it to a default value. Otherwise,
* set it to what was passed in. */
if (!isset ($_GET['order']) ||
!in_array ($_GET['order'], $allowed_order)) {
$order = $default_sort;
} else {
$order = $_GET['order'];
}

/* construct and run our query */
$query = "SELECT * FROM tblmembers WHERE `MemberApproved`='$cat' ORDER BY $order";

I want to add div tags around the nav.php, and then also around the table below, but when I do this it makes the display errors, is it not just as simple as adding
<div ="navigation">//navigation
include("nav.php");</div>

Notice the difference though, the table example uses double quotations to escape the use of double quotations, while the other does not. This is because of how they are treated, you cannot use single quotations with single quotes, and you cannot use doubles within doubles. Escaping will allow you to retain the quoations (and with the table example, its necessary due to the linebreak \n - it requires the double quotations)
Hope thats what you're looking for!

aedrin

03-14-2007, 04:43 PM

Always surround PHP code with the <?php and ?> delimiters.

<div id="navigation">
<?php
include("nav.php");
?>
</div>

EDIT: I forgot to mention, avoid using /* */ style comments for single line comments. If you have to temporarily comment out a block of code, you'd either have to put // in front of every line, or temporarily undo all the comments.

Just use // style comments for actual comments.

tomyknoker

03-15-2007, 12:22 AM

So guys if I were to use CSS in my php pages, what would be the most correct and Web 2.0 accepted way? I know there are all the above ways but which is the technically the most correct?

tomyknoker

03-15-2007, 12:26 AM

I also have noticed that people just start there pages with '<?php', Should all my php pages still look have these tags or is that incorrect?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Untitled Document</title>
</head>

<body>
</body>
</html>

the-dream

03-15-2007, 12:35 AM

The way above is perfecly fine but sometimes it is nessesary to start your pages with:

<?php

// Stuff Here

?>

tomyknoker

03-15-2007, 02:16 AM

Always surround PHP code with the <?php and ?> delimiters.

<div id="navigation">
<?php
include("nav.php");
?>
</div>

EDIT: I forgot to mention, avoid using /* */ style comments for single line comments. If you have to temporarily comment out a block of code, you'd either have to put // in front of every line, or temporarily undo all the comments.

Just use // style comments for actual comments.Sorry so just to be clear like this