Dear All,
I am currently working on a web assignment.
But I do not know what is wrong with this ^piece of code.
Can anyone of you find the bug in it please
;
<?
$con=mysql_connect("localhost","root","");
if(!$con){die("could not connect".mysql_error());}
mysql_select_db("idareyou",$con);
echo("dbconnect is working");
$fname=a;//$_GET('search_fname');echo $fname;
$lname=a;//$_GET('search_lname');
// include("dbConnect.php");
echo "blaljfkdjfjdfk";
echo $fname;
$sql="SELECT fname,lname,email FROM user WHERE fname=$fname AND lname=$lname";
$result=mysql_query($sql);
if(mysql_num_rows($result)<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);
?>
<html>
<body>
<? echo $fname; echo $lname; >
</body>
</html>