Jump to content

phpretard

Members
  • Posts

    821
  • Joined

  • Last visited

    Never

Posts posted by phpretard

  1. I can't really modify the headers...

     

    I would like to display it as an <img src="DBInfo"> tag instead.

     

    Is this even possible?

     

    The code below displays it fine but I am trying to display it as the website header and it give header errors

     

    <?
    
    ...connect
    
    header("Content-length: $size");
    header("Content-type: $type");
    header("Content-Disposition: attachment; filename=$name");
    echo $content;
    
    ?>

     

     

    I would upload it straight to a file but... I have permission to Temp folder problems

  2. <?php
    
    $con = mysql_connect("localhost","root","b123dw9WHT3");
    
    if (!$con)
      {
      die('Could not connect: ' . mysql_error());
      }
      
    mysql_select_db("company", $con);
    
    $result = mysql_query("SELECT coName FROM contact WHERE coID='1' ");
    
    while($row = mysql_fetch_array($result))
      {
      $info=$row['coName'];
      
      echo "<input tpe="text" value="$info" />
      }
      
    mysql_close($con);
    ?>

  3. how can turn this into dynamic code without typing all the options?

     

     

    I would like:

     

    $start_year = date('Y');

     

    $end_year = $start_year -80 years

     

     

    <select name="DateOfBirth_Year">
    <option> - Year - </option>
    <option value="2004">2004</option>
    <option value="2003">2003</option>
    <option value="2002">2002</option>
    <option value="2001">2001</option>
    <option value="2000">2000</option>
    <option value="1999">1999</option>
    <option value="1998">1998</option>
    <option value="1997">1997</option>
    <option value="1996">1996</option>
    <option value="1995">1995</option>
    <option value="1994">1994</option>
    <option value="1993">1993</option>
    <option value="1992">1992</option>
    <option value="1991">1991</option>
    <option value="1990">1990</option>
    <option value="1989">1989</option>
    <option value="1988">1988</option>
    <option value="1987">1987</option>
    <option value="1986">1986</option>
    </select>

  4. I am trying to display links on a page read from my DB.

     

    I would like them to display:

     

    CAT 1

    Link 1

    Link 2

    Link 3

    etc...

     

    CAT 2

    Link 1

    Link 2

    Link 3

    etc...

     

    I know the code below is silly but it's to illustrate my needs.

    The DB rows are setup as is in the code...the echo is silly

     

     

    <?
    $result_links = mysql_query("SELECT * FROM links ORDER by cat");
    while($row = mysql_fetch_array($result_links))
     {
     $id=$row['id'];
     $cat=$row['cat'];
     $url=$row['url'];
     $display=$row['display'];
    
     echo"<h4>Category 1</h4>";
     echo"all the links assc. with category 1";
    
     echo"<h4>Category 2</h4>";
     echo"all the links assc. with category 2";
    
     echo"<h4>Category 3</h4>";
     echo"all the links assc. with category 3";
    
     echo"<h4>Category 4</h4>";
     echo"all the links assc. with category 4";
     }
    
    ?>

     

     

    Thanks PHP FREAKS!

  5. 		$find = strtoupper($find); 
    	$find = strip_tags($find); 
    	$find = trim ($find); 
    	$find = explode(" ", $find);
    
    	//Now we search for our search term, in the field the user specified 
    	foreach ($find as $term){
    	$data = mysql_query("SELECT * FROM cases WHERE (casetype LIKE '%$term%') OR (caseinfo LIKE '%$term%') ");
    	}
    	$matchescount=mysql_num_rows($data);
    	$find = implode(" ", $find);

  6. SCENARIO 1:

    "I need to Find Two words" IS IN THE DB TABLES --|casetype|-- AND --|caseinfo|--.

     

     

    If I search for "Find" result returned

     

    If I search for "Two" result returned

     

    Problem:

    If I search for  "Find Two" no result.

     

     

    SCENARIO 2:

     

    "I need to Find" IS IN THE DB TABLE --|casetype|--

    "Two words"  IS IN THE DB TABLE --|caseinfo|--

     

    If I search for "Find" result returned

     

    If I search for "Two" result returned

     

    Problem:

    If I search for  "Find Two" no result.

     

     

     

     

  7. I have a site search but for somes reason it is limited to a one word search.

     

    Search1: If I search for "Find" or "Two" it works great. 

    Search2: If I were to search for "Find Two" It returns nothing yet I know both are in the DB (based on Search1).

     

     

    $find="ONEWORD" //the search return results
    $find="TWO WORDS" //the search return nothing and I know the info is there.
    
    $find = strtoupper($find); 
    $find = strip_tags($find); 
    $find = trim ($find);
    
    $data = mysql_query("SELECT * FROM cases WHERE (casetype LIKE '%$find%') OR (caseinfo LIKE '%$find%') ");
    
    while($result = mysql_fetch_array($data)) 
    { 
    $id=$result['id'];
    echo "<h1>".$result['casetype']."</h1>"; 
    echo "<hr />";
    $caseinfo=$result['caseinfo'];
    $caseinfofull=$result['caseinfo'];
    echo "$caseinfofull";
    echo  $shortdesc = substr_replace($caseinfo, '', 400, -1) . "..."; 
    echo "<br>"; 
    } 

  8. Basically the same as my first question but I noticed if I search with more than one word it returns nothing.

     

    $find="ONE"; // WORKS GREAT
    $find="TWO WORDS"; // NO RESULTS ... I KNOW THERE IN THE DB THOUGH
    
    $find = strtoupper($find); 
    $find = strip_tags($find); 
    $find = trim ($find); 
    
    $data = mysql_query("SELECT * FROM cases WHERE (casetype LIKE '%$find%') OR (caseinfo LIKE '%$find%') ");
    while($result = mysql_fetch_array($data)) 
    { 
    echo "<h1>".$result['casetype']."</h1>"; 
    echo "<hr />";
    $caseinfo=$result['caseinfo'];
    $caseinfofull=$result['caseinfo'];
    echo $caseinfofull;
    echo $shortdesc = substr_replace($caseinfo, '', 400, -1) . "; 
    echo "<br>"; 
    echo "<br>"; 
    }

  9. This only displays one result and I can't figure out why...

     

    There are 2 fields in the DB I am trying to search through and look for the keyword typed in the search field:

    FIELD 1:casetype VARCHAR

    FIELD 2:caseinfo TEXT

     

    I can get it search and display all when search one field at a time but it only dispalys one result if I try to search both fields.

     

    $find=$_POST['find'];
    
    $data = mysql_query("SELECT * FROM cases WHERE (casetype or caseinfo LIKE'%$find%') ");
    	while($result = mysql_fetch_array($data)) 
    	{ 
    	$id=$result['id'];
    	echo "<h1>".$result['casetype']."</h1>"; 
    	echo "<hr />";
    	$caseinfo=$result['caseinfo'];
    	$caseinfofull=$result['caseinfo'];
    	echo"<div id='$id' style='display:none'>$caseinfofull [<a href='javascript:void(0)' onclick=\"Hide('$id'), Show('partial$id')\">close</a>]</div>";
    	echo "<div id='partial$id' style='display:block'>".$shortdesc = substr_replace($caseinfo, '', 400, -1) . "... <a href='javascript:void(0)' onclick=\"Show('$id'), Hide('partial$id')\">read more</a></div>"; 
    	echo "<br>"; 
    	echo "<br>"; 
    	} 

  10. Thank you for the response.

     

    I understand wht you did there.

     

    what I need is the results of what you did to go through the databse and send an email for each query match.

     

    
    while($row = mysql_fetch_array($result))
    {
      $email=$row['email'];
      $billto=$row['bill_to'];
      $phone=$row['phone'];
    
      echo "$email<br />";
      echo "$billto<br />";
      echo "$phone<br />";
      echo "<hr />";
    }
    
       foreach (($email  $billto  $phone) as $mailto){
    
       email script
    
       }
    
    }
    
    

     

    Am I making any sense?

  11. Each row in my DB contains --  email | phone | bill_to  ---

     

    I would like to send an email to each person with the information specific to them.

     

    The code below does display the information but I don't believe it associates them.

     

    So each email would read:

     

    -------------------------------------------

    Dear Person I am emailing,

     

    Here is the information we have on file:

     

    Email Address:  email[at]email.com

    Bill-To Number: 123456

    Phone Number: 123-456-7890

     

    I hope you got this,

    Anthony

     

    ps.  if you did get this thank you phpfreaks.

    -------------------------------------------

     

     
    
    
    while($row = mysql_fetch_array($result))
      {
      $email[]=$row['email'];
      $billto[]=$row['bill_to'];
      $phone[]=$row['phone'];
      }
      
      foreach($email as $mailto){
      echo "$mailto<br />"; 
      }
      foreach($billto as $billnumber){
      echo "$billnumber<br />"; 
      }
      foreach($phone as $telephone){
      echo "$telephone<br />"; 
      } 
    

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