Jump to content

MmmVomit

Members
  • Posts

    319
  • Joined

  • Last visited

    Never

Everything posted by MmmVomit

  1. Both of those are perfectly valid. I use the former all the time. http://www.php.net/manual/en/language.types.array.php#language.types.array.donts
  2. Start getting rid of all the @ signs in front of the mysql functions and start adding "or die(mysql_error())" at the end of them.
  3. You're missing a closing parenthesis at the end of the previous line. I do this all the time.
  4. Are the dates the same? Different? Would you like the earliest date? Latest date?
  5. I think you meant this. <?php $tmp = array(); while ($rw = mysql_fetch_assoc($rw)) $tmp[] = $rw['var']; echo impode('<br>,',$tmp); ?>
  6. You just have to figure out the proper WHERE clause for the sql query. Without knowing your specific database, no one here can help you.
  7. What does your table structure look like? What does your code currently look like?
  8. Here's another good reference for SQL. http://www.w3schools.com/sql/default.asp
  9. You want to add a Buddy table. It will look something like this. Buddy ---------------- ID UserID BuddyID 1 12 13 2 12 2 3 12 14 4 14 13 5 14 12 UserID points to the ID field in the User table, and BuddyID also points to the ID field in the User table. In the example I gave above it might be something like this User(12) requested User(13) as a buddy User(12) requested User(2) as a buddy User(12) requested User(14) as a buddy User(14) requested User(13) as a buddy User(14) confirmed User(12) as a buddy If that's your whole table, the only buddies in the database are users 12 and 14. You could simply have it that if someone requests a buddy, it's granted, so record 5 in the table is unnecessary and redundant, but that would probably be more complex. I suggest the previous method.
  10. It sounds like what you want is another table. How exactly do you want buddies to work? Are all buddies also users?
  11. You missed the line of code I added. print_r($staff1);
  12. Can you give a brief description of what you want your program to do?
  13. That field is probably a text field, so it's being sorted alphabetically. You need to change it to an integer field.
  14. Separate it into several different scripts?
  15. Hmm. I wonder if this would work. <?php $i = 0 foreach ($rss1->items as $item ) { $i++ $title = $item[title]; $url = $item[link]; echo "<a href=$url target='_blank'>$title</a></li><br> "; if($i >= 5) break; } ?> If the indexes are numerical, you can just use a regular for loop.
  16. For debugging, try this. <?php $staff1 = $_REQUEST['staff1']; // also tried with $_GET and $_POST but neither worked for me print_r($staff1); if (isset($staff1)) { echo "hello"; } ?>
  17. http://www.php.net/manual/en/language.oop.php It means that $params is an object or class, and get is a member function.
  18. But you are setting the variable. You are doing it in the preceding line.
  19. It actually wouldn't be in another script. This is something that is set through Apache. The values are set in the Apache config files, which have very limited access. If you're not using Apache, I'm sure other webservers can do something similar. Unfortunately, I don't know all the details off the top of my head, because I haven't actually done it myself, yet. I just know that it's possible, and would have to go look up the details. This is the book I learned this from.
  20. That wouldn't be much better. People using the the webpage won't have any access to the PHP code. The vulnerability is that anyone who has access to the server's file system will be able to read the code and get the password. If the file is one directory higher it won't change who has access to the file. The way to solve this is put this info in a file readable by the web server and access the information through the $_SERVER variable.
  21. No, the first method works just fine. Array indexes don't need to be quoted when included in a double quoted string. The first method won't generate any error message the second method wouldn't.
×
×
  • 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.