Jump to content

HexCoder

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

HexCoder's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. hi guys ... i try to write simple ajax code to send data to other form and return data! please payattantion to my code and say whats problem... TanQ this is my ajax code to send data: <html> <head> <script type="text/javascript" language="javascript" > var pageurl="index.php?code="; var httpreq=gethttp(); function answer(){ if (httpreq.readyState==4){ var r=httpreq.responseText; document.getElementById("ttext").value=r; } } function sendandrecive() { var code=document.getElementById("userinfo").value; httpreq.open("GET",pageurl+code,true); httpreq.onreadystatechange=answer; httpreq.send(null); } function gethttp(){ var xmlhttp; if (window.XMLHttpRequest){ xmlhttp=new XMLHttpRequest(); }else{ xmlhttp=new ActivXObject("Microsoft.XMLHTTP"); } return xmlhttp; } </script> </head> <body> <input type="text" name="userinfo"/><br/> <input type="button" value="Submit" onclick="sendandrecive();" /><br/> <input type="text" name="ttext" /> </body> </html> and my php code to analyze requests and return simple data: <?php $p=$_GET["code"]; if ($p=="hexcoder"){ echo "your name is HexCoder!"; }else{ echo "no, try again!"; } ?>
  2. i remove $ and get new error : Fatal error: Call to undefined method DBconnector::query() in C:\xampp\htdocs\cms-project\index.php on line 5 and this is my index.php code : <?php require_once('include/DBconnector.php'); $connectdb=new DBconnector(); $result=$connectdb->query("SELECT username FROM userinfo"); $row=$connectdb->fetchquery($result); echo $row['username']; ?>
  3. hello every one... when in want to run my php code i get somthings like this error : Fatal error: Cannot access empty property in C:\xampp\htdocs\cms-project\include\DBconnector.php on line 14 and my DBconnector.php file code is this : <?php //dbconnector class require_once 'systemcomponents.php'; class DBconnector extends systemcomponents{ var $link; var $thisquery; function DBconnector(){ $settings= systemcomponents::getsettings(); $dbname=$settings['dbname']; $hostname=$settings['dbhost']; $dbusername=$settings['dbusername']; $dbpass=$settings['dbpassword']; //connect to data base $this->$link=mysql_connect($hostname,$dbusername,$dbpass); mysql_select_db($dbname); register_shutdown_function(array(&$this,'close')); function query($query){ $this->$thisquery=$query; return mysql_query($query,$this->$link); } function fetchquery($queryresult){ return mysql_fetch_array($queryresult); } function close(){ mysql_close($this->$link); } } } ?> please help me to resolve problem.. TanQ
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.