Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Boa Noite Galera,
estou tendo um pequeno problema com meu mural. Sempre quando publico uma mensagem no mural a nova mensagem tira a antiga da página, porém no BD estão todas ok. vou postar o código para vocês.
Se alguém puder ajudar.
Ficarei grato.
<?php require_once('config.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 recados (nome, email, mensagem) VALUES (%s, %s, %s)",
GetSQLValueString($_POST['nome'], "text"),
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['mensagem'], "text"));
mysql_select_db($database_config, $config);
$Result1 = mysql_query($insertSQL, $config) or die(mysql_error());
$insertGoTo = "mural.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
$maxRows_listadeocorrencias = 15;
$pageNum_listadeocorrencias = 0;
if (isset($_GET['pageNum_listadeocorrencias'])) {
$pageNum_listadeocorrencias = $_GET['pageNum_listadeocorrencias'];
}
$startRow_listadeocorrencias = $pageNum_listadeocorrencias * $maxRows_listadeocorrencias;
mysql_select_db($database_config, $config);
$query_listadeocorrencias = "SELECT * FROM recados ORDER BY id DESC";
$query_limit_listadeocorrencias = sprintf("%s LIMIT %d, %d", $query_listadeocorrencias, $startRow_listadeocorrencias, $maxRows_listadeocorrencias);
$listadeocorrencias = mysql_query($query_limit_listadeocorrencias, $config) or die(mysql_error());
$row_listadeocorrencias = mysql_fetch_assoc($listadeocorrencias);
if (isset($_GET['totalRows_listadeocorrencias'])) {
$totalRows_listadeocorrencias = $_GET['totalRows_listadeocorrencias'];
} else {
$all_listadeocorrencias = mysql_query($query_listadeocorrencias);
$totalRows_listadeocorrencias = mysql_num_rows($all_listadeocorrencias);
}
$totalPages_listadeocorrencias = ceil($totalRows_listadeocorrencias/$maxRows_listadeocorrencias)-1;
?><!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>
</head>
<body>
<form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
<table align="center">
<tr valign="baseline">
<td nowrap="nowrap" align="right">Nome:</td>
<td><input type="text" name="nome" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Email:</td>
<td><input type="text" name="email" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right" valign="top">Mensagem:</td>
<td><textarea name="mensagem" cols="50" rows="5"></textarea>
</td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right"> </td>
<td><input type="submit" value="Enviar" /></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1" />
</form>
<p> </p>
<p align="center"> </p>
<table width="600" border="0" align="center">
<tr>
<td>Nome:</td>
<td><?php echo $row_listadeocorrencias['nome']; ?></td>
</tr>
<tr>
<td>Email:</td>
<td><?php echo $row_listadeocorrencias['email']; ?></td>
</tr>
<tr>
<td>Mensagem:</td>
<td><?php echo $row_listadeocorrencias['mensagem']; ?></td>
</tr>
</table>
<p align="center"> </p>
</body>
</html>
<?php
mysql_free_result($listadeocorrencias);
?>
Poder até ser dúvida de alguém.
Aguardo ajudas.
Abraço.
Carregando comentários...