Jump to content

mikesta707

Staff Alumni
  • Posts

    2,965
  • Joined

  • Last visited

Everything posted by mikesta707

  1. This depends entirely on how you calculate the distance. As AyKay said posting the code will surely help. Until then, all I can offer is that you first store the results from the table into an array, and use PHP to sort that array based on distance. This solution isn't optimal however, if you are able to use SQL to sort it. However, without any code I can't say for sure
  2. file data is located in the $_FILES super global, not $_POST. check out this tutorial to read about uploading files: http://www.tizag.com/phpT/fileupload.php
  3. Well I'm not going to read that huge script, but what exactly are you trying to do here? The purpose is kind of unclear, and you never explained what was wrong with the code (or if there was even a problem at all) A little word of advice: Learn PHP before you try to get over your head with a project. It seems like you don't know anything about PHP at all and are using a fairly advanced script. We aren't going to make it work for you since this is a forum of volunteers. You need to be able to help yourself before you can get help from us.
  4. Without seeing the context it is being used in its hard to tell, but it seems to be aking a file, and parsing dates out of it from a simple glance
  5. You need to use double quotes for your variables to be interpolated, but the intent is probably clearer if you simply concatenate. echo '<li>' . $product->title . '</li>';
  6. assuming that the header and footer are always the same (which they appear to be) I would agree with this
  7. if you are getting that "menu is closed" error it means that the database is unable to find any rows with that specific id. Are you sure id is the correct column name? How are you building the ids on the other page (IE in the links, where does the id come from). There has to be a disconnect somewhere, because this is a very simple procedure, one I have done many times with much success using almost the exact same code that I posted.
  8. You can access the value that you pass through GET via the $_GET super global. You would use it like any other PHP array. So for example, you could do $id = $_GET['id']; echo $id;//would echo the id of the product in the database Now what you want to do is use this value in the query. Without knowing the exact column name, I can't give you the exact code, but I can guess what it looks like $id=$_GET['id']; $query = "SELECT * FROM items WHERE id=$id"; ... Now, you should also remember to sanitize your input so you protect against sql injections. Since $id should always be a number, you could probably get away with simply casting it into an int using a PHP cast or the intval function like so $id = intval($_GET['id']); $query = "SELECT * FROM ...";
  9. You have two options. You can use a regular expression to grab the string you want, or you can use the simpler str_replace function or the substr function if the header and footer are always guaranteed to be the same every time. regex: http://php.net/manual/en/function.preg-match.php regex replace: http://www.php.net/manual/en/function.preg-replace.php substr: http://php.net/manual/en/function.substr.php str_replace: http://php.net/manual/en/function.str-replace.php if you need an example of one of these functions use, then just ask
  10. This line of code may run without a syntax error, but it is NOT doing what you think it is if($checkBowler['playerID'] == ($match['currentBowler'] or $match['waitingBowler'] or $match[$bowlingTeam.'WicketKeeper'])) { when you group that.. strange or statement together, you are producing a boolean value. Remember, or (or ||) is a boolean operation, and returns a boolean value. You are essentially doing this if($checkBowler['playerID'] == true){/// //or if ($checkBowler['playerID'] == false){/// //depending on the value of the that triple or statement now fortunately, PHP will just cast whatever you throw at it on the fly, so if you have a string (as long as its not empty) that statement will be.. ok. It won't behave like you want it to, but if you feed it certain inputs it may make you think it is behaving correctly. It seems like you simply want to check if that value is equal to any of those three values (and then check to negation of that later on) Now, AyKay's advice kind of addresses this problem, but assumes that the three values you are testing that are part of the $match array are its only values. Now, this may be true, in which case you can use in_array like he used, but to be safe I would just stick the three values into another array $arr = ($match['playerID', ... the rest of them you are testing) if (in_array($checkBowler['playerID'], $arr)){//this is what you first test should be ... } if (!in_arrray($checkBowler['playerID'], $arr)){//similar to AyKay's post ... }
  11. Would it be possible to use a database here? This is the kind of problem databases were made for. Doing this with arrays will take a lot of time, and you could easily make some kind of web interface to add and remove certain species and stuff.
  12. This is because in general, the name of the key string in the resulting array you get from mysql_fetch_xxxx is the name of the column. You can change this by using the as keyword, and in certain very specific instances the above may be untrue. The fire part of "login.teamname" (the "login." part) is what table the column is part of in the query string itself, but doesn't hold in baring in the actual array that is generated from the result set.
  13. What happens exactly? Is the loop never entered? do you see the print "$Points <br/><br/><em>Updated!</em><br/><br/>"; line being output for every iteration through the loop? Can you post the form that is submitting to this page?
  14. Do you use session_start() in header.php?
  15. I believe I remember reading that Facebook's chat system on based on erlang. If you want a chatroom via PHP, you will probably want to use ajax or something to get the kind of functionality you want. You can try a google search for PHP chatroom.
  16. Wow you guys are lucky. In New York, I pay from $2.00-$3.50 for washing (depending on the size of the machine I use at the time, $2.00 being the smallest) and 1.75-2.00 per dry. Luckily the dryers are pretty big so I can generally fit 2 $2.00 wash loads into 1 dryer.
  17. PHPfreaks actually has an OOP in PHP tutorial (you can reach it here: http://www.phpfreaks.com/tutorial/oo-php-part-1-oop-in-full-effect), and a simple google search will provide tons of different resources for OOP in PHP.
  18. PHP is a server side language, so in order to run the PHP code, an actual request must be made to the server (whether it be through a page load, or refresh, or whatever). What you will need to use is AJAX, which will allow you to send a request to the server, and get a response back without needed to refresh to page or load a different one on the client side. Here's an AJAX tutorial: http://www.tizag.com/ajaxTutorial/ Note, AJAX is done via Javascript, so If you don't know any javascript, I suggest learning it
  19. that means your login information is incorrect.
  20. You seem to be accessing the function as if it were a static method when it is not
  21. is there an error? Do you get a blank page? Try turning error reporting on by putting this at the top of your page ini_set('display_errors',1); error_reporting(E_ALL);
  22. looks ok to me. Without knowing your database structure or anything like that its hard to say what the problem is. Is there a mysql error?
  23. I dont really see anything wrong with most of your code. The only thing that strikes me (and my not be incorrect, but seems weird) is the action of your form. <form action="?step=2" ...> Now theoretically I think that should work, but have you tried putting the page name in there? Like instead o just ?step=2, try (assuming your page is named page.php) page.php?step=2 (obviously replace page with your pages name)
  24. Do you not know your own script? Because I certainly don't.. So I can only guess. I don't know when that function is used, nor how it is used or if it is even used at all. If it is, then it seems you just have to set $handwork to the current timestamp (You may also need to concatenate the correct extension. However, this is just a guess as I've said. I don't know your code, and am unfamiliar with the bmp2gd class/library/whatever it is either.
  25. ok firstly when posting code, use the code or PHP BBC tags. Secondly, you need to provide more detail. Just stating you have a problem won' ever get you any help, and posting a small snippet without any explanation as to what is happening and why it is wrong certainly won't either. Now what exactly is happening? Is there an error? Blank page? Something happening that you don't like/want/wasn't intended? If so, what is happening, and how/why is this incorrect? What do you expect to happen.
×
×
  • 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.