Jump to content

phpretard

Members
  • Posts

    821
  • Joined

  • Last visited

    Never

Posts posted by phpretard

  1. Does this help?

     

    <?php
    for($i=0; $i<8; ++$i)
    {
        echo $i,"\t";
        switch($i)
        {
        case 1: echo "One"; break;
        case 2:
        default: echo "Thingy"; break;
        case 3:
        case 4: echo "Three or Four"; break;
        case 5: echo "Five"; break;
        }
        echo "\n";
    }
    ?>

  2. I am pulling all the counties from a table [ZipCodes] based on State values (comma seperated) from a different table [members].

     

    Right now the code is working fine in terms of pulling ALL COUNTIES...but

     

    I am trying to seperate the counties according to State and am having difficullty there.

     

    Can some one look at this come and help me out?

     

    <?
    
    $GET_STATESsql = "SELECT * FROM members WHERE MemberID='APP-1299754007' "; 
    
    $GET_STATESresult = mysql_query($GET_STATESsql);
    
    while($row = mysql_fetch_array($GET_STATESresult)) { 
    
    $States=$row['States2'];
    
    }
    
    $States2=explode(", ", $States);
    
    // print_r($States2); I DONT KNOW IF THIS HELPS BUT THE PRINT IS  -- Array ( [0] => FL [1] => GA [2] => AL ) --
    
    
    
      foreach($States2 as $States1){
      
    	$ALL_COUNTIESresult = mysql_query("SELECT DISTINCT County FROM ZipCodes WHERE State='$States1' ORDER by County"); 
    
    	while($row = mysql_fetch_array($ALL_COUNTIESresult))
    	{
    
    	$AllCounties[] = $row['County'];
    
    	}
    	$CountyIM=implode(",", $AllCounties);
    	$CountyEX=explode(",", $CountyIM);
    	$CountyTotal=count($CountyEX);
    
    
    	foreach ($CountyEX as $County1){
    
    	if(stristr($States, $County1)) {
    
    	$County3="<div style='width:24%; float:left; font-size:13px; height:25px;'><input type=checkbox name=Counties[] Value='$County1' checked> $County1</div>"; 
    
    	} // END STRISTR
    
    	else { 
    
    	$County3="<div style='width:24%; float:left; font-size:13px; height:25px;'><input type=checkbox name=Counties[] Value='$County1'> $County1</div>"; 
    
    	} // END ELSE
    
    	echo "$County3";
    
    	} // END FOR FOR EACH 
    
    } // END FOR EACH STATES 2
    
    ?>

  3. If I check Residential AND Commercial the correct result displays

     

    If I check FHA AND VA the correct result displays

     

    If I only check one of the boxes then both entries display.

     

    My objective is if I check VA only then the row WHERE VA has the value of "1" should display.

     

    Both Database entries have FL for the "Search / State" value.

     

    I have attached a snip of the database to help illistrate my problem.

     

    /// THE FORM
    
    <form action='' method=POST>
    <input type='checkbox' name='Residential' value='1'>
    <input type='checkbox' name='FHA' value='1'>
    <input type='checkbox' name='Commercial' value='1'>
    <input type='checkbox' name='VA' value='1'>
    <input type='text' name='Search' size=30> 
    <input type=submit value=Search name=GOSearch>
    </form>
    
    
    /// THE POST
    
    $Residential=$_POST['Residential'];
    $Commercial=$_POST['Commercial'];
    $FHA=$_POST['FHA'];
    $VA=$_POST['VA'];
    $Search=$_POST['Search'];	
    
    
    /// THE QUERY
    
    $result = mysql_query("SELECT * FROM members WHERE (State='$Search') AND (Residential='$Residential' OR Commercial='$Commercial' OR FHA='$FHA' OR VA='$VA') ORDER by id");
    
    
    
    $num_rows = mysql_num_rows($result);
    
    if ($num_rows > 0){
    
    while($row = mysql_fetch_array($result))
    {
                 RESULT
                 }
    }

     

    Any help today?

     

    [attachment deleted by admin]

  4. It's the same except that it grows one number up to ten.

     

    But it must start at 1.

     

     

      if ($img1==''){$img1="Image 1 <input type=file name='img1' id='img1' disabled><input type=hidden name=blank1 value='replace'>";}
      else{
      $img1="
      <a target=_blank href='$img1'>View Image 1</a> |  
      <a href='?page=secure/home&Spage=newProject&edit=$id&img=img1&rep=1&l=$img1'>Replace Image 1</a>
      <input type=hidden name=blank1 value='$img1'>
      ";
      }
      
      
      if ($img2==''){$img2="Image 2 <input type=file name='img2' id=img2 disabled><input type=hidden name=blank2 value='replace'>";}
      else{
      $img2="
      <a target=_blank href='$img2'>View Image 2</a> |  
      <a href='?page=secure/home&Spage=newProject&edit=$id&img=img2&rep=1&l=$img2'>Replace Image 2</a>
      <input type=hidden name=blank2 value='$img2'>
      ";
      }
      
      
      
        if ($img3==''){$img3="Image 3 <input type=file name='img3' id=img3><input type=hidden name=blank3 value='replace'>";}
      else{
      $img3="
      <a target=_blank href='$img3'>View Image 3</a> |  
      <a href='?page=secure/home&Spage=newProject&edit=$id&img=img3&rep=1&l=$img3'>Replace Image 1</a>
      <input type=hidden name=blank3 value='$img3'>
      ";
      }
      
    
        if ($img4==''){$img4="Image 4 <input type=file name='img4'><input type=hidden name=blank4 value='replace'>";}
      else{
      $img4="
      <a target=_blank href='$img4'>View Image 4</a> |  
      <a href='?page=secure/home&Spage=newProject&edit=$id&img=img1&rep=1&l=$img4'>Replace Image 4</a>
      <input type=hidden name=blank4 value='$img4'>
      ";
      }
      
      
        if ($img5==''){$img5="Image 5 <input type=file name='img5'><input type=hidden name=blank5 value='replace'>";}
      else{
      $img5="
      <a target=_blank href='$img5'>View Image 5</a> |  
      <a href='?page=secure/home&Spage=newProject&edit=$id&img=img5&rep=1&l=$img1'>Replace Image 5</a>
      <input type=hidden name=blank5 value='$img5'>
      ";
      }
      
      
        if ($img6==''){$img6="Image 6 <input type=file name='img6'><input type=hidden name=blank6 value='replace'>";}
      else{
      $img6="
      <a target=_blank href='$img6'>View Image 6</a> |  
      <a href='?page=secure/home&Spage=newProject&edit=$id&img=img6&rep=1&l=$img6'>Replace Image 6</a>
      <input type=hidden name=blank6 value='$img6'>
      ";
      }
      
      
        if ($img7==''){$img7="Image 7 <input type=file name='img7'><input type=hidden name=blank7 value='replace'>";}
      else{
      $img7="
      <a target=_blank href='$img7'>View Image 7</a> |  
      <a href='?page=secure/home&Spage=newProject&edit=$id&img=img7&rep=1&l=$img7'>Replace Image 7</a>
      <input type=hidden name=blank7 value='$img7'>
      ";
      }
      
      
        if ($img8==''){$img8="Image 8 <input type=file name='img8'><input type=hidden name=blank8 value='replace'>";}
      else{
      $img8="
      <a target=_blank href='$img8'>View Image 8</a> |  
      <a href='?page=secure/home&Spage=newProject&edit=$id&img=img8&rep=1&l=$img8'>Replace Image 8</a>
      <input type=hidden name=blank8 value='$img8'>
      ";
      }
    
    You should get a good laugh from this.  
      
        if ($img9==''){$img9="Image 9 <input type=file name='img9'><input type=hidden name=blank9 value='replace'>";}
      else{
      $img9="
      <a target=_blank href='$img9'>View Image 9</a> |  
      <a href='?page=secure/home&Spage=newProject&edit=$id&img=img9&rep=1&l=$img9'>Replace Image 9</a>
      <input type=hidden name=blank9 value='$img9'>
      ";
      }
      
      
        if ($img10==''){$img10="Image 10 <input type=file name='img10'><input type=hidden name=blank10 value='replace'>";}
      else{
      $img10="
      <a target=_blank href='$img10'>View Image 10</a> |  
      <a href='?page=secure/home&Spage=newProject&edit=$id&img=img1&rep=1&l=$img10'>Replace Image 10</a>
      <input type=hidden name=blank10 value='$img10'>
      ";
      }

  5. I am trying to poulate the file field from a database that already has the path the image or not. either way i would like for the file field to show what is in the DB and process the result of a submit wether it is changed or not changed.

     

    Is this even posible?

     

     

     

    $img1="path/to/image.jpg"
    
    Image 1<input type=file name='img1' value='$img1'>
    
    ////UPLOAD SCRIPT
    
    $rand=rand(111111, 999999);
    $uploaddir = "projects/$title";
    $path1 = $uploaddir . $rand."-".basename($_FILES['img1']['name']);
    move_uploaded_file($_FILES['img1']['tmp_name'], $path1);
    
    
    

     

    The field shows blank with the script I am using now.

     

    Any thoughts?

  6. I think I screwed up my question.  I need 5 images to show up from the DB. If the same image is going to be displayed more than once (one the same page) than I would like to have a default  image its place.

     

    Do you know what this means?

     

    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /backup/hsphere/local/home/mercodesigns/mercodesigns.com/classifieds/pages/ads.php on line 6

  7. I only want to display only one disint image on a page at s time this... if you refresh sometimes shows 2

     

    $result = mysql_query("SELECT DISTINCT image FROM ads ORDER by Rand() LIMIT 1");
    
    while($row = mysql_fetch_array($result))
      {
      $ADimage=$row['image'];
      
      
      $echo= "<div align='center'><img src='ads/$ADimage'></div>";
      
      
      }

     

    Any help tonight?

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