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! Link to comment https://forums.phpfreaks.com/topic/47342-solved-quick-question-quick-reply-would-be-very-appreciated/ 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' Link to comment https://forums.phpfreaks.com/topic/47342-solved-quick-question-quick-reply-would-be-very-appreciated/#findComment-230937 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... Link to comment https://forums.phpfreaks.com/topic/47342-solved-quick-question-quick-reply-would-be-very-appreciated/#findComment-230939 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?? Link to comment https://forums.phpfreaks.com/topic/47342-solved-quick-question-quick-reply-would-be-very-appreciated/#findComment-230942 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!!! Link to comment https://forums.phpfreaks.com/topic/47342-solved-quick-question-quick-reply-would-be-very-appreciated/#findComment-230945 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? Link to comment https://forums.phpfreaks.com/topic/47342-solved-quick-question-quick-reply-would-be-very-appreciated/#findComment-230949 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. Link to comment https://forums.phpfreaks.com/topic/47342-solved-quick-question-quick-reply-would-be-very-appreciated/#findComment-230956 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? Link to comment https://forums.phpfreaks.com/topic/47342-solved-quick-question-quick-reply-would-be-very-appreciated/#findComment-230958 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. Link to comment https://forums.phpfreaks.com/topic/47342-solved-quick-question-quick-reply-would-be-very-appreciated/#findComment-230962 Share on other sites More sharing options...
Ghettobusta Posted April 17, 2007 Author Share Posted April 17, 2007 Thanks a lot! Link to comment https://forums.phpfreaks.com/topic/47342-solved-quick-question-quick-reply-would-be-very-appreciated/#findComment-230964 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.