Jump to content

thescientist

Moderator
  • Posts

    8,682
  • Joined

  • Last visited

Everything posted by thescientist

  1. they don't really look the same at al are you sure we're talking about the same pages?
  2. is this same page we were talking about? do you have more than just a picture if not? Code? Link?
  3. yes, but that will only track per user. You need some form of persistant storage on the server side for this.
  4. dude, you need to put 1 + 1 together. take your source code and VALIDATE IT. Then you will find quite a few issues. Fix those, then we can get back to fixing a page that isn't "broken".
  5. what I am talking about is the HTML the browser see's when PHP outputs whatever you tell it to. (i.e. view source)http://validator.w3.org/
  6. honestly, I don't think any of use here believe you really understand anything that you've been taught. For the true test would be for you to explain it back in a meaningful, competent sounding way, and that is what I don't think you are capable of, even after all this time. So yes, you may know what CSS, or HTML, or maybe some of the other languages do, but I don't think you know how to use them.
  7. this is nothing new! you write CSS in a CSS file. you match the selectors in the CSS file with elements in your HTML, You include the CSS file in your HTML document, and then the CSS gets applied to your HTML. We've been there and done that with you already.
  8. so it looks like you didn't take my advice and look at the source of your own code, or validate it? I see quite a few validation errors coming from tags being unclosed. I would start with fixing your page first so we can get only the relevant issue at hand in the most stable context.
  9. so now it's back to re-learning CSS again? yeesh.
  10. span is already inline. p is block. all you did was make p an inline element which span already was.
  11. what part is messed up? We can't really tell unless you also tell us what it should be doing instead? Do you still need to give it the width of the container? 950px?
  12. well, the whole point was to trace the steps of your code. Figure out if you are getting a value of $_GET['cat_id'], see what the query in full looks like. I don't see you have provided or confirmed any of that. It sounds like your query is wrong because of some logic. Again, debug, debug, debug. I don't know my example didn't work, because you didn't tell me the errors. The point is that if a value wasn't provided in $_GET, you should get it from the database. isset is not sufficient because a member in $_GET (in this context) with no value will be an empty string "". I would try to follow my examples, and debug every step of the way and provide your findings. Don't assume anything. If you try something and it doesn't work, show us what you tried, with debugging, and tell us what the errors are.
  13. it's really hard to tell with just a picture. Ideally a live link is the best way for people to help, so that they can view it right in the browser and use various debugging tools on it.
  14. In the vein of static classes and objects, there are times when you only want one instance of an object at any one time, yet still want some form of statefulness. For that, there is the Singleton pattern.http://en.wikipedia.org/wiki/Singleton_pattern
  15. no. you can make classes that have static members and methods, so no instantiation is necessary.http://www.php.net/manual/en/language.oop5.static.php
  16. more importantly, what is the generated output in the browser? Have you viewed the source to make sure it looks right? Have you validated it make sure all your tags are closed and correctly nested? also, I know id's can't start with numbers, so there's probably a good chance classes can't either.
  17. you have to show us what you tried and what the outcome was. Again, basic debugging should be your first line of defense. What are you trying to confirm that values are what you expect them? How are you confirming that the code is not working? Which part? At what point? It's important that you start figuring out how to test and debug simple things like this.
  18. I would do something like this, because isset will "work" on an empty string, which is what $_GET['cat_id'] would be if there was nothing in it. if(empty($_GET['cat_id')){ $result = mysql_query ('SELECT * FROM `shop_cat` ORDER BY shop_cat_id ASC LIMIT 1')or die(mysql_error()); $row = mysql_fetch_assoc ($result); $catID = $row['shop_cat_id'];}else{ $catID = $_GET['cat_id'];};$query = "SELECT * FROM shop_items WHERE FK_catID = ".$catID;
  19. at the very least we would always be able to have a consistent thread to give newbies a link too. Something that could be easily maintained, updated, and relevant.
  20. Very nice. I really hope a lot of (or at least one) member(s) take head of the good advice here. It's always what we say over numerous threads, but at least now it's nice to have all the good debugging practices in one place. Maybe it could eventually get pinned. Maybe you can expand upon what you have to include some tips for debugging forms like you have mentioned in another thread. That always seems to throw a lot of beginners for a loop because for whatever reason, they never think that there's something wrong with form or the PHP, because as you so well stated, they don't approach it in steps. They just put the form (HTML) and PHP together and never check that the form is even submitting right in the first place.
  21. you know, search engines were made for this...
  22. first thing is you need to make sure you are even getting a value for $_GET['cat_id'] when the link. var_dump($_GET);$catID = $_GET['cat_id']; you wouldn't get an error because when the GET/POST are passed, they are converted to strings, so a blank value would just become an empty string, '' and also by verifying that there is even a value when you output it in the HTML $under_query = "SELECT * FROM shop_cat";$under_result = mysql_query($under_query)or die(mysql_error());while($u_row = mysql_fetch_assoc($under_result)){echo "<a href='shop.php?cat_id=".$u_row['shop_cat_id']."'>".$u_row['shop_cat_name']."</a> ";} make sure when you view the source of your page, that there is even a value being assign by $u_row['shop_cat_id'] the shop_cat table needs to have records in it in the first place right? Or else how would see any links? The loop wouldn't run in that situation. This is basic debugging. You need to trace all steps of your code, and know what each part is doing at all times.
  23. That will open the file in the browser window most likely, but PDF's are meant to be a standard, cross platform, independent viewable format anyway. I think the OP was expecting a similar feature out of PPT files, which are not like PDF's in their intended application.
  24. To be specific, you press submit, and depending on the method (get/post) PHP takes the form elements and their values based on the name attributes you've designated them and populates the corresponding array ($_GET/$_POST) with correct members and values. It's up to you at that point. Most people opt to assign these key/values to more meaningful variables that can then be used throughout their script. In this case you are trying to populate a form with it's submitted values. A simple way to check if the form is at least submitting correctly is to put something like this at the top of your scripts for debugging purposes.var_dump($_GET); and at least make sure the array has the values you are expecting. Now naturally you will only see anything meaningful until after the form is submitted. But, when you submit, you should see what you submitted in the output. From there, trace the steps of your script and see where things might be going wrong, but outputting the one test variable to make sure it is what you expect at each step in the flow. You should be doing this for the if/else's so you know for certain what path your code is taking.
×
×
  • Create New...