How to make a php function contain mysql commands

Posted by bob on Stack Overflow See other posts from Stack Overflow or by bob
Published on 2010-04-14T13:16:15Z Indexed on 2010/04/14 13:23 UTC
Read the original article Hit count: 283

Filed under:
|
|

I want to create a simple menu function which can call it example get_menu()

Here is my current code.

<?php 
$select = 'SELECT * FROM pages';
$query  = $db->rq($select);
while ($page = $db->fetch($query)) { 
$id = $page['id'];
$title = $page['title'];
?>
<a href="page.php?id<?php echo $id; ?>" title="<?php echo $title; ?>"><?php echo $title; ?></a>
<?php } ?>

How to do that in?

function get_menu() {
}

Let me know.

© Stack Overflow or respective owner

Related posts about php

Related posts about function