Jump to content

why my picture are being display with single quote instead of doble quote


franknu

Recommended Posts

i have a code that upload multiple pictures they go to the database fine

my problems is that when they are call to display they dont show but  when i look in the source code i noticed that they are being call in a single quote

<img src='home/images/picture.jpg' width='150' height='125'>

that is the example of what i am getting in my source code

please help
i am uploading my pictures path

with this code

[code=php:0]

print "<pre>";
print_r($_FILES);
print "</pre>";

define ("UPLOADDIR", "/home/townsfin/public_html/business_images/");

// All POST vars to vars..
$BusinessName = mysql_real_escape_string($_POST['BusinessName']);
$Slogan      = mysql_real_escape_string($_POST['Slogan']);
//etc...

IF ($_FILES['Picture1']) :

  $moved1 = false;
  $moved2 = false;

  IF (is_uploaded_file($_FILES['Picture1']['tmp_name'])) :
    $uploadfile1 = $_FILES['Picture1']['name'];
    $fullpath1  = UPLOADDIR . $uploadfile1;
    $filename1  = $_POST['name']. "1";
    IF (move_uploaded_file($_FILES['Picture1']['tmp_name'],  UPLOADDIR .$filename1)) :
      $moved1 = true;
      echo "picture $fullpath1 uploaded";
    ENDIF;
  ENDIF;

  IF (is_uploaded_file($_FILES['Picture2']['tmp_name'])) :
    $uploadfile2= $_FILES['Picture2']['name'];
    $fullpath2 = UPLOADDIR . $uploadfile2;
    $filename2=$_POST['name']. "2";
    IF (move_uploaded_file($_FILES['Picture2']['tmp_name'],  UPLOADDIR .$filename2)) :
      $moved2 = true;
      echo "picture $fullpath2 uploaded";
    ENDIF;
  ENDIF;

  IF ($moved1 and $moved2) :
    $sql = "INSERT INTO `business_info` ";
    $sql .= "SET `BusinessName`= '$BusinessName', ";
    $sql .= "    `Slogan`= '$Slogan', ";
    $sql .= "    `Business_Address`= '$Business_Address', ";
    $sql  .= "    `Tel`= '$Tel', ";
    $sql .= "    `Website`= '$Website', ";
    $sql .= "    `Email`= '$Email', ";
    $sql .= "    `Fax`= '$Fax', ";
    $sql .= "    `type`= '$type', ";
    $sql .= "    `make`= '$make', ";
    $sql .= "    `Categories`= '$Categories', ";
    $sql .= "    `Keyword`= '$Keyword', ";
    $sql .= "    `Picture1`= '$fullpath1', ";
    $sql .= "    `Headline`= '$Headline', ";
    $sql .= "    `Slogan2`= '$Slogan2', ";
    $sql .= "    `Description1`= '$Description1', ";
    $sql .= "    `Description2`= '$Description2', ";
    $sql .= "    `Description3`= '$Description3', ";
    $sql .= "    `Picture2`= '$fullpath2', ";
    $sql .= "    `Picture3`= '$fullpath1', ";
    $sql .= "    `User_Name`= '$User_Name', ";
    $sql .= "    `Password` = '$Password' ";
    mysql_query($sql)or die("SQL Error: $sql<br>" . mysql_error());
  ENDIF;
ENDIF;
?>
[/code]

my problem is that when i call the pictures that i uploaded they are not being display because they are being call in single quotes instead of double quotes. i was wondering how i can fix that

thank u
in addition, the preg_replace seems like it's writing the wrong path.  try this instead:

[code]
<?php
$filename = basename($row['Picture1']);
$image = '/business_images/' . $filename;
echo '<img src="' . $image . '" width="150" height="125">';
?>
[/code]

Archived

This topic is now archived and is closed to further replies.

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