Jump to content

developerdave

Members
  • Posts

    95
  • Joined

  • Last visited

    Never

Everything posted by developerdave

  1. Wow, is it just me or have the moderators got a lot more rude than they used to be? Anyways, I did say that the data set I'm getting returned is completely out of the range I have specified in the query, I tried taking out my order by before as I thought the same but it didn't make the slightest bit of difference. I have just stripped down my query and I've managed to get it selecting the right data set (nearly) This is what I've ended up with so I will have to check the rest of my query. SELECT * FROM `main_table` WHERE ( `date_one` BETWEEN CURDATE() AND DATE_ADD(CURDATE(), INTERVAL 90 DAY) OR `date_two` BETWEEN CURDATE() AND DATE_ADD(CURDATE(), INTERVAL 90 DAY) ) Thanks
  2. So I'm having a bit of an issue with a query I'm writing, my table has 2 colulmns with date types and I'm trying to select where either of these dates are between now and 90 days ahead (3 months) but I'm having an issue where it seems to be selecting between now and 2 years ahead. below is my query SELECT * FROM `main_table` WHERE `e_archive` != 1 AND (`date_one` BETWEEN CURDATE() AND DATE_ADD(CURDATE(), INTERVAL 90 DAY) OR (`date_two` BETWEEN CURDATE() AND DATE_ADD(CURDATE(), INTERVAL 90 DAY))) ORDER BY `date_one` ASC The issue is around the OR statement between the 2 BETWEEN queries, if I change it to and I get the right dates but the wrong data returned obviously. Any help is greatly appreciated guys, Dave
  3. Ooops my bad, this was simple :s Basically (just to explain) the function assigning the variable is member of a class which is instantiated by another class and returned (for method chaining) and this seemed like a good feature to have so the method chaining wasn't made redundant by having to separate lines for variable assignment. I set the inner class to accept by reference but not the controller All fixed now Thanks anyways guys
  4. Well i've scoured the PHP.net documentation and Google'd this thoroughly and can't find anything, which suggests it is impossible but I thought I should get a collective opinion on it. So we all know what preg_match() is, its third argument (in most examples is $matches) becomes available to the rest of the script calling that function. What I want to be able to do is say I have a function called foo with the argument $bar I want the variable $bar to become available throughout the rest of my script. Like below. //I don't want to have to do this function foo() { return 'Foobar!'; } $bar = foo();//outputs Foobar! //but rather do this function foo($bar) { return $bar = 'Foobar!'; } echo $bar;//I want it to output Foobar! but doesn't I've tried quite a few thigns now and can't seem to work it out naturally, anyone have any suggestions?
  5. He has a point, I can't see this amendment in your revised code, perhaps try this? just after the mysql query try echo mysql_error(); And see if there's an error preventing the values being returned to the select field if it has no output, chances are it has no value.
  6. <form action="insert.php" method="post"> name: <?php $con = mysql_connect("xxx","xxx","xxx"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("xxx", $con); $query="SELECT name FROM band_data2"; /* You can add order by clause to the sql statement if the names are to be displayed in alphabetical order */ $result = mysql_query ($query); echo '<select name="name"> Name</option>'; // printing the list box select command while($nt=mysql_fetch_array($result)){//Array or records stored in $nt echo "<option value=\"{$nt['id']}\">{$nt['name']}</option>"; /* Option values are added by looping through the array */ } echo "</select>";// Closing of list box ?> <br /> skill : <select name="skill"> <option value="">Do they hold their instuments up the right way?</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option></select> <input type="hidden" name="counter" value="1"> <input type="submit" /> </form> Sorry, forum killed it before. I've tidied it up a bit, try wrapping variables contained in string with braces. I'm assuming you're running PHP5?
  7. You cannot append a query string on a form action, these will not be passed for reference by the form. They need to be post variables in hidden fields for the same effect and the action file to be slightly ammended from $_GET to $_POST to use these variables. Or set the form method to get and ammend the action file to $_GET on all the posted fields. Google 'get variables on post form' and you'll find this (I had to check my facts) http://www.webmasterworld.com/forum88/5383.htm
  8. I can't see that working, the PHP should work in the " with no issue I do it all the time. Although spelling method correctly should make all the difference. A post method will not append get variables to the action url. So you need to make these get variables hidden fields with the names of the get variables and set the value accordingly and just change in your scripts the $_GET to $_POST.
  9. I solved it by putting a .htaccess in the blog folder and telling it not to rewrite anything back to index.php on root thanks to the cheat sheet on the sticky thread
  10. Heh, looks like its both then release date of 1.1 isn't for another 10 days or so anyways
  11. Well I'm updating my framework at the moment, its to speed up and ease development for learners and designers without compromising on functionality for PHP tech heads. Default will be MySQL but I'd quite like the option to use other technologies. So really its a toss up between using ORM or PDO? What do people think? I'm thinking ORM but I've had a little read on PDO and it seems pretty cool and safe while staying fairly lightweight. (important to me as I've managed to keep the framework to 10-12kb so far )
  12. Right, I've fixed everything but I still can't get it to exclude the blog directory and any urls inside that blog I thought this might work, but it doesnt RewriteCond %{REQUEST_URI} !^/(blog)/ before I did the rewrite request to index.php
  13. Thats ok, I'll just modify the class so its abstract and its a case of drag and drop/defining type after that. So is it worth doing?
  14. Also, WideImage is an open source class based on the GD image library, its very good actually.
  15. Noted. I saw that in the documentation, just seems like a pretty cool feature to have instead of being stuck with MySQL. I don't personally mind MySQL but I know there are better alternatives out there.
  16. Humm, something bad happened lol. now the only thing that does work is the requests to index.php The lack of a www. doesn't redirect to www. anymore and the blog still doesn't work. Good god I wish I'd spent more time learning mod_rewrite The site is http://www.seopositive.com if you guys wanted to have a look at it and the query strings. mod_rewrite really is voodoo, very cool but a total nightmare lol I've pasted the current .htaccess below RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^seopositive.com$ RewriteRule ^/?$ "http\:\/\/www\.seopositive\.com" [R=301,QSA] RewriteCond %{HTTP_HOST} ^seopositive.com$ [OR] RewriteCond %{HTTP_HOST} ^www.seopositive.com$ RewriteRule ^index\.php$ "http\:\/\/www\.seopositive\.com" [R=301,QSA] RewriteRule ^sitemap\.xml(\.gz)?$ sitemap.xml.php RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . index.php [QSA,L]
  17. I was looking at the tutorial sites before I played with it lol, boss just wants this working ASAP. I'm gonna have a play with it on my CMS at home
  18. Hey guys, I've written a fairly cool MySQL CRUD, and am thinking about a PDO based one. Is it really worth it? Is there a performance hit/gain with PDO? Security is better from what I understand but PDO is a subject I haven't touched on a great deal. Any opinions are greatly appreciated
  19. Submit indicates you want a form, but I can't see any <form> tags anywhere and I can't see where any of those $_GET variables are define, could you post all of your script so we can help debug this with you?
  20. Have you tried echo'ing the $_GET array to see whats in there Try these <pre> <?php print_r($_GET); ?> </pre><pre> <?php print_r($_REQUEST); ?> </pre> And see which one works, if either do or not
  21. You might want to have a look at http://php.net/manual/en/function.utf8-decode.php This guy seems to have a good little function for you. www.php.net is your best friend function utf8dec ( $s_String ) { $s_String = html_entity_decode(htmlentities($s_String." ", ENT_COMPAT, 'UTF-8')); return substr($s_String, 0, strlen($s_String)-1); }
  22. I'm pretty sure Paypal have some form of 'human validation' making this pretty difficult. And do you really want a robot handling payments automatically? I don't even trust the banks! haha
  23. Well, much to my avail. I have discovered a new issue, When I try to go to the blog it redirects to the home page. I can access www.example.com/blog but I cannot access www.example.com/blog?p=1 I've tried removing all the [L] from the .htaccess but I still can't get it to work, I had a look on some tutorial sites but its actually just baffling haha I pretty much know that L means no more rewrites to this url if this is met and QSA is query string append. But I just cannot get the blog to work again I've pasted the current .htaccess, good god I hope Cags is up this time in the morning 0.o LOL RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^example.com$ RewriteRule ^/?$ "http\:\/\/www\.example\.com" [R=301] RewriteCond %{HTTP_HOST} ^example.com$ [OR] RewriteCond %{HTTP_HOST} ^www.example.com$ RewriteRule ^index\.php$ "http\:\/\/www\.example\.com" [R=301] RewriteRule ^sitemap\.xml(\.gz)?$ sitemap.xml.php RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . index.php [L] Thanks guys
  24. Hence 'may be', Its something I've had many hours of pulling my hair out over so its worth checking/trying.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.