Foros del Web » Programando para Internet » PHP »

AYUDA: Fatal error: Call to undefined function...

Estas en el tema de AYUDA: Fatal error: Call to undefined function... en el foro de PHP en Foros del Web. Saludos tngo un problema y es q cuando subo el sistema a la base d datos y entro a la pagina me da este error.. ...
  #1 (permalink)  
Antiguo 13/09/2007, 07:07
Avatar de T4ke0veR  
Fecha de Ingreso: agosto-2007
Ubicación: Quito - Ecuador
Mensajes: 1.720
Antigüedad: 16 años, 8 meses
Puntos: 28
AYUDA: Fatal error: Call to undefined function...

Saludos tngo un problema y es q cuando subo el sistema a la base d datos y entro a la pagina me da este error..

Fatal error: Call to undefined function: virtual() in /home/basinger/public_html/prueba/news.php on line 5

estos son los codigos
news.php
Código PHP:
<?php
mb_http_input
("utf-8");
mb_http_output("utf-8");
?>
<?php virtual
('Connections/noticias.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  
$theValue get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  
$theValue function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch (
$theType) {
    case 
"text":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;    
    case 
"long":
    case 
"int":
      
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case 
"double":
      
$theValue = ($theValue != "") ? "'" doubleval($theValue) . "'" "NULL";
      break;
    case 
"date":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;
    case 
"defined":
      
$theValue = ($theValue != "") ? $theDefinedValue $theNotDefinedValue;
      break;
  }
  return 
$theValue;
}
}

$editFormAction $_SERVER['PHP_SELF'];
if (isset(
$_SERVER['QUERY_STRING'])) {
  
$editFormAction .= "?" htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset(
$_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  
$insertSQL sprintf("INSERT INTO noticias (id, fecha, noticia) VALUES (%s, %s, %s)",
                       
GetSQLValueString($_POST['id'], "int"),
                       
GetSQLValueString($_POST['fecha'], "date"),
                       
GetSQLValueString($_POST['noticia'], "text"));

  
mysql_select_db($database_noticias$noticias);
  
$Result1 mysql_query($insertSQL$noticias) or die(mysql_error());

  
$insertGoTo "registro.php";
  if (isset(
$_SERVER['QUERY_STRING'])) {
    
$insertGoTo .= (strpos($insertGoTo'?')) ? "&" "?";
    
$insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  
header(sprintf("Location: %s"$insertGoTo));
}

$maxRows_Recordset1 10;
$pageNum_Recordset1 0;
if (isset(
$_GET['pageNum_Recordset1'])) {
  
$pageNum_Recordset1 $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 $pageNum_Recordset1 $maxRows_Recordset1;

mysql_select_db($database_noticias$noticias);
$query_Recordset1 "SELECT * FROM noticias ORDER BY id ASC";
$query_limit_Recordset1 sprintf("%s LIMIT %d, %d"$query_Recordset1$startRow_Recordset1$maxRows_Recordset1);
$Recordset1 mysql_query($query_limit_Recordset1$noticias) or die(mysql_error());
$row_Recordset1 mysql_fetch_assoc($Recordset1);

if (isset(
$_GET['totalRows_Recordset1'])) {
  
$totalRows_Recordset1 $_GET['totalRows_Recordset1'];
} else {
  
$all_Recordset1 mysql_query($query_Recordset1);
  
$totalRows_Recordset1 mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;

mysql_select_db($database_noticias$noticias);
$query_Recordset1 "SELECT * FROM noticias ORDER BY id ASC LIMIT 10"
$Recordset1 mysql_query($query_Recordset1$noticias) or die(mysql_error());
$row_Recordset1 mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 mysql_num_rows($Recordset1);
?><!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>Untitled Document</title>
<script type="text/javascript">
<!--
function MM_validateForm() { //v4.0
  if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
      if (val) { nm=val.name; if ((val=val.value)!="") {
        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
          if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
        } else if (test!='R') { num = parseFloat(val);
          if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
            min=test.substring(8,p); max=test.substring(p+1);
            if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
    } if (errors) alert('The following error(s) occurred:\n'+errors);
    document.MM_returnValue = (errors == '');
} }
//-->
</script>
<link href="/estilos.css" rel="stylesheet" type="text/css" />
</head>

<body>
<form action="<?php echo $editFormAction?>" method="post" name="form1" id="form1">
  <table align="center">
    <tr valign="baseline">
      <td align="right" nowrap="nowrap" class="verdana_once">Fecha:</td>
      <td class="verdana10"><input name="fecha" type="text" id="fecha" onblur="MM_validateForm('fecha','','R');return document.MM_returnValue" value="" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td align="right" valign="top" nowrap="nowrap" class="verdana_once">Noticia:</td>
      <td class="verdana10"><textarea name="noticia" cols="50" rows="5" id="noticia" onblur="MM_validateForm('noticia','','R');return document.MM_returnValue"></textarea>
      </td>
    </tr>
    <tr valign="baseline">
      <td align="right" nowrap="nowrap" class="verdana10">&nbsp;</td>
      <td class="verdana10"><input type="submit" value="Insertar Noticia" /></td>
    </tr>
  </table>
  <input type="hidden" name="id" value="" />
  <input type="hidden" name="MM_insert" value="form1" />
</form>
<p>&nbsp;</p>
<table width="100%" border="0" cellspacing="3" cellpadding="0">
  <tr>
    <td width="10%" class="titulos"><strong>ID</strong></td>
    <td width="14%" class="titulos"><strong>Fecha</strong></td>
    <td width="60%" class="titulos"><strong>Noticia</strong></td>
    <td width="16%">&nbsp;</td>
  </tr>
</table>
<br />
<?php do { ?>
  <table width="100%" border="0" cellpadding="0" cellspacing="3">
    <tr>
      <td width="10%" class="verdana10"><?php echo "$row_Recordset1[id]"?></td>
      <td width="14%" class="verdana10"><?php echo "$row_Recordset1[fecha]"?></td>
      <td width="60%" class="verdana10"><?php echo "$row_Recordset1[noticia]"?></td>
      <td width="16%" class="verdana10">Eliminar / Modificar</td>
    </tr>
      </table>
  <?php } while ($row_Recordset1 mysql_fetch_assoc($Recordset1)); ?></body>
</html>
<?php
mysql_free_result
($Recordset1);
?>
archivo conecttions
noticias.php
Código PHP:
<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_noticias "127.0.0.1";
$database_noticias "basinger";
$username_noticias "wbst1";
$password_noticias "";
$noticias mysql_pconnect($hostname_noticias$username_noticias$password_noticias) or trigger_error(mysql_error(),E_USER_ERROR); 
?>
  #2 (permalink)  
Antiguo 13/09/2007, 08:16
Avatar de mauled  
Fecha de Ingreso: marzo-2005
Ubicación: Cd. de México.
Mensajes: 3.001
Antigüedad: 19 años, 1 mes
Puntos: 33
Re: AYUDA: Fatal error: Call to undefined function...

Cita:
Virtual
Versión Descripción
4.0.6 Esta función puede ser usada sobre archivos PHP. Sin embargo, usualmente es mejor usar include() o require() para archivos PHP.
Saludillos.
  #3 (permalink)  
Antiguo 13/09/2007, 10:13
Avatar de T4ke0veR  
Fecha de Ingreso: agosto-2007
Ubicación: Quito - Ecuador
Mensajes: 1.720
Antigüedad: 16 años, 8 meses
Puntos: 28
Re: AYUDA: Fatal error: Call to undefined function...

crees q ese sea el error??? o puede haber algun otro?
  #4 (permalink)  
Antiguo 13/09/2007, 11:06
 
Fecha de Ingreso: septiembre-2006
Mensajes: 81
Antigüedad: 17 años, 7 meses
Puntos: 5
Re: AYUDA: Fatal error: Call to undefined function...

El error es que la funcion virtual() no existe en el archivo news.php. Y tu la llamas en la linea 5.
Código PHP:
<?php virtual('Connections/noticias.php'); ?>
Pues seguramente es ese el error.

para incluir archivos usa el include() o el require() como bien dice mauled
  #5 (permalink)  
Antiguo 13/09/2007, 12:28
Avatar de monjeruiz  
Fecha de Ingreso: junio-2007
Ubicación: Santiago, Chile
Mensajes: 113
Antigüedad: 16 años, 10 meses
Puntos: 3
Re: AYUDA: Fatal error: Call to undefined function...

...........
__________________
[B]Ingeniero en Informatica
Jose Monje Ruiz [/b]
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 21:31.