473,757 Members | 6,899 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Warning:Cannot modify header information

59 New Member
Hi,

I have written php code to retrive the image from mysql and display it on the webpage. Here is the code

<?php
require_once("D BConnect.php");
$gotten = @mysql_query("s elect user_photo from User_Info_Other where user_id = '1'");
header("Content-type: image/gif");
while ($row = mysql_fetch_arr ay($gotten))
{
print $row['user_photo'];
}
?>

This works fine when I don't add any html tags and displays the image, but when I add html tags i get the warning and prints the encrypted data.

Warning: Cannot modify header information - headers already sent by (output started at /var/www/kilorie/kil_ver3/list.php:2) in /var/www/kilorie/kil_ver3/list.php on line 6

According to what I know is, this error occurs when there are white spaces before and after the opening and closing php tags, but for my application I need to add html and css codes.

How to solve this issue. Can anyone please help me.

With regards
Feb 12 '08 #1
3 1422
harshmaul
490 Recognized Expert Contributor
Hi,

The problem here is that your outputing a charachter or whitespace before you change the headers.

If you post your markup for this page we can spot it.
Feb 12 '08 #2
gubbachchi
59 New Member
Thank you for the reply.
I have solved the problem, it is working now.
Feb 12 '08 #3
harshmaul
490 Recognized Expert Contributor
hi,
Thats good news :)
Feb 12 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
3173
by: Phyzlo | last post by:
Hello, I've recently started learning PHP and have a question. I tried running below script which can be found at http://se2.php.net/manual/sv/function.setcookie.php but I keep getting this message on my browser, why? Warning: Cannot add header information - headers already sent by (output started at /var/www/cookietest.php:2) in
3
3320
by: Greg Scharlemann | last post by:
Does the redirect statement: header(Location:"http://www.newpage.com"); need to come before certain statements? I've setup a login page and try to redirect a user once they have logged in (after I set the appropriate $_SESSION value) but I get the following error: Warning: Cannot modify header information - headers already sent by (...)
4
2064
by: kempy535 | last post by:
Hi I get this error code when I try to run my login script. Warning: Cannot modify header information - headers already sent by (output started at C:\Program Files\Apache Group\Apache2\htdocs\Rising sun\css.php:1) in C:\Program Files\Apache Group\Apache2\htdocs\Rising sun\loginmeth.php on line 24 This is the login script stored in loginmeth.php ; <?php require_once 'config.php';?> <?php include 'opendb.php';?> <?php $errorMessage = ''; if...
5
1999
by: nasse | last post by:
I am getting the following error msg whenever I try to login. I tried to turn my output_buffering = On in my php.ini but is not working for me. Would you please help me: Warning: Cannot modify header information - headers already sent by (output started at C:\Inetpub ........login\include\header.php:9) in C:\Inetpub\vhosts\.....\httpdocs\login\login.php on line 23 And here is the content of the header.php page which is included in all my...
2
12798
by: mmr315 | last post by:
after installing php when i run php.exe it is showing that PHP Warning: Cannot load module 'pdo_mysql' because required module 'pdo' is not loaded in Unknown on line 0 what is this error,pls help me.
8
2397
by: mcserret | last post by:
I know this is a recurring problem that has been addressed here before, but even after reading all that has gone before, I am still stumped. I have a form that is designed to send data to a PHP page where is is to be validated then read into a MySQL table. Once that is done, the form is to send the user either back to the originating page, or to a logout page. I have several versions of this setup on my site that work well, so
2
2331
by: smartic | last post by:
I'm having problem with header redirection that is my code: <?php header("location:Redirecting.php"); exit; ?> //Then the HTML It give me an error
0
1878
by: Georg | last post by:
Hello, I'm using SSIS (SQL Server Integration Services) via Native Informix OLE DB provider to extract (ETL) data from Informix 7.3 to SQL Server 2005. I have following problem, when I try to connect to the Informix database I'm getting : Warning - Cannot retrieve the column code page info from the OLE DB provider ???
10
2381
by: jessica87 | last post by:
hi there, i m using this coding to retrieve the file from database so that my user can download the file... <?php if (!isset($_GET)) die('Invalid Parameter'); include 'connectdb.php'; $id = $_GET;
0
9489
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9298
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10072
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9737
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5172
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3829
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3399
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2698
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.