Ver Mensaje Individual
  #4 (permalink)  
Antiguo 25/09/2007, 09:43
Avatar de GatorV
GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 18 años
Puntos: 2135
Re: no logro crear un funcion que conecte a mi bd

Código PHP:
<?php
function site_config()
{
    require_once(
'Connections/SCMS.php');
    
mysql_select_db($database_SCMS$SCMS);
    
$query_site_config "SELECT * FROM site";
    
$site_config mysql_query($query_site_config$SCMS) or die(mysql_error());
    
$row_site_config mysql_fetch_assoc($site_config);
    
$totalRows_site_config mysql_num_rows($site_config);
    
/*La variable sitename */
    
$sitename $row_site_config['name'];
    return 
$sitename;
}
function 
close_site_config()
{   
    
mysql_free_result($site_config);
}
?>
La usas asi:
Código PHP:
<?php
include('core.php');
$sitename site_config();
close_site_config();
?>
<!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=utf-8" />
<title><?php echo $sitename?></title>
</head>
<body>
<br /><div style="z-index:3" class="smallfont" align="center">LinkBacks Enabled by <a rel="nofollow" href="http://www.crawlability.com/vbseo/">vBSEO</a> 3.0.0</div></body>
</html>
Saludos.