Jump to content

K_N

Members
  • Posts

    29
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

K_N's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I don't see anything there about using htaccess with a PHP login script, but thanks, maybe I can figure something out with this and google.`
  2. Basically, I want to secure a directory so that it requires a login via HTML form in a PHP script using an SQL database for user data, but I would like to be able to make it work with htaccess for the entire directory, rather than having to wrap each page in a login authenticating script. If this is possible, can someone link me to a tutorial or provide me with appropriate resources?
  3. D'oh. I'm doing the same thing 3 other times in this script. Can't believe I missed that. Well, on my other issue, can you inform me on how to strip the index out of the array, so it only shows up as [watched] => 0 [watched] => 1 [watched] => 2 etc? Or should I take that to the PHP forum?
  4. I have a very small table right now, looks just like this: I'm using the following code $watchQuery = "SELECT `watched` FROM `watch` WHERE `watcher` = '1'"; $watching = mysql_fetch_array(mysql_query($watchQuery)); And the array $watching comes out like this: [0] => 0 [watched] => 0 What obvious mistake am I looking over that is causing this query to not select every row with a 'watcher' value of 1 (i.e. All of them)?
  5. Ok, that makes much more sense, thank you. I have another problem now, though I think I can figure this one out on my own.
  6. I'm sorry, I'm not really getting where I'm supposed to put the IN parameter. And do I still need the foreach?
  7. How would I use that with the array specifically? Something like SELECT * FROM `status` WHERE uid IN $array ?
  8. For further consultation, I attempted some array functions that I think I did wrong. The array $watching looks like this: And here's the code I'm using: $searchQuery = "SELECT * FROM `status` WHERE "; foreach($watching as $section){ $watching['watched'] = "uid = $section"; } $searchQuery .= implode(' OR uid = ', $watching); $searchQuery .= " ORDER BY id desc"; Here's the output I get: SELECT * FROM `status` WHERE 1 OR uid = 1 OR uid = 1 OR uid = 1 OR uid = 0 OR uid = uid = 0 ORDER BY id desc The output I would like to receive from this is more like: SELECT * FROM `status` WHERE uid = 0 OR uid = 1 ORDER BY id desc MySQL Version 5.1.41
  9. Lets say I have an array called $array1 This array contains the values value1, value2, value3 Right now, I have a query that says something like SELECT * FROM table WHERE value = $array1['value1'] OR value = $array1['value2'] OR value = $array1['value3'] I want to be able to make this query work dynamically, so I can have any number of values in the array, and they would all be compared like the above, without having to modify the query each time a new value is added to the array. What would be the proper syntax for this?
×
×
  • 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.