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);
?>

Recommended Answers

All 3 Replies

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

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!

thanks again.
it worked !!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.