Jump to content

Maq

Administrators
  • Posts

    9,363
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Maq

  1. Hmm, not sure how that solved you problem because your question was (not really a question): In any event, glad you resolved everything.
  2. You're right, but since you posted in the PHP Help section it's assumed you're using PHP.
  3. Looks fine except for adding the single quotes around $category... $sql = "SELECT * FROM $tbl_name WHERE category = '$category' ORDER BY thumbs_delta DESC";
  4. And please don't double post... Could you mark your other thread as [sOLVED] so people don't waste their time looking at it. This one as well.
  5. You can, there is a way. Query please?
  6. Cron doesn't have an option of every other day of the week, at least, not that I know of. But you can test to see if the cronjob was run last week via a small bash script: if test -f /dir/lastweek then rm /dir/lastweek exit fi touch /dir/lastweek run the job
  7. You may find this useful: http://www.phpfreaks.com/forums/index.php/topic,247139.msg1155934.html#msg1155934
  8. Only the values you're comparing to need single quotes around them (unless the field type is integer). You may have seen backtick ` around table names, that's due to the table name is a MySQL reserved word, and with backticks it kind of escapes that word and knows it's a table name rather than a MySQL function/keyword. Please mark as [sOLVED].
  9. No. There really aren't "best practices" for session holding. As long as you have session_start(); at the top of every page you want to use the session variables, they will 'stick'.
  10. Because that's entirely a different file which is obviously out of the scope. Like MadTechie said you should store it in a session variable so you can easily pass it among pages. This will avoid including files.
  11. You can also just put the variable in without breaking out of the string. The I have { } around it is because it's an associative array and has single quotes which will throw an error without them. echo "Welcome! You are now logged in {$_SESSION['username']}";
  12. PEAR has a class for pinging. Ping with PHP The other stuff you may need to read some tutorials for or get some examples for these forums, as they are too broad to answer.
  13. Glad it's working now. Could you put up the new copy in case anyone run into similar issue? Also, please mark as [sOLVED], thanks!
  14. Like this? $query = "SELECT title FROM XXXXX_XXXXX WHERE private='n' ORDER BY starts DESC LIMIT ".$SETTINGS['lastitemsnumber']; $result = mysql_query($query) or die(mysql_error()); if($result) { while($row = mysql_fetch_assoc($result)) { $string .= $row['title'] . " ,"; } } echo $string;
  15. Be aware that explode will split the string up for any whitespace it sees. So when the string comes in make sure you trim() it and/or check if the pieces aren't blank: if(!empty(trim($pieces[1])))
  16. Something like: $string = "firstname lastname"; $pieces = explode(" ", $string); echo $pieces[0] . " " . $pieces[1];
  17. Giving up so easily...?
  18. You will tend to get more replies with newly created threads in the proper section.
  19. Don't know why you're mixing and matching. Just use mysql_query. And why are you matching on password, username, and ID? Isn't id unique? If it is, then just do this: $login = mysql_query("UPDATE `loggedin` SET loggedin ='Y' WHERE userid = '$userid'") or die(msyql_error());
  20. Read this.
  21. Nice catch, yes, the OP probably wants: $result = mysql_query("select * from `games` where ID = '$game_id'"); Note: If field ID in your table is an integer then you don't need the single quotes. You should also cleanse your variables before putting them anywhere near your queries by calling mysql_real_escape_string() to prevent SQL Injections.
  22. Why don't you name all of your textbox the same thing "fname[]". Then in your processing script you can just do: foreach($_POST['fname'] AS $fname) echo $fname;
  23. What does it output when you echo $dir?
  24. What exactly happens when you run the script? $dir = str_replace('/', '', __DIR__); echo "This is my dir: " . $dir; switch($dir)
  25. Echo out $dir to make sure it matches something, or have a default case.
×
×
  • 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.