PHP - Excel To Php/html Webpage
I've already made this work, but I'm wondering if anybody has any different/better ideas.
I have an excel spreadsheet that we want to turn into a dynamically created webpage. I used excels export to a webpage, and I used yellowpipe.com to convert the source to php, so I didn't have to hand code the entire table. This works just fine. I'm currently going through the entire page to add the actual database calls. Just wondering if somebody with more experience has ever tried to do something similar? Any pros/cons, different ways to accomplish this are welcome. Similar Tutorialshi all is there anyway embedding excel or .csv files to the webpage other than the folowing two options . saving it as a webpage . using google docs i used the following code, iam getting the .csv file in the page, but it would be good to have the color formatting, bold, italics... also in the webpage. is it possible? Code: [Select] <?php $cnx = fopen("example.csv", "r"); //open example.csv echo("<table style='border:1px solid #ddd;'>"); // echo the table while (!feof ($cnx)) { // while not end of file $buffer = fgets($cnx); // get contents of file (name) as variable $values = explode(",", $buffer); //explode "," between the values within the contents echo "<tr>"; for ( $j = 0; $j < count($values); $j++ ) { // echo("<td style='border:1px solid #ddd;'>$values[$j]</td>"); } echo"</tr>"; }; echo("</table>"); fclose($cnx); //close filename variable ?> This topic has been moved to Other. http://www.phpfreaks.com/forums/index.php?topic=316401.0 This sounds like overkill, but is there any way I can take the results of an html form, and plug them into their respective cells on a excel spreadsheet? Thanks in advance! -Brad I have an excel file that has several columns with different data and I need to create a form that can upload this excel file and insert the data from the columns into its conrresponding data columns in a mysql database. I know how to create the form but I have no idea how to get the file and tell it to input each cell of data into its corresponding field in the mysql database. Does anyone know how to do this? Any help would be appreciated. Thanks, I need some help and hopefully will respond. I'm trying to put some information to the second row of the excel sheet once extracted. Can somebody help me with this script? I'm trying to move the address line to the second row. Thanks. i'm trying to get a php database to output/display on a html webpage and have no results from cutting and pasting code from online tutorials i'm saving to a file with a htm extension i believe i have the connection data right: $db_host = 'server'; $db_user = 'username'; $db_pwd = 'password'; $database = 'database'; $table = 'table'; if (!mysql_connect($server,$username,$password)) die("Can't connect to database"); if (!mysql_select_db($database)) die("Can't select database"); $result = mysql_query("SELECT * FROM table") or die(mysql_error()); Can someone please help me? send code? tell me what i'm doing wrong? Thanks Hello, i am currently getting an Microsoft Excel formatted text file whose save type is .Txt from a URL.I used to open it and will change the save type as excel file. Please suggest whether we can do this with php code. currently my code is like this, <? php copy("http://www.faa.gov/airports/airport_safety/airportdata_5010/menu/emergencyplanexport.cfm?Region=&District=&State=&County=&City=LAS%20VEGAS&Use=&Certification=","./contactsexport.xls"); ?> where as the contactsexport.xls type is .Txt which i need it in .xls Thanks in Advance. I am using a photo scrolling css animation technique
I'm not sure as far as CPU usage (on server)/(on client) and bandwith usage if loading one picture at a time to scroll versus having a line up "pre-exist" which even then, I would only have five images at a time but what if that is multiplied by 10000 users
Anyway, the current knowledge I have, I have a css animation property that takes in a photo and animates from 0% to 100% keyframe based on margins to make the scrolling happen
In the HTML section there is a list of photos, I would like there to be one line of code that is like a receiver that takes in or reads in arbitrary photo locations and puts that next to be scrolled without interrupting the main animation sequence which I'm not sure if there would be interruption. Anyway I don't know if that is possible. If someone can point out that this idea is obviously flawed then that would be great.
This isn't my ultimate solution, I have yet to see others, I'm just trying to minimize loading and lag
The other problem I have that is interesting is that I want the scrolling to stop when a person hovers over an image, and then resume... I have gotten this to work but only on one image... this is probably a matter of listing out all the key parts of the problem and seeing the solution but
When I had a list of photos that were scrolling together, I could get the whole animation to stop when hovering over the first photo and then take me somewhere (all the photos have working href's) but the animation would not stop if I hovered over any photos after the first. The animation would keep going
So I tried to animate each picture independently and that was just a cluster ****
Still working on that
If someone could point me in the right direction on the main problem of reading in photos live to work with css animation, that would be great.
Edited by greenace92, 03 December 2014 - 07:41 PM. try { echo "<br>"; foreach($dbh->query("SELECT * FROM test_shot WHERE sold=1 ORDER BY year ASC") as $row) { if($row['picture'] != "" && $row['picture'] != null) { echo "<div class='image-holder'><img src ='".$row['picture']."' width=300px /><br>"; } if($row['year'] != "" && $row['year'] != null) { echo $row['year']; } if($row['description'] != "" && $row['description'] != null) { echo $row['description']; } if($row['sold'] == 1) { echo "<img src='images/sold1.png'><br>";//Add your image code here } elseif ($row['sold'] == 0) { echo "</div><br>"; } } } catch (PDOException $e) { print $e->getMessage(); } ?>
I need a way of parsing Excel files.. both xls and xlsx in what seems to be various formats.. the concept of the way the expected sheets are to come in is with 2 tabs first tab row one column one will be a single value.. second tab will be any number of values only 2 columns though. I had found one parser class that I could use but it was very limiting and for some reason didn't work when I saved a fresh file... whats the best class, or way of handling an excel file? is there anything out there freely avaliable to work with thats kept upto date? or that works? Hi All, I am trying to export a table into excel and it is working, kind of.. I'm trying to import data that has commas in it. Unfortunately, it looks like this "PHP to CVS" process is comma delimited. How can I get around that, while having the data in the correct columns? Here is my code: Code: [Select] $file = 'Notes_Export'; $csv_output = ''; $sql = "SHOW COLUMNS FROM prop_notes WHERE Field IN ('note', 'created_by', 'created_on', 'updated_by', 'updated_on')"; $result = mysqli_query($connect, $sql); $i = 0; if (mysqli_num_rows($result) > 0) { while ($row = mysqli_fetch_assoc($result)) { $csv_output .= $row['Field'].", "; $i++; } } $csv_output .= "\n"; $sql = "SELECT note, created_by, created_on, updated_by, updated_on FROM prop_notes"; $values = mysqli_query($connect, $sql); while($rowr = mysqli_fetch_row($values)) { for ($j=0;$j<$i;$j++) { $csv_output .= $rowr[$j].", "; } $csv_output .= "\n"; } $filename = $file."_".date("Y-m-d_H-i",time()); header("Content-type: application/vnd.ms-excel"); header("Content-disposition: csv" . date("Y-m-d") . ".csv"); // header( "Content-disposition: filename=".$filename.".csv"); header("Content-disposition: attachment; filename=".$filename.".csv"); print $csv_output; exit; Hi I have a script which references a DB and then produces an XML output saved as XLS to then open in Excel. This works an absolute dream in my dev environment using IE7 and in live using Firefox. However my entire audience uses IE7 and this is where it breaks in the live environment. For some reason, I cannot get the download to work. I get a windows pop-up with an error on it - see attached. If you need to see code, let me know which bit of code could possibly cause this, i.e. headers etc. I've not posted code as there's loads of it and I can't understand why it works in dev in IE 7 but not in live, and works in Firefox in live. I need to parse xls files (Microsoft Excel). The option to tell the users who will be uploading the files to convert it to a more friendly format like XML or CSV is not an option (I know its unfortunately, though I have to make it so it parses those formats as well (fun is)). Users must be able to just save the file, and upload it as is. below is a link to a example xls file. So I am looking to see if there's anything native to php that will allow me to open and read xls formatted files quickly and efficiently and work with the values independently on a per row per column basis when outputting them. Or if there's a recommended library/class I can use that someone here can suggest. My biggest issue is I am on a time crunch so I need something I can work with quickly and efficiently all around. Any samples would be greatly appreciated. http://mtpdev.com/dev/xls-reader/sample.xls Hi I have a database set up using MySQL and want to be able to query this and then export to Excel using PHP. I've had a look around on the web but a lot of what I'm reading is going over my head. I don't have PEAR so can't use the ready made stuff. Basically, I want to be able to query the database, then export the arrays to an excel file and a pop up to appear asking the user to open / save / cancel (standard pop-up) Anyone know of any good places to start looking for the information for this? Sorry, I'm new to all this so any help / pointers would be greatly appreciated. Cheers This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=345846.0 Hi. I have a large amount of data in an excel spread sheet. I have isolated 3 rows containing a date (yyyy-mm-dd plus two decimal values). I saved this as a tab delimited text instead of a comma separated csv. What I want to do is read each line of a text file and split it up into 3 and construct an INSERT INTO sql. the problem is this is not separated by comas for a split function. Can I split on a tab instead? I have used commas in the past only. TIA Desmond.
ok, so I am not good with arrays, they confuse me. how can I set this up so that $data is all results that are returned from the database that correspond to it? Code: [Select] $data = array( array("firstname" => '$firstname', "lastname" => '$lastname', "age" => '$age')); the original code looked like: Code: [Select] <?PHP $data = array( array("firstname" => "Mary", "lastname" => "Johnson", "age" => 25), array("firstname" => "Amanda", "lastname" => "Miller", "age" => 18), array("firstname" => "James", "lastname" => "Brown", "age" => 31), array("firstname" => "Patricia", "lastname" => "Williams", "age" => 7), array("firstname" => "Michael", "lastname" => "Davis", "age" => 43), array("firstname" => "Sarah", "lastname" => "Miller", "age" => 24), array("firstname" => "Patrick", "lastname" => "Miller", "age" => 27) ); ?> but that won't do it for me. I need it so that the results from the database will automatically be filled in. basically, everyone that is in the database, so when a new member is added, they will show up too. please help I have an excel file with many rows and columns but depending on the user I need it to show only one row. I am a php newbie. Hi people. Need some help if anyone could give a hand! I'm currently trying to incorporate an export to Excel feature on search returns on my web page. Here is how my searches are returned, so what I want now is when the user clicks on the 'Export to Excel' button it downloads the search results and opens it in the same format in Excel. I've tried using http://phpexcel.codeplex.com/ but can't understand how to use it properly, does anyone have any suggestions? I don't have any code written for the Export to Excel yet as it's just a submit button. How I see it in my head is the user clicks the button, it goes to a new page and performs a new query then downloads that but I don't no if thats right or not. Hi I have a page displaying orders from a mysql table. How can i add a button which exports this to an excel file? |