Jump to content

joel24

Members
  • Posts

    760
  • Joined

  • Last visited

Everything posted by joel24

  1. you have to select post_id from ignore, not posts.post_id, as they are seperate queries... SELECT Users.id, Posts.post, Users.username, Posts.post_id FROM Posts, Users, Friends WHERE Posts.username_id = Users.id AND Friends.user_id = $user AND Friends.friend_id = Posts.username_id NOT IN (SELECT post_id FROM ignore) .. though that will return the post_id of every ignored post, by any user. you need to change the last select to incorporate the user's id, i.e. SELECT Users.id, Posts.post, Users.username, Posts.post_id FROM Posts, Users, Friends WHERE Posts.username_id = Users.id AND Friends.user_id = $user AND Friends.friend_id = Posts.username_id NOT IN (SELECT post_id FROM ignore WHERE user_id=$user)
  2. SELECT * FROM post WHERE post_id NOT IN (SELECT post_id FROM ignore) though if user_id in the ignore table is the user who ignored the post, you would have something like this... assuming the user id is stored in the session SELECT * FROM post WHERE post_id NOT IN (SELECT post_id FROM ignore WHERE user_id='{$_SESSION['user_id']}')
  3. there are a few different ways you can join tables, my favourite is SELECT tp.id, tp.content, tc.catname FROM tablePost tp JOIN tableCategory tc ON tp.categoryid = tc.id have a read up here or on google.
  4. what other weird stuff does it echo...? and what part do you want help with.
  5. $_SERVER["HTTP_ACCEPT_LANGUAGE"] will have the browser language $_SERVER variables on php.net
  6. your use_lang() function only determines whether the appropriate language file exists, i.e. en.php, fr.php etc what do you want it to do?
  7. use a session to store the language for the duration of the user's visit to your site and then check if the session is set after you check the get variables (in case they want to change languages again) i.e. session_start(); if (isset($_GET['lang'])) { //add to session $_SESSION['lang'] = $_GET['lang']; } else if (isset($_SESSION['lang'])) { //language is set in session - do nothing. } else { //default language $_SESSION['lang']='en' } // Include the right language file include("lang/{$_SESSION['lang']}.php"); *EDIT* you need to ensure session_start(); is located at the top of each PHP script which you want to include the session variables. read up on sessions at the link I put above.
  8. the check-boxes will only post a value if they're selected, so the $_POST['boja'] array will only contain the values of the checked boxes
  9. you'll need to set the user's language choice into the session or a cookie have a look here to read up on sessions
  10. the line if( isset($_GET['lang']) && use_lang($_GET['lang']) ) checks to see if any language variables are set in the URL You need to pass the $_GET variables when a user clicks on the appropriate language flag $lang["available_language"] = array( "en" => "English", "es" => "Spanish", "pt" => "Portuguese", "it" => "Italian", ); //you'll have to set the src part to point to the folder where the flags are //you'll also have to change index.php to the page name, or look into using a $_SERVER variable to echo the page foreach ($lang AS $key=>$value) { echo "<a href='index.php?lang=$key'><img src='$key.png' alt='$value' /></a>"; } //foreach will return <a href='index.php?lang=en'><img src='en.png' alt='english' /></a> for the first
  11. you could select the next / previous like so? i.e. SELECT TIMEDIFF((SELECT cil_start_time FROM coc_issue_log WHERE cil_issue_log_id = cil.cil.issue_log_id),(SELECT cil_end_time FROM coc_issue_log WHERE cil_issue_log_id < cil.cil_issue_log_id LIMIT 1)) AS TIMEDIFF, cil_issue_log_id FROM cil_issue_log cil
  12. just enclose the values with brackets and seperate with a comma INSERT INTO `cork_wall`.`Classified` ( `id` , `user` , `description` , `link` , `img1` , `published` ) VALUES (NULL , 'corkdjs@gmail.com', 'Hi guys.', '', 'http://munsterweddingdjs.com/images/weddings-in-east-cork.jpg', '0'), (NULL , 'email2@gmail.com', 'Hi guys.', '', 'http://munsterweddingdjs.com/images/weddings-in-east-cork.jpg', '0'), (NULL , 'email3@gmail.com', 'Hi guys.', '', 'http://munsterweddingdjs.com/images/weddings-in-east-cork.jpg', '0');
  13. you need to break the quotation if you echo this way, or use double quotes. i.e. $string = 'this is a string'; $single = '<p>the sting is: '.$string.'</p>'; $double = "<p>the string is: $string</p>"; echo $single . $double; You only need <?php echo $whatever; ?> if the code is not located within PHP <?php ?> i.e. <?php $string = 'this is a string'; ?> <html> <head> </head> <body> My String: <?php echo $string; ?> </body> </html>
  14. use unix timestamp with modulus for a 50/50 split... timestamp measures the seconds passed since 1st jan 1970, so the ad would change depending on if the seconds were odd or even. i.e. 10001 would be ad1 and 10002 would be ad2. rough 50/50 split. $time = time(); if ($time % 2) { echo "ad1"; } else { echo "ad2"; }
  15. do you have a <div> with id 'flashcontent' ?? p.s. this post should be in the javascript help section.
  16. i guess that's your job to ensure it is 'coded correctly' and is secure if you're looking for an open source solution. and as for osdate returning a 404, the source is still there to download regardless of if the demo is malfunctioning have a look here
  17. But is there a limit to the number of files that can be stored in any one folder? No. Or is there a point when the number of files within the folder mean searching the said folder becomes slow? If you're only searching for file name, no. You should store the file name, details, author and location in a mysql table and then when someone searches for a file - search the mysql database, return the location from there and return the file using PHP.
  18. google found this have a look
  19. whoops, misread that. substitute array_diff() with array_diff_key()
  20. you could use array_diff()... i.e. $array1 = array("green", "yellow", "red"); $array2 = array("green", "yellow", "blue", "red"); $result = array_diff($array1, $array2); if (empty($result)) { echo "found"; } else { echo "not found"; }
  21. quick google would've been quicker than posting. http://oreilly.com/pub/a/javascript/2001/07/20/plugin_detection.html
  22. sorry, misunderstood your question. something like this should work $query = 'SELECT * FROM wp_usermeta WHERE meta_key = "wp_1_s2member_custom_fields"'; $results = mysql_query($query); $region = array(); while($line = mysql_fetch_assoc($results)) { $meta_value = unserialize($line['meta_value']); $region[$meta_value['county']]++; }; foreach ($region as $key => $value) { echo "Region $key: $value members"; }
  23. how are you determining what region the users are in? IP address? or signup data?
  24. joel24

    Group By

    if you only want the latest session for each user, group by USER_ID and ORDER BY LastActivity
×
×
  • 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.