Gracias A todos por estar dandome una mano, aca les dejo del archivo index.php todo el codigo:
Código PHP:
<?php
include_once('header.php');
include_once('db_fns.php');
$handle = db_connect();
$pages_sql = 'select * from pages order by code';
$pages_result = mysql_query($pages_sql); //$pages_result = $handle->query($pages_sql);
//este codigo pertenece a el buscador
echo '<table align="right" border="0" width="500">';
while($pages = mysql_fetch_assoc($pages_result))
{
$story_sql = "select * from stories
where page = '{$pages['code']}'
and published is not null
order by published desc";
$story_result = $handle->query($story_sql);
if ($story_result->num_rows)
{
$story = $story_result->fetch_assoc();
echo "<tr>
<td>
<h4>{$pages['description']}</h4>
<h3>{$story['headline']}</h3>
<p align='right' class='morelink'>
<a href='page.php?page={$pages['code']}'>
Leer más {$pages['code']} ...
</a>
</p>
</td>
<td width='100'>";
if ($story['picture'])
{
echo '<img src="resize_image.php?image=';
echo urlencode($story[picture]);
echo '&max_width=160&max_height=140 "/>';
}
echo '</td></tr>';
}
}
echo '</table>';
include_once('footer.php');
?>
<META NAME="GOOGLEBOT" CONTENT="index,all,follow,imageclick"> <style type="text/css">
<!--
body {
margin-bottom: 0px;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
}
-->
</style>
y este es el codigo de el archivo db_fns.php Código PHP:
<?php
function db_connect()
{
$handle = mysql_connect('localhost', 'tesiopro_admin', 'tesio112233', 'tesiopro_content');
if (!$handle)
{
return false;
}
return $handle;
}
function get_writer_record($username)
{
$handle = db_connect();
$query = "select * from writers where username = '$username'";
$result = $handle->query($query);
return($result->fetch_assoc());
}
function get_story_record($story)
{
$handle = db_connect();
$query = "select * from stories where id = '$story'";
$result = $handle->query($query);
return($result->fetch_assoc());
}
function query_select($name, $query, $default='')
{
$handle = db_connect();
$result = $handle->query($query);
if (!$result)
{
return('');
}
$select = "<select name='$name'>";
$select .= '<option value=""';
if($default == '') $select .= ' selected ';
$select .= '>-- Choose --</option>';
for ($i=0; $i < $result->num_rows; $i++)
{
$option = $result->fetch_array();
$select .= "<option value='{$option[0]}'";
if ($option[0] == $default)
{
$select .= ' selected';
}
$select .= ">[{$option[0]}] {$option[1]}</option>";
}
$select .= "</select>\n";
return($select);
}
?>
desde ya les agradezco a todos los que me estan ayudando. y a las buenas y malas criticas tambien!