Moderators: Derry, Goldie, Harpo
Go
New
Find
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
Junior Mechanic
Posted
Hello,

I have been using site spinner for the past several years and have recently begun doing some work that requires a little bit of work outside of my comfort zone. I am not versed in PHP or MySQL much at all other than to run a query in myphpadmin or change some info in some code that is provided to me. The situation I have is several forms that are dumping into DB's and I need for the customer to be able to click on an icon and get the query results in either EXCEL CSV, PDF, or simple HTML preview (basic dashboard of operations availabel). Currently I have to do the query and email results and would like to automate this as simple as possible as to not confuse the customer. If I need to purchase an additional software item to help in this automation I have no problem with that but have spent the last 6 hours trying to find something that is easily explained and understandable. Any help or suggestions are GREATLY APPRECIATED.
Thank you in advance.
 
Posts: 6 | Registered: June 10, 2009Reply With QuoteEdit or Delete MessageReport This Post
Guru 'Geezer' Mechanic
Picture of larryd
Posted Hide Post
I'm not sure from your post how experienced in PHP you have become. If you can handle some basic coding, then go to http://www.phpclasses.org/ and search for mysql report generator. This should list several php scripts that may help you. You will need to register (free) in order to download.

Feel free to contact me via e-mail for additional assistance. My email address is in my public profile.
 
Posts: 5064 | Registered: December 03, 2006Reply With QuoteEdit or Delete MessageReport This Post
Junior Mechanic
Posted Hide Post
Hi Larry,

Thank you very much. I am sifting through the site now. I'm definately no PHP expert by any stretch of the imagination (more like PHP challenged)! I had been using a subscription service for my online surveys where they provided the code for the form and then a dashboard where I could pull reports. Basically a preview link that hoovered the report in a non-saveable window and then an Export to Excel feature that saved it in Excel CSV.
After exploring the PHPmyAdmin I see there is output available for PDF so I am just trying to emulate what the form service had given me for one of my customers adding the additional PDF option. I tried pulling the code from the page on the form service but unfortunately again it's just not registering how I can duplicate it for my own use as that appears to have some JAVA in it also. Not as easy as I had thought!
Kyle
 
Posts: 6 | Registered: June 10, 2009Reply With QuoteEdit or Delete MessageReport This Post
Honorary Mechanic
Picture of Kirk
Posted Hide Post
Not sure if this is exactly what you're looking for, but I use a modified version to allow selected individuals to grab a MySQL table and display or save it in Excel format.

When I was looking for something, I did a google search on "mysql to excel scripts" and came up with quite a few hits. For me, this one I use was the easiest to implement and understand.
 
Posts: 209 | Registered: July 22, 2007Reply With QuoteEdit or Delete MessageReport This Post
Junior Mechanic
Posted Hide Post
Hello Kirk/Larry,

Kirk I used the code you had suggested and I seem to have reached a point where I'm not sure what's holding me up. I'm getting some result on my screen but not opting to D/L or save the file. Can I set this code to execute on the clicking of a link? Can one of you check the code below to see what I'm missing? I've not included my connection info for fear of my DB being hijacked. I will be more than happy to send it to one of you in email if need be.
This is where I'm testing this currently so you can see the output I'm seeing:
http://www.nailartcosalon.com/dbtest.php

Thanks for any help you can provide.

// Get data records from table. 
$result=mysql_query("select * from email_list order by id asc");

// Functions for export to excel.
function xlsBOF() { 
echo pack("ssssss", 0x809, 0x8, 0x0, 0x10, 0x0, 0x0); 
return; 
} 
function xlsEOF() { 
echo pack("ss", 0x0A, 0x00); 
return; 
} 
function xlsWriteNumber($Row, $Col, $Value) { 
echo pack("sssss", 0x203, 14, $Row, $Col, 0x0); 
echo pack("d", $Value); 
return; 
} 
function xlsWriteLabel($Row, $Col, $Value ) { 
$L = strlen($Value); 
echo pack("ssssss", 0x204, 8 + $L, $Row, $Col, 0x0, $L); 
echo $Value; 
return; 
} 

xlsBOF();

/*
Make a top line on your excel sheet at line 1 (starting at 0).
The first number is the row number and the second number is the column, both are start at '0'
*/

xlsWriteLabel(0,0,"Email List");
// Make column labels. (at line 3)
xlsWriteLabel(2,1,"Nail Art");
$xlsRow = 3;
// Put data records from mysql by while loop.
while($row=mysql_fetch_array($result)){

xlsWriteNumber($xlsRow,0,$row['id']);
xlsWriteLabel($xlsRow,1,$row['name']);

$xlsRow++;
} 
xlsEOF();
exit();
?>  
 
Posts: 6 | Registered: June 10, 2009Reply With QuoteEdit or Delete MessageReport This Post
  Powered by Eve Community  
 


™ & © 1998 - 2008, Virtual Mechanics Inc. All rights reserved.