Jump to content

dreamwest

Members
  • Posts

    1,223
  • Joined

  • Last visited

    Never

Posts posted by dreamwest

  1. Grouping is important when select * distinct

     

       
    
    $res = mysql_query( "SELECT distinct * FROM table_a as a, table_b as b, table_c as group by a.name ORDER BY a.id ASC"); 
    
    

     

    Otherwise try this assumed method:

     

       
    
    $res = mysql_query( "SELECT distinct name FROM table_a as a, table_b as b, table_c as group by a.name ORDER BY a.id ASC"); 
    
    

  2. Im trying to get a number to represent a date name

     

    date('F'); // january

    date('n'); //january = 1

     

    So

     

    01 = January

    02 = Feburary

     

    etc...

     

    $mth = 02;
    
    $mth_name= ; //convert numeric to month name
    
    echo $mh_name; //  Feburary
    
    

  3. Ive stored a string in the database with deliminators "|" now how can i seperate the string and add extra info to it

     

    String:

    Sam Neill|William H. Macy|Tea Leoni|

     

    What i need:

    
    <a href='/Movies/&actor=Sam Neill'>Sam Neill</a>
    <a href='/Movies/&actor=William H. Macy'>William H. Macy</a>
    <a href='/Movies/&actor=Tea Leoni'>Tea Leoni</a>
    
    

  4. I have 2 foreach loops and need to concat the 2nd loop

     

    	
    foreach ($c as $a) { //sentences (loops 10 times)
    
    foreach ($d[1] as $e) {//words (loops up to 6 times)
    
            $cast .= trim($e)."|"; 
    }
    
    echo " Cast: {$cast}<br>";
    
    }//end foreach

     

    Basically this keep concating the first loop as well

     

    eg.

     

    1st loop:

    Cast: Gary Cooper|Basil Rathbone|

     

    2nd loop:

    Cast: Gary Cooper|Basil Rathbone|Errol Flynn|Olivia de Havilland|

     

    3rd loop:

    Cast: Gary Cooper|Basil Rathbone|Errol Flynn|Olivia de Havilland|Nikolai Cherkasov|

     

    etc...

     

    What it should be is:

     

    1st loop:

    Cast: Gary Cooper|Basil Rathbone|

     

    2nd loop:

    Cast: Errol Flynn|Olivia de Havilland|

     

    3rd loop:

    Cast: Nikolai Cherkasov|

  5. 
    $src = file_get_contents('http://folding.extremeoverclocking.com/user_summary.php?s=&u=454083');
    
    preg_match_all('~<td align\s?=\s?[\'"]right[\'"]>(.*?)</td>~is', $src, $c);
    
    foreach ($c[1] as $a) {
    
    echo "{$a}";
    }
    

  6. I have a list of movies, but i need to add some info to the beginning of each line:

     

    Notorious
    Fox Searchlight Pictures
    Dir., George Tillman Jr.; Cast, Jamal Woolard, Angela Bassett, Derek Luke, Antonique Smith, Anthony Mackie, Naturi Naughton, Sean Ringgold, Marc Jon Jefferies
    
    
    Paul Blart: Mall Cop
    Columbia
    Dir., Steve Carr; Cast, Kevin James, Jayma Mays, Shirley Knight

     

    What i need to do is split each block up into lines and add additional info to them

    Movie:  Notorious
    Studio: Fox Searchlight Pictures
    Cast: Dir., George Tillman Jr.; Cast, Jamal Woolard, Angela Bassett, Derek Luke, Antonique Smith, Anthony Mackie, Naturi Naughton, Sean Ringgold, Marc Jon Jefferies
    
    
    Movie: Paul Blart: Mall Cop
    Studio: Columbia
    Cast: Dir., Steve Carr; Cast, Kevin James, Jayma Mays, Shirley Knight
    
    

     

    There are always to blank lines in between each paragraph

  7. 	var iframe = document.createElement("iframe");
    iframe.setAttribute("id","ajax-temp");
    iframe.setAttribute("name","ajax-temp");
    iframe.setAttribute("width","0");
    iframe.setAttribute("height","0");
    iframe.setAttribute("border","0");
    iframe.setAttribute("style","width: 0; height: 0; border: none;");
    form.parentNode.appendChild(iframe);
    window.frames['ajax-temp'].name="ajax-temp";

  8. I want to pass a title through $_GET, but i need to encrypt it so no one can alter the title as they are stored in a database

     

    Encrypt the link:

    $encrypt = "mary had a little lamb"; //encrypt this
    $link = "http://site.com/index.php?title={$encrypt}";

     

    Link (what the viewer sees) : 

    http://site.com/index.php?title=656gyifhkbu+_tr6$fhjgfjhgjkg

     

    play.php:

    $title = $_GET['title']; //decrypt this so it is the original string "mary had a little lamb"

  9. if you have an image url:

     

    http://site.com/img/pic.jpg

     

    Just parse the url and curl the site

     

    $img_url = "http://www.phpfreaks.com/media/images/forums/logo.png";
    
    $url = parse_url($img_url);
    $u = "http://".$url['host'];
    
    $ch = curl_init($u);
    curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.0; da; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_TIMEOUT, 15);
    $str = curl_exec($ch);
    curl_close($ch); 
    
    if ($str === false) {
    echo "cURL failed  ";
    die();
    }
    
    echo "<img src='{$img_url}'><hr>This image found here!<hr>";
    echo $str;

     

  10. So you have 2 paths - the url (which is dynamic):

     

    http://www.google.com/one_level_up/2_levels_up/3levels_up/

    or

    http://www.google.com/one_level_up/2_levels_up/

    or

    http://www.google.com/one_level_up/

     

    and the path (which is also dynamic):

     

    ../../intl/en/images/logo.gif

     

     

    So what your lookig for is the full image url ?? eg..

     

    http://www.google.com/one_level_up/2_levels_up/intl/en/images/logo.gif

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