please solve this small problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
anciwasim
Forum Newbie
Posts: 3
Joined: Tue Feb 20, 2007 7:24 am

please solve this small problem

Post by anciwasim »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


hello all,
i m trying to implementing a small php application ,which use Ajax for data retriving form the server..but it giving a problem and i not able to find the bug.so can you please...identify the problem ,and wat is the solution for that.
i have 3 files 1 st for ajax code,2 nd for dataconnection code,3rd for display page.
Ajax code.=====AX.JS
[syntax="javascript"]// JavaScript Document
function ajaxFunction(){
	var ajaxRequest;  // The variable that makes Ajax possible!
	alert("wasim");
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			alert(ajaxRequest.responseText);
			
			var res= ajaxRequest.responseText;
			document.getElementById('msgbox').innerHTML=res;
//			document.form1.
		}
	}
	ajaxRequest.open("GET", "connect.php", true);
	ajaxRequest.send(null); 
}
===========================
2 nd file....index.php
================

Code: Select all

<script language="javascript1.5" >


function addOption()
{
	var optn = document.createElement("OPTION");
	optn.text = "wasim";
	optn.value = "wasim";
	document.form1.selectid.options.add(optn);
}
</script>
<html>
<head>
	<script src="ax.js"></script>
</head>
<body >
		<div id="msgbox"> DataComes here</div>
		<hr color="#999900" size="100%">
		<span id="spanselect">
		<form id="form1" name="form1" method="get">
		<select id="selectid" name="selectid">
		<option  id="selectoptid" value="1">1</option>
		</select>
			<input type="button" value="Click here to add option" onClick="ajaxFunction();">
		</form>
		</span>
		
</body>
</html>
===================
3rd file connect.php.
=================
<!--This classes wrriten by shaikh wasim and use to connect database;-->[/syntax]

Code: Select all

<?php
class Mysql
{
var	$link;
		function Mysql($host,$username,$database)
		{
			print "<h1>Host connected</h1>";
			$link=mysql_connect($host,$username) or die(mysql_error());
			mysql_select_db($database,$this->$link);
		}
		function query($sqlquery)
		{
			$result=mysql_query($sqlquery,$this->$link);
			return $result;
		}
}

$dbconnect=new Mysql("localhost","root","drkapil");

?>
//==================
then..please solve it


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:2. Use descriptive subjects when you start a new thread. Vague titles such as "Help!", "Why?" are misleading and keep you from receiving an answer to your question.
It would help to have a description of the problem you are having, what is happening and what you are expecting.

What have you done to find the bug?
anciwasim
Forum Newbie
Posts: 3
Joined: Tue Feb 20, 2007 7:24 am

is it possible to create grid.in php with connected

Post by anciwasim »

is possible to create a grid control in java script and that will be direct connect with mysql using php,and control also allow to direct editing facility.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

javascript runs client-side, php server-side.
You might be looking for http://en.wikipedia.org/wiki/Ajax_%28programming%29
Post Reply