karlosantana
Members-
Content Count
145 -
Joined
-
Last visited
About karlosantana
-
Rank
Advanced Member
- Birthday 03/06/1992
Profile Information
-
Gender
Male
-
Location
Wales(But I'm not a welsh farmer!)
-
Multiple Includes Including 2 PHP files
karlosantana replied to karlosantana's topic in Websites and Web Designing
Sorted! Changed the page container to minimum height of 100%, set footer value to relative....Sorted it! -
Multiple Includes Including 2 PHP files
karlosantana replied to karlosantana's topic in Websites and Web Designing
Anybody? Still Stuck! -
Hello all, once again I'm stuck. I'm designing a website again where a page (index.php) will use 2 PHP include files they are: Header.php Footer.php Now whats happening is instead of footer.php being at the bottom of index.phpit's appearing top of the screen but at the bottom of header.php if that makes sense. I have quoted part of the CSS sheet below which I think is the problem. These are bothe included in the <head></head> section of index.php Please help me! .footer{ position:absolute; width:100%; height:100px; background-image:url('images/foot.png'); bottom: 0px;}Thanks in advanceKyle
-
I have no idea why the heck I'm struggling with this, I'm usually the one giving the help for this sort of thing! Anyway here goes: It's my date comparison script again, I've added the abbility to select "from" and "to" using THIS script I've made the code below <?php require_once 'class.sql2csv.php'; $params = array( 'host' => 'localhost', 'user' => 'root', 'password' => '', 'database' => 'database_name' ); $query = "SELECT * FROM form_data WHERE (sd >='_$date') and (sd < '_$date2')"; new SQL2CSV($params, $query);?> Now what's happening is: it'll pick up "date2" but not "date" and I have no idea what the heck is going on! I've tried all that I know to try and get it right, I'm still confusled! I'm left in your capable hands, thanks in advance Kyle
-
Well if you look here. You will see I have been working on a script to suck all the information from an sql database to Excel. I've had a problem in that I cant select data just from a certain date. I have copied the code I'm using below. It consits of three files class.sql2csv.php $FILENAME = 'exceptions.csv'; // connect to MySQL database $link = mysql_connect($params['host'], $params['user'], $params['password']) or die(mysql_error()); // start using the required database $db = mysql_select_db($params['database'], $link); // execute query to get the data required $res = mysql_query($query, $link) or die(mysql_error()); $colnames = array(); // get column captions and enclose them in doublequotes (") if $print_captions is not set to false if ($print_captions) { for ($i = 0; $i < mysql_num_fields($res); $i++) { $fld = mysql_fetch_field($res, $i); $colnames[] = '"'.$fld->name.'"'; } // insert column captions at the beginning of .csv file $CSV .= implode(",", $colnames); } // iterate through each row // replace single double-quotes with double double-quotes // and add values to .csv file contents if (mysql_num_rows($res) > 0) { while ($row = mysql_fetch_array($res, MYSQL_NUM)) { for ($i = 0; $i < sizeof($row); $i++) $row[$i] = '"'.str_replace('"', '""', $row[$i]).'"'; $CSV .= "\n".implode(",", $row); } } // send output to browser as attachment (force to download file header('Expires linenums:0'><?php class SQL2CSV { // initialize the class with passed parameters function SQL2CSV($params, $query, $print_captions = true) { // set initial .csv file contents $CSV = ''; $FILENAME = 'exceptions.csv'; // connect to MySQL database $link = mysql_connect($params['host'], $params['user'], $params['password']) or die(mysql_error()); // start using the required database $db = mysql_select_db($params['database'], $link); // execute query to get the data required $res = mysql_query($query, $link) or die(mysql_error()); $colnames = array(); // get column captions and enclose them in doublequotes (") if $print_captions is not set to false if ($print_captions) { for ($i = 0; $i < mysql_num_fields($res); $i++) { $fld = mysql_fetch_field($res, $i); $colnames[] = '"'.$fld->name.'"'; } // insert column captions at the beginning of .csv file $CSV .= implode(",", $colnames); } // iterate through each row // replace single double-quotes with double double-quotes // and add values to .csv file contents if (mysql_num_rows($res) > 0) { while ($row = mysql_fetch_array($res, MYSQL_NUM)) { for ($i = 0; $i < sizeof($row); $i++) $row[$i] = '"'.str_replace('"', '""', $row[$i]).'"'; $CSV .= "\n".implode(",", $row); } } // send output to browser as attachment (force to download file header('Expires: Mon, 1 Jan 1990 00:00:00 GMT'); header('Last-Modified: '.gmdate("D,d M Y H:i:s").' GMT'); header('Pragma: no-cache'); header('Content-type: text/csv'); header('Content-Disposition: attachment; filename='.$FILENAME); // print the final contents of .csv file print $CSV; } }?> Next is the page that does everything dump_data.php <?php require_once 'class.sql2csv.php'; $params = array( 'host' => 'sql113.000space.com', 'user' => 'space_5045542', 'password' => '********', 'database' => 'space_5045542_exceptions' ); $query = 'SELECT * FROM Data'; new SQL2CSV($params, $query);?> Then the button to tell everything to initialize <body> <a href="dump_data.php">Dump table contents</a></body> This will dump all the data from an SQL table onto a CSV which I then open in excel. However as I mentioned I need it to be able to recognize the date stamps from an SQL database, which are there already, but i need to be able to have a few buttons one for yesterday and today, or is there a way to select from one date to the other?. Either way can someone help me edit the above code to my need please? I'm getting a bit frustrated and I cant work out what I'm doing wrong! (I've tried loads of stuff!) Cheers Kyle Notice from rvalkass: Removed your password from the code!
-
Php Screipt To Export Sql To Excel
karlosantana replied to karlosantana's topic in Websites and Web Designing
Yep it's in the database . Without sounding really cheaky is there a tutotial you can point me in the direction of or a code that you know?Thanks in advanceKyle -
Php Screipt To Export Sql To Excel
karlosantana replied to karlosantana's topic in Websites and Web Designing
Mate you are the man! It worked I built it and it's awsum! Is there a way that I could filter it out through timestamp? So It'd only show todays submissions?Your still amazing! Thanks againKyle -
Php Screipt To Export Sql To Excel
karlosantana replied to karlosantana's topic in Websites and Web Designing
The only problem wiuth that is when it's opened will it be opened as a spreadsheet or one long line? Or does excel deal with all that? If it does, we're in business Where could I find a script that'll do that, that I can add as a simple button from an Admin area as explained in my last post? -
Hi guys title says everything really, googled it none of the scripts work, tried doing my own and I suck too! I'm running a local server using wampp. Basically it's a phone book I need an "admin" page where the user can go and export all contacts to excel spreadsheet. I'm sure I'm just being the idiot I usually am and am missing something very simple. Surely there is a simple script to do that???CheersKyle
-
A Sort Of Mini Search Engine Once again Im stuck
karlosantana replied to karlosantana's topic in Websites and Web Designing
Ok guys I have 3 days of this then I have to remove it . Attatched is the "Call Tool". Test it, to demonstrate put 320 or 370 in Franchise ID. Basically I need to make a HTML version of it you can see the spreadsheet reads from a saperate spreadsheet to give the answer.I hope that helps *attachment removed as per request* -
A Sort Of Mini Search Engine Once again Im stuck
karlosantana replied to karlosantana's topic in Websites and Web Designing
Ye I deffo need to get that excel sheet to you :)Ok guys give me tomorrow, and I'll grab itCheers