Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 712257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:49:42+00:00 2026-05-14T04:49:42+00:00

here is the code <?php session_start(); if(!isset($_SESSION[‘user_name’])) { header(‘Location: login.php’); } $conn = mysql_connect(localhost,

  • 0

here is the code

<?php
 session_start();

 if(!isset($_SESSION['user_name']))
 {
  header('Location: login.php');
 }

 $conn = mysql_connect("localhost", "root", "") or die("Can no connect to Database Server");
?>

<html>
<head>

</head>
<body>
<center>
<div id="ser">
<form action="" method="post">


<label for="file">Card No:</label>
<input type="text" name="card_no" id="card_no" class="fil" onKeyUp="CardNoLength()" onKeyDown="CardNoLength()" onKeyPress="CardNoLength()"/>
<input type="submit" name="search" value="Search" class="btn" onClick="return CardNoLengthMIN()"/>
</form>
</div>
</center>
<br/><hr style="border: 1px solid #606060 ;" />
<center><a href="index.php">Home</a></center>
<br/>

<center>
<?php

 if(isset($_POST['card_no']))
 {
  if($conn)
  {
   if(mysql_select_db("img_mgmt", $conn))
   {
    $sql = "select * from temp_images where card_no='".trim($_POST['card_no'])."'";
    $result = mysql_query($sql);
    $image = mysql_fetch_array($result);

    if(isset($image['card_no']))
    {

      //echo "<img src=\"".$image['file_path']."\" alt=\"".$image['card_no']."\" width=\"250\" height=\"280\"/>";
      header("Content-type: image/jpeg");
      echo $image['img_content'];

    }
    else
    {
      echo "<p style=\"color:red;\">Sorry, Your search came with no results ! <br/> Try with different card number";
    }
   }
   else
   {
    echo "Database selection error: ".mysql_error();
   }
  }
  else
  {
   echo "Could not connect: ".mysql_error();
  }
 }
?>
</center>

</body>
</html>

But it after executing the script it shows:

Cannot modify header information –
headers already sent by (output
started at
C:\xampp\htdocs\img\search.php:61) in
C:\xampp\htdocs\img\search.php on line
77

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T04:49:42+00:00Added an answer on May 14, 2026 at 4:49 am

    If you have save the content of the image in the database you can use a data: uri do show this content in a <img /> tag. This allows you to embed content of different mime type in another content, see data URI scheme.

    But you shouldn’t really save any files (regardless of image or not) in the database. Files belongs to the filesystem, as the name already suggest. You get a huge overhead in saving files in the database. Specially for images you need (maybe) a php script which loads the image, eg. if you use something like <img src="showimage.php?id=5" alt="..." />. For each image you need to call an additional php script, and you gain nothing. Everyone will tell you its better to save the files in the filesystem and load it via the filesystem as normal. So you use tags like <img src="images/foobar/xyz.png" alt="..." /> instead. Even the “I don’t want any ‘broken links’ to images in my database” argument doesn’t count as you simply use the ID inside the path and use file_exists() to check if an image link is valid or not.

    $path = 'images/useravatars/'.$row['ID'].'.png'; // as an example
    if (file_exist($path)) {
         echo '<img src="'.$path.'" alt="username" />';
    } else {
         echo '<img src="images/noimage.png" alt="No Image found" />';
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 417k
  • Answers 417k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I use Gtk a lot it is consistent and nice… May 15, 2026 at 9:36 am
  • Editorial Team
    Editorial Team added an answer Here is one example: @RunWith(Suite.class) @Suite.SuiteClasses( { TestClass1.class, TestClass2.class, })… May 15, 2026 at 9:36 am
  • Editorial Team
    Editorial Team added an answer Hibernate provides its own (limited) tools for schema migration. There… May 15, 2026 at 9:36 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.