473,789 Members | 2,746 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Warning: Cannot modify header information

6 New Member
Hi, I cant change the header to display images from a database. It's giving me this error :

Warning: Cannot modify header information - headers already sent by (output started at /home/content/d/f/m/dfmcons/html/secwhouse/index.php:18) in /home/content/d/f/m/dfmcons/html/secwhouse/index.php on line 71

Here is the code :
[php]
<?
mysql_connect(" $host","$userna me", "$password" );
mysql_select_db ("secwhouse" );
?>
<head>
<title>Securi ty Warehouse Sample Concept</title>
</head>
<body>
<table width="750" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<th scope="col"><ta ble width="750" border="0" cellspacing="0" cellpadding="0" >
<tr>
<th scope="col"><ob ject classid="clsid: D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macrom edia.com/pub/
shockwave/cabs/flash/swflash.cab#ver sion=7,0,19,0" width="750" height="125">
<param name="movie" value="secbanne r2.swf" />
<param name="quality" value="high" />
<embed src="secbanner2 .swf" quality="high" pluginspage="ht tp://www.macromedia. com/go/getflashplayer" type="applicati on/x-shockwave-flash" width="750" height="125"></embed>
</object></th>
</tr>
</table>
<table width="750" border="0" cellspacing="0" cellpadding="0" >
<tr>
<th scope="col"><fo rm id="mnusrch" name="mnusrch" method="post" action="">
<table width="750" border="0" cellspacing="0" cellpadding="0" >
<tr>
<th scope="col"><in put type="text" name="textfield " /></th>
<th scope="col"><im g src="images/sec_01.gif" width="72" height="30" /></th>
<th scope="col"><im g src="images/sec_03.gif" width="359" height="30" /></th>
<th scope="col"><im g src="images/sec_04.gif" width="74" height="30" /></th>
<th scope="col"><im g src="images/sec_05.gif" width="98" height="30" /></th>
</tr>
</table>
</form>
</th>
</tr>
</table>
<table width="750" border="0" cellspacing="0" cellpadding="0" >
<tr>
<th scope="col"><im g src="images/menu_01.gif" width="91" height="14" /></th>
<th scope="col"><im g src="images/menu_02.gif" width="92" height="14" /></th>
<th scope="col"><im g src="images/menu_03.gif" width="104" height="14" /></th>
<th scope="col"><im g src="images/menu_04.gif" width="110" height="14" /></th>
<th scope="col"><im g src="images/menu_05.gif" width="91" height="14" /></th>
<th scope="col"><im g src="images/menu_06.gif" width="105" height="14" /></th>
<th scope="col"><im g src="images/menu_07.gif" width="157" height="14" /></th>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="0" >
<tr>
<th scope="col">&nb sp;</th>
</tr>
</table>
<?
$sql = "SELECT * FROM `prod` WHERE `prod`.`special ` = 'n'";
$counter=0;
$result =mysql_query($s ql);
while($rows=mys ql_fetch_array( $result))
{
$count=0;
while($count<>5 )
{
?>
<table border="0" cellspacing="0" cellpadding="0" id="main">
<tr>
<th scope="col"><ta ble border="0" cellpadding="0" cellspacing="0" id="left1">
<tr>
<th scope="col"><? header("Content-type: image/jpeg");echo $rows['image']; ?></th>
</tr>
<tr>
<th scope="row">&nb sp;</th>
</tr>
<tr>
<th scope="row"><? echo $rows['prod']; ?></th>
</tr>
<tr>
<th scope="row">&nb sp;</th>
</tr>
<tr>
<th scope="row"><? echo $rows['price']; ?></th>
</tr>
</table></th>
<th scope="col">&nb sp;</th>
<th scope="col"><ta ble border="0" cellspacing="0" cellpadding="0" >
<tr>
<?
$rows=mysql_fet ch_array($resul t);
?>
<th scope="col"><? echo $rows['image']; ?></th>
</tr>
<tr>
<th scope="row">&nb sp;</th>
</tr>
<tr>
<th scope="row"><? echo $rows['prod']; ?></th>
</tr>
<tr>
<th scope="row">&nb sp;</th>
</tr>
<tr>
<th scope="row"><? echo $rows['price']; ?></th>
</tr>
</table></th>
<th scope="col">&nb sp;</th>
<th scope="col"><ta ble border="0" cellpadding="0" cellspacing="0" id="right1">
<tr>
<th scope="col">&nb sp;</th>
</tr>
<tr>
<th scope="row">&nb sp;</th>
</tr>
<tr>
<th scope="row">&nb sp;</th>
</tr>
<tr>
<th scope="row">&nb sp;</th>
</tr>
<tr>
<th scope="row">&nb sp;</th>
</tr>
</table></th><? $count=5 ?>
</tr>
</table><? } }?>
<br />
<p>&nbsp;</p>
<p><br />
</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p></th>
</tr>
</table>
</body>
</html>
[/php]I left out the connection details, cos the password is visible

That is not the only thing you left out. You must enclose all code within the appropriate code tags. Read the Posting Guidelines. - moderator
Feb 29 '08 #1
22 2046
hsriat
1,654 Recognized Expert Top Contributor
Post your code again after masking the password, and applying [php] tags.

Now you have disordered line 18 and 71, the actual culprits.
Feb 29 '08 #2
nathj
938 Recognized Expert Contributor
Hi,

The headers have to be set before any output is given. Output includes blank lines in the file. you can process information before the headers are set you just can't write anything to the screen.

Perhaps that's the problem.

Cheers
nathj
Feb 29 '08 #3
Markus
6,050 Recognized Expert Expert
I cant Even see any headers being sent =/
Feb 29 '08 #4
nathj
938 Recognized Expert Contributor
I cant Even see any headers being sent =/

Nor can I but I'm guessing there something in the code that was left out.

Perhaps you could post the full code sample, using tags, but simply change the sesitive data to indicate what shuold be there.

nathj
Feb 29 '08 #5
henryrhenryr
103 New Member
Surely line 66

Expand|Select|Wrap|Line Numbers
  1. header("Content-type: image/jpeg");
is your error...
Feb 29 '08 #6
Markus
6,050 Recognized Expert Expert
Surely line 66

Expand|Select|Wrap|Line Numbers
  1. header("Content-type: image/jpeg");
is your error...
Indeed it is. :D

Can't believe i missed that :(

Ohwell, move that line to the beggining of your script.
Feb 29 '08 #7
hsriat
1,654 Recognized Expert Top Contributor
Indeed it is. :D

Can't believe i missed that :(

Ohwell, move that line to the beggining of your script.

NO!!! Its not an image file!

Instead of <? header("Content-type: image/jpeg");echo $rows['image']; ?>, write <img src="<?php echo $rows['image']; ?>"></img>
Mar 1 '08 #8
hsriat
1,654 Recognized Expert Top Contributor
*If $rows['image'] referrers to the name of the image file.
Mar 1 '08 #9
Markus
6,050 Recognized Expert Expert
NO!!! Its not an image file!

Instead of <? header("Content-type: image/jpeg");echo $rows['image']; ?>, write <img src="<?php echo $rows['image']; ?>"></img>
Calm down.
I was tired last night ¬_¬
Mar 1 '08 #10

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

Similar topics

1
2451
by: None | last post by:
Hello, I am a total newbie to PHP and programming in general. I am playing around with a PHP / MySQL shopping cart script which I found at http://www.macromedia.com/devnet/mx/dreamweaver/articles/php_cart.html. When I try to start a session or create a cookie, I get the following errors. Warning: Cannot send session cache limiter - headers already sent (output started at /wrapper_head2.php:27) in /cart.php on line 13 Warning: Cannot...
3
3321
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 (...)
19
7928
by: lawrence k | last post by:
How can I find out where my script is outputting to the screen for the first time? My error logs are full of stuff like this: PHP Warning: session_start(): Cannot send session cache limiter - headers already sent in /home/httpd/vhosts/monkeyclaus.org/httpdocs/media/audio/pdsIncludes/CommandStartSession.php on line 14
4
2065
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
2000
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...
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
3
2849
by: mrosado | last post by:
Hi everybody, I have this problem.- The browser launch this two errors: Warning: session_start() : Cannot send session cache limiter - headers already sent (output started at /home/notasluz/public_html/administrador/Administrador.php:1) in /home/notasluz/public_html/administrador/verificaEntrada.php on line 2  Warning: Cannot modify header information - headers already sent by (output started at...
3
1426
by: gubbachchi | last post by:
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("DBConnect.php"); $gotten = @mysql_query("select user_photo from User_Info_Other where user_id = '1'"); header("Content-type: image/gif"); while ($row = mysql_fetch_array($gotten)) {
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
9511
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,...
1
10139
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9983
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
9020
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7529
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5417
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
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4092
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
2909
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.