Jump to content

MrXHellboy

Members
  • Posts

    153
  • Joined

  • Last visited

    Never

Posts posted by MrXHellboy

  1. Hi All,

     

    Currently we have a little wordpress network.... We want to get all the latest network comments.

    I have stored the db prefixes in an array

    $prefixx = array('delo_', 'dna_', 'lcp_', 'os_', 'wp_');
    

     

    Now i have this loop:

    	foreach ($prefixx as $prefix)
    	{ 
    		$comments = $wpdb->get_results("
    		SELECT ". $prefix ."comments.comment_author AS author, ". $prefix ."posts.post_title AS title,".$prefix."posts.guid AS guid, ".$prefix."comments.comment_date AS date
    		FROM ". $prefix ."comments, ". $prefix ."posts
    		WHERE ". $prefix ."comments.comment_post_ID = ". $prefix ."posts.ID
    		AND ". $prefix ."posts.post_status = 'publish'
    		AND ". $prefix ."comments.comment_approved = 1
    		ORDER BY ". $prefix ."comments.comment_date
    		DESC
    		", ARRAY_A);
    
    		foreach ($comments as $c)
    		{
    			$arr[$c['date']] = $c;
    		}
    	}
    

     

    The goal to get the latest 10 comments (total) from all the tables. Like this, it works fine as i get all the comments, then sort them on key... But i get them ALL.

     

    Is there a more efficient way  like:

    select ......

    FROM table1, table2, table3 etc etc ?

  2. Why would you want a human readable url query string with passwords and usernames? This is very vulnerable for malicious visitors!  its not smart, especially with passwords. Dont do that! Use $_POST instead!

     

    IF you still want this.... Dont use http_build_query as this will return a encoded url query string.

    You have to build this manually like

    page.php?Type=myparam&Username=dazd&Password=nk98830&id=0&Cols_Returned=numfrom,sentdata
    

     

    replace the values with vairables so it will be dynamically

  3. Thx! Any other possibility for this ? I want to use the keys as well, and add a prefix to the key accordingly.... Array_merge does not support key options in this way as far as i know.

     

    So:

    array(array('Key' => 1,2,3,array(4,5,6, array('Key' => 7,8,9))))

     

    the second key 'Key' must get a prefix.... is not really possible with array_merge ?!

     

    Cheers

×
×
  • 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.