Ir para conteúdo
Fórum Script Brasil

Shirleyson

Membros
  • Total de itens

    2
  • Registro em

  • Última visita

Sobre Shirleyson

Shirleyson's Achievements

0

Reputação

  1. Muito obrigado pela dica, Realmente o DreamWeaver facilita muito porem não se aprende nada hehe,
  2. Olá pessoal tudo bom? espero que sim, Eu estou tentando desenvolver um pequeno script de protetor de link, Após a pessoa inserir o link ele deve retornar o id do link cadastrado na mesma tela. Minha dificuldade está sendo em trazer de volta o id que acaba de ser cadastrado, Tentei criar um recordset e pra ele buscar pelo link cadastrado e retornar o id mais não funcionou muito bem, Será que alguém poderia me ajudar? Eis o que já criei <?php require_once('Connections/mysql.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 link (link_id, link_url) VALUES (%s, %s)", GetSQLValueString($_POST['link_id'], "int"), GetSQLValueString($_POST['link_url'], "text")); mysql_select_db($database_mysql, $mysql); $Result1 = mysql_query($insertSQL, $mysql) or die(mysql_error()); $insertGoTo = "index.php?protegido=true"; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); } $colname_resultado = "-1"; if (isset($_POST['FORM.link_url'])) { $colname_resultado = $_POST['FORM.link_url']; } mysql_select_db($database_mysql, $mysql); $query_resultado = sprintf("SELECT * FROM link WHERE link_url = %s", GetSQLValueString($colname_resultado, "text")); $resultado = mysql_query($query_resultado, $mysql) or die(mysql_error()); $row_resultado = mysql_fetch_assoc($resultado); $totalRows_resultado = mysql_num_rows($resultado); ?><!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>Super Protetor</title> </head> <body> <table width="900" border="0" align="center" bgcolor="#FFFFFF"> <tr> <td><h1 align="center">Super Protetor</h1></td> </tr> <tr> <td><div align="center"> <form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1"> <table align="center"> <tr valign="baseline"> <td width="154" align="right" nowrap="nowrap">Link que deseja proteger:</td> <td width="314"><input type="text" name="link_url" value="" size="40" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right"> </td> <td> <div align="center"> <input type="submit" value="Proteger Link" /> </div></td> </tr> </table> <input type="hidden" name="link_id" value="" /> <input type="hidden" name="MM_insert" value="form1" /> </form> </div></td> </tr> <tr> <?php if(isset($_GET["protegido])) { ?> <td>id do seu link é: <?php echo $row_resultado['link_id']; ?></td><?php } ?> </tr> </table> </body> </html> <?php mysql_free_result($resultado); ?> TENTEI POR DENTRO DO CODEBOX DO FORUM MAIS TAVA DANDO ERRO... DIZENDO QUE não EXISTIA UAHSUHAS oBRIGADO A TODOS QUE TENTAREM AJUDAR.
×
×
  • Criar Novo...