Ghettobusta Posted April 17, 2007 Share Posted April 17, 2007 I am using the POST method like this: <?php echo "Subject value -> " . $_POST['sujet'] . "<br/>"; ?> And then I use this in a MySQL request: $requete='SELECT Ctexte, Cdate, Unom FROM Commentaires, Usagers WHERE Commentaires.CUid = Usagers.Uid AND Commentaires.CSid = '.$_POST['sujet']; I am getting this error message: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"' at line 1 What is not right in my syntax? Thx in advance! Quote Link to comment Share on other sites More sharing options...
jitesh Posted April 17, 2007 Share Posted April 17, 2007 $requete="SELECT `Ctexte`,`Cdate`, `Unom` FROM `Commentaires`, `Usagers` WHERE Commentaires.CUid = Usagers.Uid AND Commentaires.CSid = '".$_POST['sujet']."'"; quatation is needed when you have string comparision Commentaires.csid = 'maths' Quote Link to comment Share on other sites More sharing options...
Glyde Posted April 17, 2007 Share Posted April 17, 2007 $requete="SELECT `Ctexte`,`Cdate`, `Unom` FROM `Commentaires`, `Usagers` WHERE Commentaires.CUid = Usagers.Uid AND Commentaires.CSid = '".mysql_real_escape_string($_POST['sujet'])."'"; Watch for SQL injection... Quote Link to comment Share on other sites More sharing options...
Ghettobusta Posted April 17, 2007 Author Share Posted April 17, 2007 I tried both your methods... and both times I got a blank page (I get this often for little mistakes like quotation marks... it's getting on my nerves since I am not an experienced PHP programmer) Thanks for the quick replies... any other idea?? Quote Link to comment Share on other sites More sharing options...
Ghettobusta Posted April 17, 2007 Author Share Posted April 17, 2007 Wait.... nevermind, I copied your code wrong. Thanks a lot guys!!! Very appreciated!!! Quote Link to comment Share on other sites More sharing options...
Ghettobusta Posted April 17, 2007 Author Share Posted April 17, 2007 How can I do this : <?php echo "Subject value -> " . $_POST['sujet'] . "<br/>"; ?> But in a way that it doesn't display Subject value -> 2020" on the webpage? Quote Link to comment Share on other sites More sharing options...
AndyB Posted April 17, 2007 Share Posted April 17, 2007 Please explain what you want. That 'question' makes no sense. Quote Link to comment Share on other sites More sharing options...
Ghettobusta Posted April 17, 2007 Author Share Posted April 17, 2007 Here, go to: http://cogito.labos.polymtl.ca/~ti317/TS2/index.php Choose a subject (any of them) and click "envoyer" On the next page, you can see "Subject value -> 2167"" displayed at the very top of the page. I do not want to display this... is there a way to hide it? Quote Link to comment Share on other sites More sharing options...
HeyRay2 Posted April 17, 2007 Share Posted April 17, 2007 Don't use echo() and it won't show it. Quote Link to comment Share on other sites More sharing options...
Ghettobusta Posted April 17, 2007 Author Share Posted April 17, 2007 Thanks a lot! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.