-Z3R0- 0 Denunciar post Postado Outubro 27, 2011 Primeiramente boa noite ! vim aqui para compartilhar o meu problema :D primeiro vem o codigo depois falo o problema :S INDEX.PHP <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>gURL</title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script> $(document).ready(function(){ $('#content_gURL').load('include/get_gURL.php'); }); </script> </head> <body> <div id="load"> <center> <img src="img/load.gif" alt=""/> </center> </div> <?php session_start(); $gURL_id = strip_tags(addslashes(htmlentities($_GET['gURL']))); $_SESSION['gURL_id'] = $gURL_id; echo $_SESSION['gURL_id']; ?> <div id="content_gURL"> </div> </body> </html> MYSQL.PHP <?php class Mysql{ public $connect; public $select_DB; public $close; function __construct(){ $this->connect = mysql_connect('dbmy0043.whservidor.com','mundohtml_4','ghaa3152')or die(mysql_error); $this->select_DB = mysql_select_db('mundohtml_4')or die(mysql_error); } function verifica(){ if($this->connect = false or $this->select_DB = false or $this->close = false or $this->get_slider = false){ exit('Site Fora do Ar, aguarde alguns instantes ate que resolvermos o problema.'); } } function __destruct(){ $this->close = mysql_close(); } } $Mysql = new Mysql(); $Mysql->verifica(); ?> GET_GURL.PHP <?php include_once('../mysql.php'); $gURL = mysql_query("SELECT * FROM gurl WHERE id=".$_SESSION['gURL_id']) or die(mysql_error()); while($data_gURL = mysql_fetch_array($gURL)){ ?> <div id="gURL"><b><?php echo $data_gURL['url'];?></b></div> <?php } ?> O problema é que n retorna o link, quando eu especifico o id logo no $gURL ele vai direitinho0 mas quando pessoa para pegar por session ai n vai :S da esse erro : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 como se ele n conseguice recuperar* a variavel :S alguem se propõe a ajudar ? Compartilhar este post Link para o post Compartilhar em outros sites
Kakashi_Hatake 267 Denunciar post Postado Outubro 27, 2011 Faltou o session_start( ); no arquivo GET_GURL.PHP Compartilhar este post Link para o post Compartilhar em outros sites
-Z3R0- 0 Denunciar post Postado Outubro 27, 2011 Obrigado manow ! eu penssei que já estava incluido na index.php não precisaria da o session_start();, agora so falta eu fazer isso com OOP ( ainda meio complicado :S ) Compartilhar este post Link para o post Compartilhar em outros sites