• Status: Solved
  • Priority: Low
  • Security: Public
  • Views: 59
  • Last Modified:

php to word small fix

php to word small fix every thing is good and done Except image not appears is word doc

my code is :
$connect=mysqli_connect("$localhost","$db_users","$db_password","$db_name");

$id=$_GET['id'];
$sqlpackages="SELECT * FROM packages WHERE package_id='$id' ";
$querypackages=mysqli_query($connect,$sqlpackages);
$resultpackages=mysqli_fetch_array($querypackages);

$name=$_SESSION['username'];
$sqlname="SELECT * FROM users WHERE user_name='$name' ";
$queryname=mysqli_query($connect,$sqlname);
$resultname=mysqli_fetch_array($queryname);


header("cotent-type:application/vnd.msword");

$filname="package.doc";
header("content-disposition:attachment;filename=".$filname);
?>
<html>

<head>
    <title><?php echo $resultpackages['package_name']; ?></title>
</head>



<body>

<!-- Navigation -->

<h1 style="color: #FF0000"><?php echo $resultpackages['package_name']; ?></h1>

    <h2 style="color: blue"><?php echo $_SESSION['username']; ?></h2>
    <h4 style="color: blue"><?php echo $resultname['co_name']; ?></h4>

    <p class="card-text"><?php echo $resultname['co_Landline']; ?></p>
    <p class="card-text"><?php echo $resultname['co_mobile']; ?></p>
    <p class="card-text"><?php echo $resultname['co_email']; ?></p>

<?php
        $pac_name=$resultpackages['package_id'];
        $sqlimg="SELECT content FROM packages_image WHERE packageID='$pac_name'";
        $queryimg=mysqli_query($connect,$sqlimg);
        while($resultimg=mysqli_fetch_array($queryimg)){
            echo '<img src="data:image/png;base64,'.base64_encode($resultimg['content']).'" width="150" height="150"/>';
        }
?>
<hr>
                <h4 class="card-header"><?php echo $resultpackages['package_name']; ?></h4>
<br>
                    <p class="lead"><?php echo $resultpackages['Detailed_Itinerary'];?></p>
                    <p class="lead"><?php echo $resultpackages['Inclusion'];?></p>
                    <p class="lead"><?php echo $resultpackages['Exclusion'];?></p>
                    <p class="lead"><?php echo $resultpackages['Important_Note'];?></p>
                    <p class="lead"><?php echo $resultpackages['Package_Price'];?></p>
                    <p class="lead"><?php echo $resultpackages['Trip_Duration'];?></p>
                    <p class="card-text"><?php echo $resultpackages['Car_Used']; ?></p>
                    <p class="card-text"><?php echo $resultpackages['HName1']; ?></p>
                    <p class="card-text"><?php echo $resultpackages['period1']; ?></p>
                    <p class="card-text"><?php echo $resultpackages['meal1']; ?></p>
                    <p class="card-text"><?php echo $resultpackages['HName2']; ?></p>
                    <p class="card-text"><?php echo $resultpackages['period2']; ?></p>
                    <p class="card-text"><?php echo $resultpackages['meal2']; ?></p>
                    <p class="card-text"><?php echo $resultpackages['HName3']; ?></p>
                    <p class="card-text"><?php echo $resultpackages['period3']; ?></p>
                    <p class="card-text"><?php echo $resultpackages['meal3']; ?></p>
                    <p class="card-text"><?php echo $resultpackages['HName4']; ?></p>
                    <p class="card-text"><?php echo $resultpackages['period4']; ?></p>
                    <p class="card-text"><?php echo $resultpackages['meal4']; ?></p>
                    <p class="card-text"><?php echo $resultpackages['HName5']; ?></p>
                    <p class="card-text"><?php echo $resultpackages['period5']; ?></p>
                    <p class="card-text"><?php echo $resultpackages['meal5']; ?></p>
                    <p class="card-text"><?php echo $resultpackages['valid_date']; ?></p>

</body>

</html>

Open in new window


i am struggling to finish the first project to me

thanks for all people how helped me
0
AHMED SAMY
Asked:
AHMED SAMY
  • 6
  • 4
1 Solution
 
David FavorLinux/LXD/WordPress/Hosting SavantCommented:
When you say image does not appear as word doc, do you mean the icon on the downloaded file in the folder where it was downloaded?

Attach a screen shot of what you're seeing.
0
 
AHMED SAMYownerAuthor Commented:
error.png
bring all no problem but image no
0
 
Peter HartCommented:
sounds like a memory problem. I've seen Word not display images due to the memory required for the images.
try smaller images
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
AHMED SAMYownerAuthor Commented:
that website make more than this and more images
0
 
AHMED SAMYownerAuthor Commented:
please help to finish it

the project already finished just pdf and word problem to delever it

this is the last change:

$connect=mysqli_connect("$localhost","$db_users","$db_password","$db_name");

$id=$_GET['id'];
$sqlpackages="SELECT * FROM packages WHERE package_id='$id' ";
$querypackages=mysqli_query($connect,$sqlpackages);
$resultpackages=mysqli_fetch_array($querypackages);

$name=$_SESSION['username'];
$sqlname="SELECT * FROM users WHERE user_name='$name' ";
$queryname=mysqli_query($connect,$sqlname);
$resultname=mysqli_fetch_array($queryname);


header("cotent-type:application/vnd.msword");

$filname="package.doc";
header("content-disposition:attachment;filename=".$filname);
?>
<!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">

    <title><?php echo $resultpackages['package_name']; ?></title>

    <!-- Bootstrap core CSS -->

    <!-- Custom styles for this template -->
    <style>
        body {
            padding: 15px;
            font-family: Cambria;
            font-size: medium;
            margin: 15px;
        }
        .container{
            padding: 15px;
        }
        .row{
            float: left;
            border-color: darkgray;
            border-style: solid;
            border-width: 2px;
            padding: 15px;
            width: 100%;
            border-radius: 5px;
            margin-bottom: 15px;
            margin-top: 15px;
        }
        .lead{
            border-color: darkgray;
            border-radius: 5px;

        }
        .image{
            float: left;
            border-color: darkgray;
            border-style: solid;
            border-width: 2px;
            padding: 15px;
            width: 100%;
            border-radius: 5px;
            margin-bottom: 15px;
            margin-top: 15px;
        }
        .sub{
            color: brown;
            background-color: antiquewhite;
        }
    </style>

</head>

<body>

<!-- Navigation -->


<!-- Page Content -->
<br><br><br>
<div class="container">
    <div class="row">
        <h1 class="card-header" style="color: darkred"><?php echo $resultname['co_name']; ?></h1>
        <br><br>
        <h2 class="card-text"><?php echo $resultname['co_Landline']; ?></h2>
        <h2 class="card-text"><?php echo $resultname['co_mobile']; ?></h2>
        <h2 class="card-text"><?php echo $resultname['co_email']; ?></h2>
    </div>
    <div class="image">
        <p><h4 class="sub">Related views :</h4></p>
        <?php
        $id=$_GET['id'];
        $sqlpackages="SELECT * FROM packages WHERE package_id='$id' ";
        $querypackages=mysqli_query($connect,$sqlpackages);
        $resultpackages=mysqli_fetch_array($querypackages);
        $pac_name=$resultpackages['package_id'];
        $sqlimg="SELECT content FROM packages_image WHERE packageID='$pac_name'";
        $queryimg=mysqli_query($connect,$sqlimg);
        while($resultimg=mysqli_fetch_array($queryimg)){
            ?>
            <?php echo '<img src="data:image/png;base64,'.base64_encode($resultimg['content']).'" width="150" height="150"/></>'; ?>          <?php
        }
        ?>
    </div>

    <div class="row">
        <h2 class="card-header"><?php echo $resultpackages['package_name']; ?></h2>
        <p><h3 class="sub">package name :</h3></p>
        <p class="lead"><?php echo $resultpackages['Detailed_Itinerary'];?></p>
        <p><h3 class="sub">Inclusion :</h3></p>
        <p class="lead"><?php echo $resultpackages['Inclusion'];?></p>
        <p><h3 class="sub">Exclusion:</h3></p>
        <p class="lead"><?php echo $resultpackages['Exclusion'];?></p>
        <p><h3 class="sub">Important Note :</h3></p>
        <p class="lead"><?php echo $resultpackages['Important_Note'];?></p>
        <p><h3 class="sub">package price :</h3></p>
        <p class="lead"><?php echo $resultpackages['Package_Price'];?></p>
        <p><h3 class="sub">Trip Duration :</h3></p>
        <p class="lead"><?php echo $resultpackages['Trip_Duration'];?></p>
        <p><h3 class="sub">car used :</h3></p>
        <p class="card-text"><?php echo $resultname['Car_Used']; ?></p>
        <p><h3 class="sub">Hotels Description :</h3></p>
        <p class="card-text"><?php echo $resultname['HName1']; ?></p>
        <p class="card-text"><?php echo $resultname['period1']; ?></p>
        <p class="card-text"><?php echo $resultname['meal1']; ?></p>
        <p class="card-text"><?php echo $resultname['HName2']; ?></p>
        <p class="card-text"><?php echo $resultname['period2']; ?></p>
        <p class="card-text"><?php echo $resultname['meal2']; ?></p>
        <p class="card-text"><?php echo $resultname['HName3']; ?></p>
        <p class="card-text"><?php echo $resultname['period3']; ?></p>
        <p class="card-text"><?php echo $resultname['meal3']; ?></p>
        <p class="card-text"><?php echo $resultname['HName4']; ?></p>
        <p class="card-text"><?php echo $resultname['period4']; ?></p>
        <p class="card-text"><?php echo $resultname['meal4']; ?></p>
        <p class="card-text"><?php echo $resultname['HName5']; ?></p>
        <p class="card-text"><?php echo $resultname['period5']; ?></p>
        <p class="card-text"><?php echo $resultname['meal5']; ?></p>
        <p class="card-text"><?php echo $resultname['valid_date']; ?></p>
    </div>

</div>
</div>
</div>

</body>

</html>

Open in new window


every thing is ok only images
0
 
Peter HartCommented:
have you looked at the images that cannot be displayed and inspected their paths?
try to view or inspect the code that is displaying:  "cannot display the images"
can you see the path of the images? is it correct?

If the images are where Word thinks they are then....

have you tried using smaller images?
 have you tried using a better spec device to edit the word document? (sometimes word does not dispaly images due to the restrictions on the device displaying them.
0
 
AHMED SAMYownerAuthor Commented:
note all images in data base not in folder
0
 
Peter HartCommented:
wow - I always thought storing images in a database was a no-no in terms of efficiency and performance.
maybe that's the problem.
have you tried storing the images in a file system?
0
 
AHMED SAMYownerAuthor Commented:
i tried it also the same result
0
 
Peter HartCommented:
Maybe its a bug in Word.
this link below on Microsoft has lot of people with the same problem and there are a list of suggestions
like try Word 2010 instead of Word 2010
try Word in Safe Mode


https://answers.microsoft.com/en-us/msoffice/forum/msoffice_word-mso_winother/word-2013-this-image-cannot-currently-be-displayed/fffa07b8-e59e-4c69-aea6-5075feeb783f?auth=1

good luck
0
 
AHMED SAMYownerAuthor Commented:
not correct
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

  • 6
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now