Linux, Apache, MySQL, PHP
|
|
 |

|
session_start();
$con = mysql_connect("database","uername","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("database", $con);
mysql_query("UPDATE users SET money=money+1000 WHERE username = '". $_SESSION['username']."'");
echo $_SESSION['username'];
mysql_close($con);
?>
please help!
this is the errors
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/content/12/8488612/html/users/1000.php:2) in /home/content/12/8488612/html/users/1000.php on line 3
Warning: Cannot modify header information - headers already sent by (output started at /home/content/12/8488612/html/users/1000.php:2) in /home/content/12/8488612/html/users/1000.php on line 20
modified 6 Jul '12 - 13:39.
|
|
|
|

|
A number of operations can not be performed once the HTML header has been opened; session_start() should be called well before anything else that generates HTML code, such as a simple echo "Hello".
As a test, comment out session_start() and see what gets emitted, that is likely to tell you where you went wrong.
And why was your message type "General", rather than "Question"?
|
|
|
|

|
Are you including this PHP file inside another file? if so make sure that include statement is the first statement in that file
Niranga De Silva
Software Engineer @ 99X Technology
|
|
|
|

|
Perhaps you have used Unicode for designing your webpage,
beside that "session_start()" must be the first line of your web page . so some times one code has been added to the page for encoding purpose. it's better to use standard PHP editor like "Zend Studio" to see and remove this code before session_start()
|
|
|
|

|
Hi I am new to linux and was supposed to use Database. I don't no much about that. Can anyone please tell me how can I create, insert, update and delete data from a database. Thanks in advance
-- modified 6 Jul '12 - 7:16.
|
|
|
|

|
There is no way we can provide an answer to a question like this. The first thing you need to do is to decide what data you need to keep in your database, and then start thinking about what to put in your tables and how the information may need to be linked. However, if you have no experience of databases you may need to do some studying in advance - some of these links[^] may be useful to help you get started.
|
|
|
|

|
Can anyone find an error in this query ?
try {
$dbh = new PDO(' ….. ');
$stmt = $dbh->prepare('INSERT into customer (name) values (:name)');
$stmt->bindParam(':name', 'lilly');
$stmt->execute();
$dbh = null;
} catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "<br/>";
die();
}
It doesn't display any error and neither does it perform the insert??
Thanks
|
|
|
|

|
Strange, when I run the code I get this error message:
Fatal error: Cannot pass parameter 2 by reference in ...
If you look at the PDOStatement::bindParam() documentation, the second argument is passed by reference, so I guess you can't pass a literal value by reference.
|
|
|
|

|
hi,
How to implement amazon product advertise api to my website search field ?
any one help to me
Thank u
|
|
|
|
|
 |
|
|
General
News
Suggestion
Question
Bug
Answer
Joke
Rant
Admin