Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
The ol' whitespace problem. Booo.
Old 01-02-2010, 11:56 PM The ol' whitespace problem. Booo.
Experienced Talker

Posts: 48
Name: Craig
Trades: 0
Hello again,

I'm putting together some code for a photo sharing site. I'm getting the error "Warning: Cannot modify header information - headers already sent by (output started at path/to/admin/database.php:1)"
I'm getting the error every time I require (or include, I've tried both) the database file. Everything I can find of this error says to remove the white space on the referenced line. The only problem is, there is no white space on this line. So... where does that leave me? The database.php code is down yonder.
PHP Code:
<?php
$db_name 
"xxxxx";
$db_server "localhost";
$db_user "xxxxx";
$db_pass "xxxxx";
$mysqli = new mysqli($db_server$db_user$db_pass$db_name) or die(mysqli_error());
?>

Last edited by werm82; 01-02-2010 at 11:58 PM.. Reason: Forgot code tags
werm82 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-03-2010, 05:53 AM Re: The ol' whitespace problem. Booo.
lizciz's Avatar
Super Spam Talker

Posts: 807
Name: Mattias Nordahl
Location: Sweden
Trades: 0
The error means you cannot have any output sent before calling the header() function, or session_start(). Which means you cannot have any echo, print or any other code that prints something to the page, or any html code (or evan white spaces and newlines) before the <?php opening tag. It could i.e. be that your query fails and echoes the error message from mysqli_error().
__________________
Your answers will only be as good as your question. Formulate it well and give all the necessary information.
lizciz is offline
Reply With Quote
View Public Profile Visit lizciz's homepage!
 
Old 01-03-2010, 10:43 AM Re: The ol' whitespace problem. Booo.
Experienced Talker

Posts: 48
Name: Craig
Trades: 0
Is there any way it could be the way my server is configured? Because I don't get the error when I run it locally on wamp, but the error appears when I upload it to my server.
werm82 is offline
Reply With Quote
View Public Profile
 
Old 01-03-2010, 12:56 PM Re: The ol' whitespace problem. Booo.
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
maybe the error isn't occuring on the Windows version.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to The ol' whitespace problem. Booo.
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.16913 seconds with 12 queries