HOME       >>       Websites and Web Designing

PHP and SQL calling table value issue Im Stuck Again


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


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 again


Ok download wont work attached insteadclass.sql2csv.zip

Soviet Rathe

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:
Hope that works.


Xisto.com offers Free Web Hosting to its Members for their participation in this Community. We moderate all content posted here but we cannot warrant full correctness of all content. While using this site, you agree to have read and accepted our terms of use, cookie and privacy policy. Copyright 2001-2019 by Xisto Corporation. All Rights Reserved.