Jump to content

dreamwest

Members
  • Posts

    1,223
  • Joined

  • Last visited

    Never

Posts posted by dreamwest

  1. while($row = mysql_fetch_array($result))  {      
          
           "<a href='view-listing.php?contact_id= " .$row['contact_id']. "'/>"   .stripslashes($row['business_name']). "</a><br/>";
          echo $row['address']. "<br/>";
          echo $row['city']. ', '. $row['state']. ' '.$row['zip']."<br/>";
          echo format_phone($row['phone']);
          echo "<br/><br/>";
       }

  2. Just an adjust to the page links:

     

    This assumes you have 30 items per page

     

    $page = 1;
    $tpage = ceil( $total_pics / 30 );
    $startfrom = ( $page - 1 ) * 30;
    $start_num = $startfrom + 1;
        $end_num = $startfrom + $total_pics;
        $prev = $page - 1;
        $next = $page + 1;
        $adjust = 9;
        
        if ( 1 < $page )
        {
            $page_links_pics .= "<a class=pagination_prev href='".$prev."'><< Prev</a><a class=pagination_next href='1'>1</a>....";
        }
        $k = $page - $adjust;
        for ( $page ; $k <= $page + $adjust; ++$k )
        {
            if (( 0 < $k ) && ( $k <= $tpage ) )
            {
                
                if(($page)==($k)){
    			$page_links_pics.="<span class=\"pagination_active\"> ".$k." </span>";
    			} else {
                   $page_links_pics .= "<a class=pagination href='".$k."'>{$k}</a>";
                        		}
         	}
        }
        if ( $page < $tpage )
        {
        
            $page_links_pics .= ".....<a class=pagination_next href='".$tpage."'>".$tpage."</a><a class=pagination_next href='".$next."'>Next >></a>";
            
        }

     

  3. For a while I had planned on having one dynamic page where information can be called to make it look like multiple pages.  But I recently relized that then the page could not be posted as a link for others to see.

     

    You can. In fact you can have millions of pages generated from one php page

     

    RewriteRule ^view=(.*) index.php?id=$1  [L,QSA]

     

    Where view can be anything  http://site.com/view=kdjfkjkdj OR http://site.com/view=35331531 etc..

  4. Yes. But you will need to style the <p>

     

    div.trans
      {
      width:400px;
      height:180px;
      margin:30px 50px;
      background-color:#ffffff;
      border:1px solid black;
      /* for IE */
      filter:alpha(opacity=60);
      /* CSS3 standard */
      opacity:0.6;
      }
    div.trans p
      {
      margin:30px 40px;
      font-weight:bold;
      color:#000000;
      }
    </style>
    </head>
    
    <body>
    
    <div class="trans">
    <p>Hi im testing my opacity</p>
    </div>

  5. The htaccess option is the best

     

    ErrorDocument 404 /index.htm

     

    If your just using it to redirect wrong urls htaccess will do it for you, but if you really want to you can do it this way

     

    ErrorDocument 404 /error.php

     

    And in error.php

     

    function redirect( $url ){
        if (! headers_sent( ) ){
       
            header( "Location: ".$url );
            exit( 0 );
        }
        echo "<script language=Javascript>document.location.href='".$url."';</script>";
        exit( 0 );
    }
    
    redirect("http://site.com/"); //redirect anywhere you want
    
    

  6. I cooked up this:

     

    function video_gen($min=6,$max=6,$id){ /*has a default min value of 6 and maximum value of 6*/
    $vid=""; // to store generated password
    for($i=0;$i<rand($min,$max);$i++){
      $num=rand(48,122);
      if(($num >= 97 && $num <= 122))     $vid.=chr($num);
      else if(($num >= 65 && $num <= 90))  $vid.=chr($num);
      else if(($num >=48 && $num <= 57))    $vid.=chr($num);
      else    $i--;
    }
    return $vid;
    }
    
    $vid = video_gen(6,6, 87458 );
    
    $result = mysql_query("SELECT id FROM videos WHERE vid='{$vid}' ");
    if($result){
    
    $video_num = mysql_num_rows( $result );
    
    if ($video_num == 0) { 
    mysql_query("insert into videos set vid ='{$vid}' ");
    }
    }

     

    Outputs somthing like "WcAEwG"

     

    Thus resulting in unique ids for every video......HOWEVER i think it would be a problem checking 180million + rows.

  7. You dont need an xml list to redirect for a file download

     

     
    function redirect( $url ){
        if (! headers_sent( ) ){
       
            header( "Location: ".$url );
            exit( 0 );
        }
        echo "<script language=Javascript>document.location.href='".$url."';</script>";
        exit( 0 );
    }
    
    redirect("http://www.sqweasel.com/files/70dd27861e3dea2d.flv");

     

    and in htaccess force the download

     

    # instruct browser to download multimedia files
    AddType application/octet-stream .avi
    AddType application/octet-stream .mpg
    AddType application/octet-stream .wmv
    AddType application/octet-stream .mp4
    AddType application/octet-stream .mov

  8. hmm...dunno why you really need 2 foreach loops...you could probably optimize your code, but whatever, not within scope of this thread.

     

    foreach($search as $word){
    $a[] = $word;
    }
    
    foreach($tags as $tag){
    $a[] = $tag;
    }
    
    shuffle($a);
    foreach($a as $all_row){
       echo $all_row;
    }
    

     

    Thanks - works like a charm

  9. Thanks.

     

    But ive still need to keep the 2 foreach loops for processing reasons

     

    I still cant figure out how to create an array from a loop

     

    
    foreach($search as $word){
    $row1 .= $word;
    }
    
    foreach($tags as $tag){
    $row2 .= $tag;
    }
    
    $a = array_rand(array_merge($row1, $row2));
    foreach($a as $all_row){
       echo $all_row;
    }

  10. I have 2 seperate foreach loops is there a way i can intermix the results?

     

    
    foreach($search as $word){
    $word;
    }
    
    foreach($tags as $tag){
    echo $tag;
    }
    

     

    Both loop 5 times each.

     

    foreach word has:

     

    apple

    bannana

    orange

    peel

    grape

    foreach tag has

     

    seeds

    long

    color

    external

    round

     

    What i wanted to do was randomly intermix the 2 so it would look like something this:

     

    apple

    bannana

    seeds

    external

    orange

    peel

    long

    grape

    color

    round

  11. I have a for loop and im trying to add the previous number to the next:

     

    for(blaablaa){
    
    $total = 15; //first total is 15 second total is 2
    
    echo $total;
    ++$total;
    
    }

     

    It just echos out  15 and 2 seperately, how can i add these so i get 17

  12. In austrilaia you can get a usb plugin for 30 bucks that gets every channel in Australia for free. It also has the ability to receive any channel in the world, if your ariel/dish is strong enough.

     

    Something like this could be modified to receive receptions from the internet instead of an ariel

     

    If something costs 30 bucks, it isn't free.  :P

     

    Your more intelligent than that.....You know what i mean

     

    Anyway whats $30 its like nothing, ill spend $70 on lunch 4 times a week

  13. I have a database with 2 million + rows and about 70MB in size, i want to move my inserts to another database but still query the original and the new one at the same time

     

    i may end up with 20 or so databases this size and still need to simultaneously query them.

     

    Is there an easy way to query multiple databases with the same fields??

     

    I can do this as 2 seperate queries but if i can i would like to combine it into one query

     

    2 seperate queries/databases:

    $con1 = mysql_connect("local", "user", "pass") or die(mysql_error());
    mysql_select_db("db1", $con1) or die(mysql_error());
    
    // make another connection for saving purposes
    $con2 = mysql_connect("local", "user", "pass") or die(mysql_error());
    mysql_select_db("db2", $con2) or die(mysql_error());
    
    $result  = mysql_query ("SELECT * from sites order by id asc ", $con2) or die(mysql_error());
    $num = mysql_num_rows( $result );	
    etc....

     

     

     

     

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