karlosantana 0 Report post Posted February 16, 2010 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 advanceKyle Share this post Link to post Share on other sites
karlosantana 0 Report post Posted February 17, 2010 *UPDATE*I have now made it easier to see what I mean, a link to the site can be found HERE and you can take a look at the code HERE. You may have noticed I've added $_POST in the dump_data file. I was trying another way of skinning this cat!Thanks againKyle Share this post Link to post Share on other sites
karlosantana 0 Report post Posted February 17, 2010 Ok download wont work attached insteadclass.sql2csv.zip Share this post Link to post Share on other sites
Soviet Rathe 1 Report post Posted March 16, 2010 (edited) If you're still having problems try this: <?php//log into the database$dbhost = 'localhost';$dbuser = 'username';$dbpass = 'password';$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');$dbname = 'dbname';mysql_select_db($dbname);// get the sql info$query = mysql_query("SELECT `date`,`date2` FROM `dbtable` WHERE `id`=" . mysql_real_escape_string . " LIMIT 1");//then you need to get the result into an array$result = mysql_fetch_assoc($query);?>Then to show the result:{$result['date']}{$result['date2']}Hope that works. Edited March 16, 2010 by Soviet Rathe (see edit history) Share this post Link to post Share on other sites