Jump to content

cmgmyr

Members
  • Posts

    1,278
  • Joined

  • Last visited

    Never

Posts posted by cmgmyr

  1. $500 is REALLY unfair to you. You will be doing a LOT more work...even if you did get all pre-made software (for free) like tippy_102 said.

     

     

    I would probably charge about $5,000 for this project, just because I have everything built except for the blogs and CCbill, so everything else can be up and running within about 2-5 hours. BTW...that's $5,000 for the PHP/MySQL programming only, this does not include design and front end stuff like HTML/CSS layout

  2. wow, that's pretty cool. I don't use Unix all that much but I think it's pretty neat that you can do stuff like that.

     

    So what happens when you want to use the caps lock? You should make a work around where it's like Shift+Caps to actually turn the Caps on. Just a thought :)

  3. I like tama's they sound pretty good. I have a Mapex Orion Classic, Tama Swingstar (for practice), Tama Starclassic Birch, and a Pearl Reference Special Edition for 2007 (only 1 of 40 made). I love music and playing...even MORE then PHP haha :D

     

    ...So as promised, here is a little snapshot of my desk

     

    [attachment deleted by admin]

  4. @thorpe - What kind of drum set is that?

     

    @roopurt18 - I have the same chair that you are sitting in. Isn't it great! I love mine. And gotta love the klipsch speakers.

     

    ...I'll take some pics of my set up tomorrow. ;)

  5. yeah either way you need to do it.

     

    you can also do something like this:

    <?php
    foreach($your_array as $new_value){
    echo "Do something with $new_value";
    }
    ?>

     

    You can do that so you don't need to know how many are in the array

  6. Try something like this:

    <select name="clubdrop"><option value="">Pick</option>
    <?php 
    $sql = "SELECT * FROM club";
      	$result = mysql_query($sql);
    while($row = mysql_fetch_array($result)){
    	$club_id = $row["club_id"];
    	$clubName = $row["clubn"];
    	$club_id == $YOUR_OTHER_CLUB_ID ? $sel = 'SELECTED' : $sel = '';
    ?>
    <option value="<?php echo $club_id ?>" <?php echo $sel ?>><?php echo $clubName ?></option>
    <?php 
    } ?>
    </select>

  7. Here is my code that I used:

    <?php
    $end = '';
    
    $zip_from = $_SESSION['zipcode'];
    $zips = $z->get_zips_in_range($zip_from, $_SESSION['radius']);
    
    $zip = '';
    $x = 1;
    $count_zips = count($zips);
    if($count_zips > 0){
        $zip = "zip = $zip_from OR ";
    }
    
    foreach ($zips as $key => $value) {
        $zip .= "zip = $key";
    
        if($x < $count_zips){
            $zip .= " OR ";
        }else{
            $zip .= " ";
        }
    
        $x++;
    }
    $end .= $zip;
    
    $sql = "SELECT 
                *  
            FROM 
                dealers
            WHERE 
                access = '1' AND search = '1' AND ($end) 
            ORDER BY 
                cname ASC";
    
    $result = $db->query($sql);
    $numrows = $db->numRows($result);
    
    if($numrows > 0){
        $dealers = array();
        while($row = $db->fetch($result)){
            $cname = $row['cname'];
            $address = $row['address'];
            $city = $row['city'];
            $state = $row['state'];
            $zip = $row['zip'];
            $phone = $row['phone'];
            $url = $row['url'];
            if(strlen($url) > 0){
                $url = $func->convertURL($url);
                $url = "<a href=\"$url\" target=\"_blank\">Visit their Web site</a><br />";
            }
            
            $map = "$address $city, $state $zip";
            $map = str_replace(' ', '+', $map);
            
            $miles = $z->get_distance($zip_from, $zip);
            
            $address = "$address <br />$city, $state $zip<br />$phone";
            
            $dealers[] = array("name" => $cname, "address" => $address, "map" => $map, "miles" => $miles, "url" => $url, "zip" => $zip);
        }
        
        //Get dealers in the selected zip and sort out others
        $dealers1 = array();
        $dealers2 = array();
        $count = count($dealers);
        for($x=0;$x<$count;$x++){
            $name = $dealers[$x]['name'];
            $address = $dealers[$x]['address'];
            $map = $dealers[$x]['map'];
            $miles = $dealers[$x]['miles'];
            $url = $dealers[$x]['url'];
            $zip = $dealers[$x]['zip'];
            
            if($_SESSION['zipcode'] == $zip){
                $dealers1[] = array("name" => $name, "address" => $address, "map" => $map, "miles" => $miles, "url" => $url, "zip" => $zip);
            }else{
                $dealers2[] = array("name" => $name, "address" => $address, "map" => $map, "miles" => $miles, "url" => $url, "zip" => $zip);
            }
        }
        
        $dealers2 = $func->sortMultiArray($dealers2, 'miles');
        
        $dealers = array();
        $dealers = array_merge($dealers1, $dealers2);
    }
    ?>

     

    And how to sort a multi-dimentional array

    <?php
    function sortMultiArray($array, $index, $order='asc', $natsort=FALSE, $case_sensitive=FALSE){ 
            if(is_array($array) && count($array)>0)  
            { 
               foreach(array_keys($array) as $key)  
                   $temp[$key]=$array[$key][$index]; 
                   if(!$natsort)  
                       ($order=='asc')? asort($temp) : arsort($temp); 
                  else  
                  { 
                     ($case_sensitive)? natsort($temp) : natcasesort($temp); 
                     if($order!='asc')  
                         $temp=array_reverse($temp,TRUE); 
               } 
               foreach(array_keys($temp) as $key)  
                   (is_numeric($key))? $sorted[]=$array[$key] : $sorted[$key]=$array[$key]; 
               return $sorted; 
          } 
          return $array; 
        }
    ?>

     

    $dealers1 are the records where the zip code matches so the distance would be 0 miles. $dealers2 are the records where it needs to sort by distance. I hope this helps you out.

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