Jump to content

akphidelt2007

Members
  • Posts

    174
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by akphidelt2007

  1. Do a print_r on $old_path after you run the query and you'll see your problem
  2. If I get you correctly, you aren't talking about connecting to different databases but using the same connection multiple times throughout the application? I would look in to building a static db class.
  3. There is no quick way. There is long hours and a lot of red bull ahead of you.
  4. If you have that code snippet that you showed on top of every file, that will generate an error if you have error reporting on unless you are expliciting creating $_POST['username'] somewhere else in the code.
  5. I would create a separate table and just record all the details of each product view, like time, referer, ip address, session_ids, username, etc. Then you can do all sorts of analysis on your views including the counts you want.
  6. You are creating the instance, you are just wrapping that instance in a static method. What you are doing is no different than this... if you removed the static methods. $smClass = new StaticMethodClass(); $smClass->samplePrintStuff(); $smClass->weWillPrintStuff();
  7. There's no purpose to that code though. All you are doing is wrapping the instantiation in a static method which defeats the purpose of using static methods. I guess maybe you save 1 line of code.
  8. Probably because you have E_STRICT errors turned off. If you put in error_reporting(E_ALL | E_STRICT) it will trigger the error.
  9. Single quotes and periods within double quotes are read as a literal value. So for instance if $_POST['category'] = 'TestCategory' your query string from before would read SELECT category, company, address, city, state, zip, phone, url FROM Members WHERE category = '. TestCategory .'" If you use category = '$category1' and your still not coming up with any results, then make sure $_POST['category'] actually contains the proper value. And so people don't yell at me, you should clean your values before using them in a SQL statement. But aside from that, check $_POST['category'] and make sure you want to use = and not LIKE.
  10. True, but you can live without E_STRICT errors
  11. You can change your error reporting to not show STRICT errors or change private function samplePrint to private static function samplePrint
  12. Just a debugging tip. Whenever you have problems with queries, echo out the query to see how it looks. If you echo out your query I'm willing to bet you would quickly figure out what you are doing wrong. But just cause I'm nice... you are not breaking your query. Your search looks like '.category.'. It should be '$category1' without the periods or if you want the periods '".$category1."'
  13. You can't access a variable like that within the scope of a function. Why are you wrapping that foreach loop in a function in the first place?
  14. Add this to this line //this will create a unique id for the row. <tr class="parent" id="Org-<?php echo $id; ?>" title="click for more organizational information">
  15. That is the PHP manual. Outside of espn.com that should be the most visited page you'll visit in your life.
  16. Can you post your actual code. Because what you posted will work and you can access $thing outside the first code block. So your code must be doing something different.
  17. Google has about 144,000,000 articles on how to do this.
  18. You have to rethink your query to figure out what exactly you are trying to count and 99.99% chance you'll have to use a subquery since grouping and counting will yield you the same results for both counts.
  19. Back in the day when I did this manually I would store the info in an array and than implode it out at the end. For example $where = Array(); if(!empty($_POST['student_name'])) $where[] = "student_name = '".cleanmefirst($_POST['student_name'])."'"; if(!empty($_POST['student_email'])) $where[] = "student_email = '".cleanmefirst($_POST['email'])."'"; if(!empty($_POST['student_gender'])) $where[] = "student_gender = '".cleanmefirst($_POST['gender'])."'"; $qry = " SELECT blah,blah,blah FROM yourtable ".((!empty($where) ? ' WHERE '.implode(' AND ',$where) : ''); Something along those lines. Otherwise you are going to get stuck with tons of if then and garbled messes.
  20. What I meant by it's incorrect is it's coming up with the wrong url. When you click on the page # it sends you to a completely different url.
  21. Of course the work can be done with out it. I just thought it would be a neat idea and make some things I do much more efficient. What I'm trying to do is set up a report builder where I can just type up the query and have it break it down to automatically create it's headers, filtering, authentication, classes, ajax, etc. But I guess you are probably right, it would probably end up being easier just to build the tools to be able to construct the query from the inputs rather than just typing the entire query out and regexing the heck out of it. Alright, I'll try this other method first. Thanks
  22. $this->php_self is incorrect. Depending on your setup it might be easiest just to plug in a href='http://yoursite.com/index.php?menukey=8&page=2'
  23. Hi there, so I'm working on a way to be able to write queries and be able to break them down in to their components. For the project I was working on I needed to do a lot of automatic filtering with dynamic WHERE IN statements and other clauses. So I built a query class that could handle that and wrote my queries using that class. But now I'm trying to go the opposite direct and be able to write the query out and have the script deconstruct it and then construct it back together with the added logic I have going on. I'm having trouble finding any scripts on Google, most deal with the URL Query String. But if anyone has done this before and has an example or knows a script out there that would be a good starting point, please let me know. I have a feeling this will involve a lot of regex. If I can't find anything, I will work on developing it myself but just thought it would be nice to have an example to look through. Any help is appreciated, thank you! Just for example purposes. Something like this $qry = " SELECT t1.employee,sum(t1.hours) as Hours,t2.labor_classifiation FROM labor_data t1 LEFT JOIN craft_strings t2 ON t2.id = t1.craft_id "; //This would be broken down in to Array('tables'=>Array( 'labor_data'=>Array( 'fields'=>Array('employee','hours'=>Array('name'=>'Hours','equation'=>'sum')) ,'prefix'=>'t1') )) //that's not the entire array that would come out of it, but you get the picture.
  24. Could be wrong, but seems you do not have a name for the submit input. Put in name='submit' and it should work.
×
×
  • 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.