PHP is the Delivery Boy

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • InksEtc
    New Member
    • Sep 2010
    • 4

    #1

    PHP is the Delivery Boy

    Well...Ok. Maybe NOT the delivery boy but PHP sure seems like one. I mean...the Pizza Place is like the Database Server and my home is like HTML and PHP is who "concatenat es" or joins the hot and fresh script to the HTML that sits inside the browser; which is like the kitchen table where we end up eating the pizza.

    Next, I would like to know if someone can someone help me answer this question; and if you do I will make you my own kind of pizza. I have created a php script that takes a url file out of the database server ~ phpmyadmin and places the file onto IE ~ browser...but I have to "click" the file in order for it to become activated or open up. What php code do I use so I can automatically open up the retreived file? Here try this and place "lc51" into the textbox and you will see what I mean. http://inks-etc.org/SearchEngine/asif.html For anyone to help me solve this problem I will give you my pizza with is made with 6 months of ink that your printer beholds at a wholesale cost. Hmmm. Delicious...I mean for your printer and lovely for you as it saves you so much. This is what you will receive after a proactive solution is offered http://inks-etc.org/customerconnect ion/kraft.html you will recieve this but in your name.

    Thank You,

    Jason Kraft
    Inks Etc. LLC
    941-993-8943
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    There are a few ways to read the contents of a file, one of which would be to use file_get_conten ts.

    Code:
    <?php
    
    $file = "/path/to/your/file.txt"
    
    echo file_get_contents($file);
    Weird analogy for PHP, BTW ;)

    Comment

    • InksEtc
      New Member
      • Sep 2010
      • 4

      #3
      On the bottom of this script how do I input the file_get_conten ts($file);? Please show me. Thanks Markus...and tell me what printer you have so I can "deliver" a thank you when your response activates my search engine : )

      Code:
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
      <meta http-equiv="Content-Type" content="text/php; charset=utf-8" />
      <title>asif</title>
      </head>
      
      <body>
      <?php
      
      /*connect to out database*/
      include ("../SearchEngine/dbc_site.php");
      
      /*get data and trim is a function that removes spaces at the beginning and end of text so they don't become stored*/
      $button = $_POST['submit'];
      $search = trim($_POST['keyword']);
      
      if($search!=" ")
      {		
           // explode the keywords; the 1st term "" is the way to explode and the 2nd term is what your exploding; the $search is the $GET
           $search_exploded = explode (" " , $search);
           // looping
           foreach ($search_exploded as $search_each)
           // construct query => x++ shows how many time the loop has been thru
           //$construct .= is the same as $construct = $construct . "$xyz"
           {
            $x++;
           // if ... this is the 1st time we are looping
            if ($x==1)
           // the % are wildcards that stand in for any other char before or afterthe word
             $construct .= "keyword LIKE '%$search_each%'";
           // else...allow more keywords that are looped by the con't phrase OR keywords LIKE that con't over and over again ~ loop
            else
             $construct .= " OR keyword LIKE '%$search_each%'";
           }
      	 //breaks the reference with the last element [url]http://us.php.net/manual/en/control-structures.foreach.php[/url]
      	unset ($search_each);
         //echo out with the value construct / this is a $query
         $query = "SELECT * FROM Ink_Engine WHERE $construct";
         //this is a $result
         $run = mysqli_query($dbc, $query);
         $foundnum = mysqli_num_rows($run);
          if ($foundnum==0)
           //this is the webpage that shows up when the keyword is invalid and customer is to try again
      	  {
      	    include ("../thinker/backengine.html");
      	  }
          else
          {
           //echo "$foundnum results found!";
           while ($runrows = mysqli_fetch_assoc($run))
            {
             //get data
             $keyword = $runrows ['keyword'];
             $desc = $runrows ['description'];
             $url = $runrows ['url'];
             echo "<table>
      		 			<tr><td><b>$keyword</b></td></tr><br />
      					<tr><td>$desc</td></tr><br />
      					<tr><td><a href='$url'>$url</a></td></tr>
      				 </table>";
            }
          }	
        die ();
      }
      else
              {
                      echo "No result found.";
              }
      ?>
      </body>
      </html>
      Last edited by Dormilich; Nov 11 '10, 07:12 AM. Reason: please use [CODE] [/CODE] tags when posting code

      Comment

      Working...