tengo un problema con mi CODIGO eso creo
estoy asiendo consultas en php y Adobe Dreamweaver CS5 con conexiones.
aprendido allamar y hacer consultas con Adobe Dreamweaver CS5 al base de datos. trabajo con mysql
mi problema que qye me sale 1 registro nada mas. hay como 10 registros
Citar
Warning: mysql_fetch_assoc(): 4 is not a valid MySQL result resource in C:\AppServ\www\12\demus\index2.php on line 59
id nombre clave titulo mensaje
1 juan carlo silva jejeje skdskds md ksdk skdskd ksd k
id nombre clave titulo mensaje
1 juan carlo silva jejeje skdskds md ksdk skdskd ksd k
echo todo exato loque esta en un tuto. pero me sale ese error
este file :
Citar
<?php require_once('Connections/users.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_users, $users);
$query_mostar = "SELECT * FROM usuario";
$mostar = mysql_query($query_mostar, $users) or die(mysql_error());
$row_mostar = mysql_fetch_assoc($mostar);
$totalRows_mostar = mysql_num_rows($mostar);
mysql_free_result($mostar);
?>
<table border="1" cellpadding="4" cellspacing="4">
<tr>
<td>id</td>
<td>nombre</td>
<td>clave</td>
<td>titulo</td>
<td>mensaje</td>
</tr>
<?php do { ?>
<tr>
<td><?php echo $row_mostar['id']; ?></td>
<td><?php echo $row_mostar['nombre']; ?></td>
<td><?php echo $row_mostar['clave']; ?></td>
<td><?php echo $row_mostar['titulo']; ?></td>
<td><?php echo $row_mostar['mensaje']; ?></td>
</tr>
<?php } while ($row_mostar = mysql_fetch_assoc($mostar)); ?>
</table>
<?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_users, $users);
$query_mostar = "SELECT * FROM usuario";
$mostar = mysql_query($query_mostar, $users) or die(mysql_error());
$row_mostar = mysql_fetch_assoc($mostar);
$totalRows_mostar = mysql_num_rows($mostar);
mysql_free_result($mostar);
?>
<table border="1" cellpadding="4" cellspacing="4">
<tr>
<td>id</td>
<td>nombre</td>
<td>clave</td>
<td>titulo</td>
<td>mensaje</td>
</tr>
<?php do { ?>
<tr>
<td><?php echo $row_mostar['id']; ?></td>
<td><?php echo $row_mostar['nombre']; ?></td>
<td><?php echo $row_mostar['clave']; ?></td>
<td><?php echo $row_mostar['titulo']; ?></td>
<td><?php echo $row_mostar['mensaje']; ?></td>
</tr>
<?php } while ($row_mostar = mysql_fetch_assoc($mostar)); ?>
</table>
este de la conexion:
Citar
<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_users = "localhost";
$database_users = "demus";
$username_users = "root";
$password_users = "147";
$users = mysql_pconnect($hostname_users, $username_users, $password_users) or trigger_error(mysql_error(),E_USER_ERROR);
?>
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_users = "localhost";
$database_users = "demus";
$username_users = "root";
$password_users = "147";
$users = mysql_pconnect($hostname_users, $username_users, $password_users) or trigger_error(mysql_error(),E_USER_ERROR);
?>
aver si me ayudan porfa. se lo gradesco de ante mano. gracias