Need your help as Im badly stuck here. I have MySQL database and HTML form.I can connect to my database through that form without any problem. All my buttons (FIND, DELETE, UPDATE and ADD) also work perfectly.Now I decided to add PRINT button which suppose to export retrieved data to an xml file(that will be converted to pdf file later but I know how to deal with that). Any idea how or where to start??? Is there some php function I can use?
I actually resolved that issue by creating function for my PRINT button and then calling that function later. All working perfectly.
function printRecords($query){
global $ID, $Name, $Address,$Country, $Ph_number;
$result = mysql_query($query);
$resultCount = mysql_num_rows($result);
$query= 'SELECT ID, Name, Address , Country, Ph_number FROM people';
$fp= @fopen ("somefile.xml","w")or
die ("Could not open file");
$data = "";
for ($r=0; $r<$resultCount; $r++) {
$rec = mysql_fetch_assoc($result);
$data = sprintf("<Name>%s</Name>\r\n<Address>%s</Address>\r\n
<Ph_number>%s</Ph_number>\r\n"
$rec['Name'], $rec['Address'], $rec['Ph_number'] );
fwrite($fp, $data);
}
@fclose($fp);
return($resultCount);
}