Ver Mensaje Individual
  #3 (permalink)  
Antiguo 06/08/2003, 00:57
TiMeSxz
 
Fecha de Ingreso: junio-2003
Ubicación: Barcelona
Mensajes: 51
Antigüedad: 20 años, 10 meses
Puntos: 0
buf, me estoy liando aver pongo el codigo aver si me pueden ayudar, gracias

Código PHP:
<?php
if ($submit): 

  
mysql_connect("localhost""""");
  
mysql_select_db("timesxz");

  
$sql "INSERT INTO noticias SET
          titulo='$titulo',
          texto='$texto',
          autor='$autor',
          fecha='$fecha(now)'
     "
;
  if (
mysql_query($sql)) {
    echo(
"<p>noticia posteada</p>");
  } else {
    echo(
"<p>Error al postear " .
         
mysql_error() . "</p>");
  }

?>

<p><a href="<?=$PHP_SELF?>">Añadir nueva noticia.</a></p>


<?php
  
else: 
?>

<form action="<?=$PHP_SELF?>" method="post">
<p>Introduzca Noticia:<br />

<table width="59%" height="181" border="0">
  <tr> 
    <td width="55%" height="21"><input type="text" name="titulo" size="50" maxlength="255" />
</td>
    <td width="45%"><?php $fecha?></td>
  </tr>
  <tr> 
    <td height="131" colspan="2"><textarea name="texto" cols="70" rows="7"></textarea></td>
  </tr>
  <tr> 
    <td colspan="2"><input type="text" name="autor" size="20" maxlength="255" /></td>
  </tr>
</table>
<input type="submit" name="submit" value="Enviar" /></p>
</form>
<?php endif; ?>
al hacerlo por un formulario pues no se como hacerlo para que salga, arriba ponia al principio
fecha='$fecha(now)' pero asi salia todo 0 y no se donde ponerlo para que salga algo asi como fecha; now()

gracias de antemano

Última edición por TiMeSxz; 06/08/2003 a las 00:59