Jump to content


Staff Alumni
  • Posts

  • Joined

  • Last visited

Everything posted by ober

  1. OMG... I'm an idiot. I just got done answering an explode thread and my mind was stuck on that. Mutley, ignore my posts in this thread. I need to go take a break. What you have should work fine with the exception of what Brian mentioned.
  2. The output of the form based on his input would be something like this: time[]=11%3A00+-+12%3A00&time[]=12%3A00+-+13%3A00&time[]=13%3A00+-+14%3A00 So in the PHP, you would have to loop through the "time" variable and combine them.
  3. <snip> Sorry Brian, I'm an idiot!
  4. That's probably because those results are not separated by commas in $_POST. They are passed as array values. print_r($_POST); and then you can see what I'm talking about.
  5. Create a table in the database that is nothing more than: PollId | userId Then when they vote on a poll, add their user id to this table associated with the poll they are voting on. Then before they are allowed to vote, check this table to see if they already voted there. You can take it one step further and only show the results of the poll if they already voted on it.
  6. What version of mysql are you using? MySQL doesn't support subqueries until version 5.
  7. I'm guessing the other "random text file" isn't in the windows system32 folder? I know it seems like a long way around to the solution, but can you try copying the file to another spot on the drive (assumed to be not so protected), getting the count and then deleting the copy?
  8. http://us.php.net/explode $str = "Bob;Joe;Jim;Another Example Name;"; $myarray = explode(';', $str); // $myarray is now an array of the various pieces and you can search it using array functions.
  9. $query = "SELECT * FROM item WHERE ProductId=".$Prodid; Try that. If $Prodid is not an integer, you need to surround it in single quotes: $query = "SELECT * FROM item WHERE ProductId='$Prodid'"; You should also clean the input (the user can alter anything in the $_GET global array).
  10. http://www.phpfreaks.com/tutorial/basic-pagination
  11. Add a column to your user table called "enabled" or something. In your script where the user is added to the database, set that value to 0 when they sign up. Send them the email stating that it will need to be approved at the same time. Create a listing for yourself that allows you to select users and update them, which just changes that "enabled" field to 1. Then when you check the user as they are logged in, check this field to see if they can login or not. Make sure you send them an additional email when you enable their account so they know they can login.
  12. Put a statement outside of the while loop that checks to see if your current column is less than the column max. Also, why are you putting newlines after each of the elements? Browsers don't read newlines unless you're doing that strictly for the readability of the source (and I'm not even sure that works?).
  13. Thread moved to Misc. There is a sticky at the top of this board about books. Read it.
  14. If it is disabled, you'll have to contact your host to see if they will enable it.
  15. Explode the string, count the number of elements in the array, and then put the first 2 together if there are more than 2 elements. If there will be instances where there will be more hyphens in the string, it will get more tricky, but that's the basic way to handle this.
  16. Are you sure it is updating? I personally have never seen a DB take && for AND in a where clause.
  17. I might care... if they put what timezone 8:30-9:30 was in.
  18. Will it only be in one? $sql = "SELECT Device_Code, Chan1_Reference FROM devices WHERE Chan1_Reference = 'CW1002/W' OR Chan2_Reference = 'CW1002/W' OR Chan3_Reference = 'CW1002/W' OR Chan4_Reference = 'CW1002/W'"; By the way, it looks like you don't have your database normalized. Tsk tsk.
  19. Requery the database or pass it via $_SESSION or some other super global array ($_GET, $_POST, etc). As an example, I have a configuration table in my database where I store all my global settings. With each load of the page, it queries the database and loads that information to an array so I have it available to me anywhere I go.
  20. I can only imagine why you would want to do that. How about you tell us what you're trying to do and we can give you a better suggestion? Grabbing the IDs isn't hard, but I'd like to know why you want to do it.
  21. No one is going to write it for you... you need to take the first steps: 1) Learn how to connect to a database 2) Learn how to query the database 3) Learn basically display and navigation None of these are simple enough for someone to just throw some code at you (and that wouldn't help you anyways). You haven't told us anything about the database structure or the data in it. You've basically just asked a VERY open-ended question.
  22. I would guess that you have a problem in your CSV file at line 134.
  23. I don't see anything that says: $_SESSION['blah'] = 'blah'; You're never setting anything to the session. You might want to read through this: http://www.phpfreaks.com/tutorial/sessions-and-cookies-adding-state-to-a-stateless-protocol
  24. I'm not sure where you read that, but I think the PDO methods are overly complicated compared to the native PHP MySQL functions. I would concentrate on those. I cannot be sure why you're getting a timeout. Try using the MySQL extension functions and see if you get the same problem.
  • 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.