Click here to Skip to main content

Linux, Apache, MySQL, PHP

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page  Show 
Generalwhy does this not work? [modified]membergeoman298z6 Jul '12 - 7:29 
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.

AnswerRe: why does this not work?mvpLuc Pattyn6 Jul '12 - 10:49 
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"?
 
Smile | :)
Luc Pattyn [My Articles] Nil Volentibus Arduum

AnswerRe: why does this not work?membernirangad12 Jul '12 - 0:36 
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

GeneralRe: why does this not work?groupsali2212 Jul '12 - 18:18 
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()
GeneralDatabase Question [modified]memberBaddy_Bad_Boy6 Jul '12 - 0:59 
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.
AnswerRe: QT QuestionmvpRichard MacCutchan6 Jul '12 - 1:19 
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.

Questionpdo phpmemberAndyInUK5 Jul '12 - 7:11 
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
GeneralRe: pdo phpmemberAgecanonix6 Jul '12 - 8:46 
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.
Questionamazon product advertise ApimemberMember 915215621 Jun '12 - 20:39 
hi,
How to implement amazon product advertise api to my website search field ?
any one help to me
Thank u
AnswerRe: amazon product advertise ApimemberCodingLover2 Jul '12 - 16:06 
Why don't you search the web? If you could find their doc, then that's it.
 
http://docs.amazonwebservices.com/AWSECommerceService/latest/DG/Welcome.html[^]
 
You want to do this in PHP or?
If you've never failed... You've never lived...

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   


Advertise | Privacy | Mobile
Web04 | 2.6.130523.1 | Last Updated 21 May 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid