Foros del Web » Soporte técnico » Ayuda General »

creando un chat

Estas en el tema de creando un chat en el foro de Ayuda General en Foros del Web. hola a todos, estoy haciendo un chat y tengo un inconveniente con el código , los mensajes que trato de enviar no se me publican ...
  #1 (permalink)  
Antiguo 15/03/2013, 21:00
 
Fecha de Ingreso: marzo-2013
Mensajes: 4
Antigüedad: 11 años, 1 mes
Puntos: 0
creando un chat

hola a todos, estoy haciendo un chat y tengo un inconveniente con el código ,
los mensajes que trato de enviar no se me publican en pagina index.php pero me figura en la base de datos ,
aqui dejo el código que estoy utilizando
estoy utilizando Dreamweaver

<?php require_once('Connections/BDsgl.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$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;
}
}

mysql_select_db($database_BDsgl, $BDsgl);
$query_Recordset1 = "SELECT `registro gamers xbox`.mensajes FROM `registro gamers xbox` ORDER BY `registro gamers xbox`.id DESC LIMIT 5";
$Recordset1 = mysql_query($query_Recordset1, $BDsgl) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);

while ($fila = mysql_fetch_array ($Recordset1, MYSQL_ASSOC)) {
printf ("usuario: %s", $fila ["mensajes"]);
echo "<br><hr>";
}


mysql_free_result($Recordset1);
?>
  #2 (permalink)  
Antiguo 17/03/2013, 08:52
Avatar de hasdpk  
Fecha de Ingreso: agosto-2011
Ubicación: $spain->city( 'Arucas' );
Mensajes: 1.800
Antigüedad: 12 años, 8 meses
Puntos: 297
Respuesta: creando un chat

Para mi opinión, la consulta SQL está mal hecha.

Aquí tienes la forma de realizar el SELECT: http://dev.mysql.com/doc/refman/5.0/es/select.html.
__________________
Freelance Developer — www.rubenmartin.me PHP, SQL, Wordpress, Prestashop, Codeigniter, Laravel
RegaloConsolas — www.regaloconsolas.com Sorteo juegos, consolas y accesorios

Etiquetas: chat, creando
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 13:18.