Jump to content

micmola

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

micmola's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have created an object and assigned values as follows: $car_object =& new Car(); $car_object->offer = 'Sale'; $car_object->type = 'Sport Car'; $car_object->location = "Buffalo, New york"; How can I store the $car_object inside a session variable? How can I get the $car_object out from the session variable? Please help a novice. Urgent.
  2. An example of having a for loop inside a mysql SELECT statement is below: $query = "SELECT * FROM car WHERE offer_type = '" . $transaction_type . for ($x=0; x<count($sentence_array); $x++) { "' AND car_name = '" . $sentence_array[$x] . "' OR car_color = '" . $sentence_array[$x] . "' OR car_seats = '" . $sentence_array[$x] . } "'"; The sentence_array contains one word per element. Please someone help me on this.
  3. Is it possible to have a loop inside a mysql select statement? If yes, can someone please give me an idea.
  4. Alright, thanks for your reply. Your question led me to review other options I had. I noticed that I can create VIEWS in mysql, rather than creating an associative array. My new challenging question is this:- I have a master-detail page in php linked with a mysql database. Each time a user searches for something, a VIEW is created in mysql. The VIEW in mysql will be further processed using a query, and the results of this query will now be displayed in the master-detail page. There will be many users using the system hence many VIEWS will be created. When is it best to drop the VIEW from mysql. If I drop the VIEW immediately after performing my query, will the master-detail page still show information required?
  5. I want to create a master-detail page using PHP. Rather than getting data from a MYSQL database, I want to get the data from an associative array. Is this possible? Please someone show me the way forward. Please help.
  6. Hello all, Please I need help in displaying all my images stored in a folder located outside the web root. I have been trying this for over a month to no avail please help. I have included my code for you to help detect where I am wrong. When I run this code, only one image is repeatedly displayed. For example, if I have 5 images in my folder, the first image will be displayed 5 times. Thank you. Images.php <?php // Get our database connector require("includes/copta.php"); // Grab the data from our people table $sql = "select * from people"; $result = mysql_query($sql) or die ("Could not access DB: " . mysql_error()); $imgLocation = " /uploadfile/"; while ($row = mysql_fetch_array($result)) { $imgName = $row["filename"]; $imgPath = $imgLocation . $imgName; echo "<img src=\"call_images.php?imgPath=" . $imgName . "\" alt=\"\"><br/>"; echo $row['id'] . " " . $imgName. "<br />"; } ?> call_images.php <?php // Get our database connector require("includes/copta.php"); $imgLocation = '/ uploadz/'; $sql = "select * from people"; $result = mysql_query($sql) or die ("Could not access DB: " . mysql_error()); while ($row = mysql_fetch_array($result)) { $imgName = $row["filename"]; $imgPath = $imgLocation . $imgName; // Make sure the file exists if(!file_exists($imgPath) || !is_file($imgPath)) { header('HTTP/1.0 404 Not Found'); die('The file does not exist'); } // Make sure the file is an image $imgData = getimagesize($imgPath); if(!$imgData) { header('HTTP/1.0 403 Forbidden'); die('The file you requested is not an image.'); } // Set the appropriate content-type // and provide the content-length. header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Type: image/jpg"); header("Content-length: " . filesize($imgPath)); // Print the image data readfile($imgPath); exit(); } ?>
×
×
  • 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.