Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
BOAA GALERA, ALGUÉM ME AJUDA O BOTÃO DO JOINHA NÃO FUNCIONA VOU POSTAR INDEX.PHP \/ >{<?php require_once('Connections/conex.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. }
} $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 teste (noticia, autor) VALUES (%s, %s)", GetSQLValueString($_POST['noticia'], "text"), GetSQLValueString($_POST['autor'], "text")). mysql_select_db($database_conex, $conex). $Result1 = mysql_query($insertSQL, $conex) or die(mysql_error()). $insertGoTo = "noticia.php". if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo.= (strpos($insertGoTo, '?'))? "&": "?". $insertGoTo.= $_SERVER['QUERY_STRING']. } header(sprintf("Location: %s", $insertGoTo)). }?>
<!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">](http://www.w3.org/1999/xhtml) <head>
<meta http-equiv="Content-Type" content="text/html. charset=utf-8" />
<title>Documento sin título</title> </head> <body> <p> </p>
<form action="<?php echo $editFormAction.?>" method="post" name="form1" id="form1"> <table align="center"> <tr valign="baseline"> <td nowrap="nowrap" align="right">Noticia:</td> <td><textarea name="noticia" cols="32"></textarea></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right">Autor:</td> <td><input type="text" name="autor" value="" size="32" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right"> </td> <td><input type="submit" value="Insertar registro" /></td> </tr> </table> <input type="hidden" name="MM_insert" value="form1" />
</form>
<p> </p>
</body>
</html> agr NOTICIA.PHP \/ > <?php require_once('Connections/conex.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_conex, $conex). $query_Recordset1 = "SELECT noticia, autor, bom, ruim FROM teste". $Recordset1 = mysql_query($query_Recordset1, $conex) or die(mysql_error()). $row_Recordset1 = mysql_fetch_assoc($Recordset1). $totalRows_Recordset1 = mysql_num_rows($Recordset1).?>
<!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">](http://www.w3.org/1999/xhtml) <head>
<meta http-equiv="Content-Type" content="text/html. charset=utf-8" />
<title>Documento sin título</title>
<script type="text/javascript" language="javascript" src="js/jquery.js"></script> <script type="text/javascript">
$(function($) { // Quando clicando em uma imagem da div que tem CLASS = frase $("div.frase img").click(function() { // Recupera o ID da frase que está na propriedade LANG da DIV-PAI da imagem e que tem CLASS = frase var id = $(this).parent("div.frase").attr("lang"). // Recupera o tipo (bom|ruim) que está na propriedade ALT da imagem clicada var tipo = $(this).attr("alt"). // Seleciona o SPAN onde estão os votos var votos = $("div[lang=+id+] span."+tipo+" span.valor"). // Seleciona a DIV onde serão colocadas as mensagens var status = $("div[lang=+id+] div.status"). // Mensagem de carregando status.html("<img src='imagens/loader.gif' alt='Carregando...' />"). // Faz a requisição AJAX $.post("ajax/votar.php", {id: id, tipo: tipo}, function(resposta) { // Se houver uma mensagem na resposta, exibe a mensagem if (resposta) { status.html(resposta). } // Quando a resposta for FALSE else { // Incrementa mais um aos votos votos.html(parseInt(votos.html()) + 1). // Mensagem de sucesso status.html("Obrigado por votar!"). } }). }). }). </script>
</head> <body>
<?php
// Selecionando todas as frases
$query = mysql_query("SELECT * FROM teste ORDER BY id DESC"). // Passando frase por frase
while ($frase = mysql_fetch_object($Recordset1)):
?> <div class="frase" lang="<?php echo $frase->id.?>">
<div class="texto"><?php echo $frase->texto.?></div> <table align="center" border="1"> <tr> <td width="39">notícia</td> <td width="120">autor</td> <td width="116">bom</td> <td width="220">ruim</td> </tr> <?php do {?> <tr> <td width="200" height=""><?php echo $row_Recordset1['noticia'].?></td> <td><?php echo $row_Recordset1['autor'].?></td> <td> <img src="imagens/bom.png" alt="bom" /> <span class="bom"> (<span class="valor"><?php echo $frase->bom.?></span>) </span> <?php echo $row_Recordset1['bom'].?></td> <td> <img src="imagens/ruim.png" alt="ruim" /> <span class="ruim"> (<span class="valor"><?php echo $frase->ruim.?></span>) </span> <?php echo $row_Recordset1['ruim'].?> </td> </tr> <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)).?>
</table>
<?php endwhile.?>
</body>
</html>
<?php
mysql_free_result($Recordset1).?> ALGUÉM ME AJUDA, JOINHA NÃO PEGA.. N SEI OQ FAZER ELE NÃO VOTA..Carregando comentários...