Mostrar Mensajes

Esta sección te permite ver todos los posts escritos por este usuario. Ten en cuenta que sólo puedes ver los posts escritos en zonas a las que tienes acceso en este momento.


Mensajes - Saphari

Páginas: 1 ... 5 6 [7]
91
PHP / Re:[Help] Sistema de Noticia
« en: 02 de Febrero de 2010, 19:55:48 pm »
error: Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in C:\AppServ\www\admin\enviar.php on line 18

Código: [Seleccionar]
<style type="text/css">
<!--
body,td,th {
color: #FFFFFF;
}
body {
background-color: #000000;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style><?php
include("connect.php"); # Incluimos el conectar.php
if(isset($_POST[&#39;ok&#39;])) { # Miramos si han dado al boton enviar noticia
$fecha "$days-$months-$years";
$sql =mysql_query "INSERT INTO noticia (titulo,mensaje,fecha,autor) values";  &#39;".$_POST[&#39;titulo&#39;]."&#39;,&#39;".$_POST[&#39;mensaje&#39;]."&#39;,&#39;".$_POST[&#39;fecha&#39;]."&#39;,&#39;".$_POST[&#39;autor&#39;]."&#39;") or die(mysql_error());
if(mysql_query($sql)) { # Expones sql
echo "Se ha enviado la noticia correctamente"# si se ha enviado la noticia correctamente
}else{
echo 
"Ha habido un error en enviar la noticia"# Si ha habido un error
}
}
echo &
#39;<br><a href="ver.php">Ver Noticias</a>&#39;; # IR a la url de ver las noticias
?>

92
PHP / Re:[Help] Sistema de Noticia
« en: 02 de Febrero de 2010, 19:47:13 pm »
si ya la cambie pero le dice esto que crees que sea amigo

 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near

93
PHP / Re:[Help] Sistema de Noticia
« en: 02 de Febrero de 2010, 19:39:51 pm »
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'titulo,mensaje,fecha,autor values

94
PHP / Re:[Help] Sistema de Noticia
« en: 02 de Febrero de 2010, 14:46:44 pm »
disuclpa habia copiado el que no era xD

Código: [Seleccionar]
<style type="text/css">
<!--
body,td,th {
color: #FFFFFF;
}
body {
background-color: #000000;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style><?php
include("connect.php"); # Incluimos el conectar.php
if(isset($_POST[&#39;ok&#39;])) { # Miramos si han dado al boton enviar noticia
$fecha "$days-$months-$years";
$sql "INSERT INTO `noticia` (titulo,mensaje,fecha,autor) values";  # Abirmos la tabla sql
$sql.= "(&#39;".$_POST[&#39;titulo&#39;]."&#39;,&#39;".$_POST[&#39;mensaje&#39;]."&#39;,&#39;".$_POST[&#39;fecha&#39;]."&#39;,&#39;".$_POST[&#39;autor&#39;]."&#39;)"; # Y insertamos estos valores
if(mysql_query($sql)) { # Expones sql
echo "Se ha enviado la noticia correctamente"# si se ha enviado la noticia correctamente
}else{
echo 
"Ha habido un error en enviar la noticia"# Si ha habido un error
}
}
echo &
#39;<br><a href="ver.php">Ver Noticias</a>&#39;; # IR a la url de ver las noticias
?>

95
PHP / Re:[Help] Sistema de Noticia
« en: 02 de Febrero de 2010, 13:31:17 pm »
ok amigo solucionado el problema del archivo ver.php. pero ahora cuando lleno el formulario me  sale esto
Ha habido un error en enviar la noticia, no guarda en la base de datos

96
PHP / [Solucionado] Sistema de Noticia
« en: 02 de Febrero de 2010, 02:58:20 am »
Buenos  amigos estoy haciendo un sistema de noticia, cuando envia el formulario esta bien pero cuando veo la base de datos no  hay nada  guardado, tambien  le doy a ver noticia me da  un error  aqui les dejo lo que estoy haciendo y mi codigo "Ojo: Este Sistema de Noticia es para un Panel de Control de Admin"

Código: [Seleccionar]
CREATE TABLE noticia (
id int (1) NOT NULL auto_increment,
titulo char (100) NOT NULL,
noticia text NOT NULL,
fecha datetime  NOT NULL,
autor char (100) NOT NULL,
key id (id))

Noticia.php
Código: [Seleccionar]
<style type="text/css">
<!--
body,td,th {
color: #FFFFFF;
}
body {
background-color: #000000;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style>
<blockquote>
  <form action="enviar.php" method="post" name="form" id="form">
    <table width="314" border="0">
      <tr>
        <td width="85"><strong>Titulo:</strong></td>
        <td width="219"><label>
          <input name="titulo" type="text" id="titulo">
        </label></td>
      </tr>
      <tr>
        <td><strong>Autor:</strong></td>
        <td><label>
          <input name="autor" type="text" id="autor">
        </label></td>
      </tr>
      <tr>
        <td><strong>Fecha:</strong></td>
        <td><label>
          <select name="days" id="days">
            <?php
for($i 1$i <= date("t"); $i++) {
$i==date("d") ? $amount "selected" $amount "";
$i<=$zero "0" $zero "";
echo 
"<option value=&#39;$zero$i&#39; $amount>$zero$i</option>";
}
?>

          </select>
        </label>
/
<label>
<select name="months" id="months">
  <option>01</option>
  <option>02</option>
  <option>03</option>
  <option>04</option>
  <option>05</option>
  <option>06</option>
  <option>07</option>
  <option>08</option>
  <option>09</option>
  <option>10</option>
  <option>11</option>
  <option>12</option>
  <?php
for($i 1$i <= count($months)-1$i++) {
$i == $date $amount "selected" $amount "";
echo 
"<option value=&#39;$months[$i]&#39; $amount>$months[$i]</option>";
}
?>

</select>
</label>
/
<label>
<select name="years" id="years">
  <?php
for($i 1950$i <= date("Y"); $i++) {
$i==date("Y") ? $amount "selected" $amount "";
echo 
"<option value=&#39;$i&#39; $amount>$i</option>";
}
?>

</select>
</label></td>
      </tr>
      <tr>
        <td><strong>
          <label>Mensaje:</label>
        </strong></td>
        <td><label></label>
          <label></label><label>
          <textarea name="mensaje" cols="25" rows="10" id="mensaje"></textarea>
        </label></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
    </table>
    <p>
      <label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <input name="ok" type="submit" id="ok" value="Enviar Noticia">
      </label>
      <label>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="reset" name="Submit2" value="Borrar">
      </label>
    </p>
  </form>
</blockquote>

Enviar.php

Código: [Seleccionar]
<style type="text/css">
<!--
body,td,th {
color: #FFFFFF;
}
body {
background-color: #000000;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style><?php
include("connect.php"); # Incluimos el conectar.php
if(isset($_POST[&#39;ok&#39;])) { # Miramos si han dado al boton enviar noticia
$sql "INSERT INTO `mensajes` (autor,mensaje) values";  # Abirmos la tabla sql
$sql.= "(&#39;".$_POST[&#39;autor&#39;]."&#39;,&#39;".$_POST[&#39;mensaje&#39;]."&#39;)"; # Y insertamos estos valores
if(mysql_query($sql)) { # Expones sql
echo "Se ha enviado la noticia correctamente"# si se ha enviado la noticia correctamente
}else{
echo 
"Ha habido un error en enviar la noticia"# Si ha habido un error
}
}
echo &
#39;<br><a href="ver.php">Ver Noticias</a>&#39;; # IR a la url de ver las noticias
?>

este es el error que hay en Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\AppServ\www\admin\ver.php on line 19

Ver.php

Código: [Seleccionar]
<style type="text/css">
<!--
body,td,th {
color: #FFFFFF;
}
body {
background-color: #000000;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style><?php
include("connect.php"); # Incluimos el conectar.php para conectarnos a nuestra base de datos
$the mysql_query("SELECT * from `noticia` ORDER BY `id` DESC"); # Buscamos las noticias almacenadas de la primera a la ultima
if (mysql_num_rows($the)) {
while (
$ver mysql_fetch_array($the)) { # Extramos datos de la tabla sql a la raiz
echo "<br><b>Titulo</b>: &#39;.$ver[&#39;titulo&#39;].&#39;"# Mostramos  el titulo de la noticia
echo "<br><b>Mensaje</b>: &#39;.$ver[&#39;mensaje&#39;].&#39;"# Mostramos el Mensaje de la noticia
echo "<br><b>Autor</b>: &#39;.$ver[&#39;autor&#39;].&#39;"# Mostramos el Autor de la  noticia
echo "<br><b>Fecha</b>: &#39;.$ver[&#39;fecha&#39;].&#39;"#Mostramos la Fecha de la Noticia
}
} else {
echo 
"No hay noticias actualmente"# Si hay 0 noticias, se mostrara esto...
}
echo &
#39;<br><a href="enviar.php">Enviar noticias</a>&#39;; # Ir al enviador de noticias
?>

Connect.php

Código: [Seleccionar]
<?php
$db_host
="localhost"
$db_nombre="web";
$db_user="root"
$db_pass="root";
$link=mysql_connect($db_host$db_user$db_pass) or die ("Error conectando a la base de datos.");
mysql_select_db($db_nombre ,$link) or die("Error seleccionando la base de datos.");
return 
$link;
?>


Esperos  que me Puedan Ayudar amigos

97
PHP / Re:[Error ] mysql_num_rows
« en: 02 de Febrero de 2010, 02:49:24 am »
ok amigos  he provado todos lo que ustedes me escribieron pero  igual me  da error.

aqui les dejo los errores

error 1: Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in C:\AppServ\www\regitrar.php on line 19

Código: [Seleccionar]
$numrow = mysql_num_rows($result); //hacemos una variable con num_rows
if($numrow!=0) //comprobamos si el usuario existe, si no es 0, no puedes continuar
{
die "Nombre de usuario en uso."; //aqui el error
}



Error 2: Warning: Wrong parameter count for mysql_result() in C:\AppServ\www\regitrar.php on line 20
Error registrando usuario.

Código: [Seleccionar]
if(mysql_num_rows($result)>0) {
echo "Usuario en uso";
} else {
// resto del codigo
}

98
PHP / [Error ] mysql_num_rows
« en: 29 de Enero de 2010, 19:19:41 pm »
holas  amigos  tengo  2 errores que no se por que se da y quisiera saber aqui les dejo mis errores

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\regitrar.php on line 16

Warning: Wrong parameter count for mysql_result() in C:\AppServ\www\regitrar.php on line 19
Error registrando usuario.

Código: [Seleccionar]
<?php
include ("connet.php");
$pass2 $_POST[&#39;pass1&#39;];
$pass1 $_POST[&#39;pass2&#39;];
$email $_POST[&#39;email&#39;];
$name $_POST[&#39;nombre&#39;];
$apellido $_POST[&#39;apellido&#39;];
$ciudad $_POST[&#39;ciudad&#39;];
$estado $_POST[&#39;estado&#39;];
$telefono $_POST[&#39;telefono&#39;];
$pais $_POST[&#39;pais&#39;];
$fecha_nacimiento $_POST[&#39;fecha_nacimiento&#39;];
$nick $_POST[&#39;nick&#39;];
$ssql="SELECT * FROM usuarios WHERE nick=&#39;" $nick "&#39;";
$resultmysql_query($ssql); 
if(
mysql_num_rows($result)){ //error  aqui tambien
echo "Nombre de usuario en uso.";
} else {
mysql_result($result);//error aqui
//procedimos a comprobar contraseñas
if($pass1!=$pass2) {
echo 
"Error: las contraseñas especificadas son distintas";
} else {
$ssql"INSERT INTO usuarios (nombre, pass1, email, apellido, telefono, ciudad, estado, pais, nick, fecha_nacimiento) VALUES (&#39;$name&#39;,&#39;$pass1&#39;,&#39;$email&#39;,&#39;$apellido&#39;,&#39;$telefono&#39;,&#39;$ciudad&#39;,&#39;$pais&#39;,&#39;$estado&#39;,&#39;$fecha_nacimiento&#39;,&#39;$nick&#39;)";
if(
mysql_query ($ssql)){
echo 
"Usuario registrado con exito.";
} else {
echo 
"Error registrando usuario.";
}
}
}
?>

Páginas: 1 ... 5 6 [7]