0

Dear All,
I am currently working on an assignment.
I am having one error with this php file but I cannot figure out the problem.
Can you please help.

Fatal error: Function name must be a string in C:\xampp\htdocs\idareyou\searchUser.php on line 2

<?php
	$fme=$_GET('search_fname');
	$lme=$_GET('search_lname');
	
	$con=mysql_connect("localhost","root","");
	if(!$con){die("could not connect".mysql_error());}
	mysql_select_db("idareyou",$con);
	echo("dbconnect is working");

	//include('dbConnect.php');
	mysql_select_db("idareyou",$con);
	//echo "<br/>line just after include dbconnect";	
	//echo $fname;
	
	//$sql="SELECT fname,lname,email FROM user WHERE fname=$fname AND lname=$lname";
	$result=mysql_query("SELECT fname,lname,email FROM user WHERE fname='$fname' AND lname='$lname' ");
	//$result=mysql_query( "SELECT fname,lname,email FROM user WHERE".'"'.fname.'"'.=.'"'.$fname.'"');

	$numRows=mysql_num_rows($result);//echo $numRows;
	if($numRows<1){
		mysql_close($con);
		echo "No result found";
	}
	 header('Content-Type: text/xml');
 $xml_name = '<?xml version="1.0" encoding="ISO-8859-1"?>';
 $xml_name = $xml_name."<Nom>" ;

	while($rows=mysql_fetch_array($result) ){
		$xml_name=$xml_name."<Name>";
		$xml_name=$xml_name."<fname>".$rows["fname"]."</fname>";
		$xml_name=$xml_name."<lname>".$rows["lname"]."</lname>";
		$xml_name=$xml_name."<email>".$rows['email']."</email>";
		$xml_name=$xml_name."</Name>";
	}
	$xml_name=$xml_name."</Nom>";
	echo $xml_name;
	
	mysql_close($con);
?>
3
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by avinash_545
0

$_GET requires brackets [], not parenthesis (). It is an array, not a function.

Edited by pritaeas: n/a

0

Hello Dear,

$_GET is having a error in its parenthesis.Use $_GET fucntion like this

Welcome <?php echo $_GET["fname"]; ?>.<br />
You are <?php echo $_GET["age"]; ?> years old!
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.