Jump to content

PFMaBiSmAd

Staff Alumni
  • Posts

    16,734
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by PFMaBiSmAd

  1. Actually, the code worked for me with the modifications (attempted to execute the query against my database.) Are you doing this on a server with error_reporting set to E_ALL and display_errors set to ON in your master php.ini so that all the errors php detects will be reported and displayed? Stop and start your web server to get any change made to the master php.ini to take effect and confirm that the setting actually changed by using a phpinfo() statement in case the php.ini that you changed is not the one that php is using.
  2. Add the following three lines of code immediately after your first opening <?php tag (move the session_start() down if it on the line with the <?php tag so that is is after these lines of code) on both the page where you are setting the session variables and on the page where they are not persisting - ini_set("display_startup_errors", "1"); ini_set("display_errors", "1"); error_reporting(E_ALL);
  3. Because there are always multiple things in programming that can prevent code from working on any particular server, to get the quickest help without a lot of guessing, you must communicate exactly what you see in front of you when you submit the form. There are two apparent problems. 1) The code is way out of date and relies on a php.ini setting that was turned off by default over 8 years ago (most of the code you will find posted on the Internet is crap and is just there to get revenue from people clicking on links on the site) and 2) The form never worked because it does not have a method="..." attribute and the default in that case is GET and since the URL in the action="..." attribute also is using GET for the c value, the ?c=1 value will never be submitted. If you change the start of the code up through the <form tag to the following, it should work - <?php $c = isset($_GET['c']) ? (int)$_GET['c'] : 0; $keyword = isset($_POST['keyword']) ? $_POST['keyword'] : ''; /* call this script "this.php" */ if ($c != 1) { ?> echo "input box starts here"; <form action="this.php?c=1" method="post">
  4. This one has date fields and a date pick calendar - http://www.dynamicdrive.com/dynamicindex7/jasoncalendar.htm
  5. The yyyy-mm-dd format has nothing to do with any country's localization. It is a format that allows direct greater-than/less-than comparisons and sorting. Did you look at Pikachu2000's post, because that is the fastest way to accomplish this (using php's date/strtotime is ~ 8 times slower than doing a conversion in the query.) You could also simply explode the yyyy-mm-dd value on the '-' character and use the second resulting element.
  6. http://us3.php.net/manual/en/language.operators.precedence.php
  7. Use LIMIT 2 and then check using mysql_num_rows() how many actual rows were returned. When mysql_num_rows is only 1, you know you have fetched the last row at either end of the available data. You would not output the next/previous link that corresponded to the end you hit or if you are unconditionally outputting next/previous links, the next time you choose the one corresponding to the end you were already at, mysql_num_rows() would return a zero and you would use that to output an appropriate user informational message.
  8. The reason your code is attempting to make a connection to the database server at the msyql_query() statement is because your actual code that is attempting to use mysql_connect() is failing and you don't have any error checking or error reporting logic in your code to get it tell you that the connection failed or why. You also might be using short open tags and your code that is attempting to use mysql_connect() is not being seen as php code.
  9. To get the next higher ID - $query = "select * from videos WHERE ID > $id ORDER BY ID ASC LIMIT 1"; To get the next lower ID - $query = "select * from videos WHERE ID < $id ORDER BY ID DESC LIMIT 1";
  10. So, you have changed the logic to now() <= d.dl_end, instead of d.dl_end > now(). Which do you want to do (for all we know you are testing with values having today's date) and have you actually tried with values of d.dl_end that should and should not work? Have you executed the query directly against your database to make sure it returns what you expect? What does one of your d.dl_end values look like?
  11. That's nice But, the only thing that tells us is that the greater-than comparison between the values in d.dl_end and now() is true or that you have a logic error in your code that is always allowing the download.
  12. My first reply both told you what is wrong with the code you posted (missing " on the id= attribute) that is preventing it from working and the better way (just use a href= link, no form and no javascript is needed.) As to your last post, that makes little sense and does not show an actual example of what you are trying. The reason you are having so much trouble with getting this to work is you are making it more complicated than necessary - http://en.wikipedia.org/wiki/KISS_principle
  13. You cannot enforce security that way. Anyone can alter anything that is present in a form or a link in a browser. The only way you can enforce security is by not putting the piece of data in the hands of the visitor. If you want to insure that only the current visitor can access his information, you must handle that solely on the server, such as using his id stored in a session variable instead of using an id that came from the browser with the http request.
  14. Due to the general purpose nature of computers and programming, no one can directly help you with what your code is doing without seeing your code. 113 different people could have written your post above and there could be a different problem in each of their programs that could cause the exact same symptom. Best guess is that there is something wrong in your form processing code or in the method you are using to persistently remember items in the cart.
  15. You are missing a " in the first code that makes the id= attribute invalid HTML. Why are you using a form for this? You don't have any user input (which is what forms are for), so you might as well just use a href link without using any form or javascript.
  16. I'm going to guess that XMashTitle is a character/string data type? If so, $options needs to be enclosed in single-quotes inside th query to make it a string. You also need to use mysql_real_escape_string() on $options before you put it into the query to prevent sql injection and prevent any other special characters in it (such as a quote) from breaking the sql syntax.
  17. If you are still getting the same error, it means that you query is failing due to an error. For debugging purposes, echo mysql_error(); on the next line after the line with the msyql_query() statement to find out why the query is failing.
  18. Given that your code is using $_SESSION variables and it has HTML (the doctype tag through to the body tag) before any possible session_start() in your code, the session is probably not working. Are you learning php, developing php code, and debugging php code on a system with error_reporting set to E_ALL and display_errors set to ON in your master php.ini so that php would help you by reporting and displaying all the errors it detects?
  19. Your code does not have a mysql_query() statement in it to execute the query.
  20. You need to use an ORDER BY to get the rows in the order that you want. Then in your presentation logic, you remember the last subcategory and output a new heading when it changes. See this post for some sample code - http://www.phpfreaks.com/forums/index.php/topic,296615.msg1405059.html#msg1405059
  21. Two days ago, you were told that $HTTP_COOKIE_VARS was depreciated and to use and were also shown code that used $_COOKIE instead. Those two different people that provided that information did not do so because they needed practice typing. They did so because it was information you needed to follow. You are not getting any $HTTP_COOKIE_VARS related error reported/displayed in your current code because empty() on a nonexistent variable does not produce an error. However, the code you posted DOES have a space before the <?php tag which would be producing a php error for that code, so I will guess that you are attempting to execute this code on a server where ini_set() has been disabled and the line of code that should be setting display_errors so that you would see any php detected errors is not doing anything.
  22. <?php will always work as an opening php tag. <? won't always work and causes huge amounts of wasted time chasing down php.ini settings to get it to work when you switch servers or someone updates the server you are on and it gets turned off. Be consistent and save time by always just using the <?php tag.
  23. For debugging purposes, add the following two lines of code immediately after the line with your first opening <?php tag - ini_set("display_errors", "1"); error_reporting(E_ALL);
  24. Are you reading whole (large) files into memory or returning large queries from databases and then making copies of the returned data in arrays or using a php framework or any other things that use large amounts of memory or are you using large amounts of memory but are not freeing them up once you are done with them? It would take seeing your code and knowing the size of the data being used in order to help.
  25. Unless $Weapons, $WeaponCount, $weaponAW, and $weaponAWC are large and using ~134 million bytes of memory, the problem is your overall script is using all available memory and when you attempt to create the $weaponA array, you cannot allocate enough memory. What are the sizes of $Weapons and $WeaponCount? If they are fairly small, the problem is elsewhere and you would need to find where your script is using most of the memory and optimize it.
×
×
  • 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.