ArshSingh Posted April 3, 2014 Share Posted April 3, 2014 Hi there , im trying to submit textarea to the database , all is going good but there is problem in textarea row in database i think settings lacks , but i don't know what settings to use for that ,,, following is my php : <?php include("include/header.php"); if(isset($_POST['submit'])) { $name = $_FILES['file']['name']; $temp = $_FILES['file']['tmp_name']; move_uploaded_file($temp,"upload/".$name); $poster = "upload/$name"; $title =$_POST['title']; $director =$_POST['director']; $producer =$_POST['producer']; $writer =$_POST['writer']; $music =$_POST['music']; $genere =$_POST['genere']; $story =$_POST['story']; $cast =$_POST['cast']; $id = uniqid(); $date = date("Ymd"); $query = "SELECT * FROM movies WHERE title='$title' "; $result = mysqli_query($GLOBALS["___mysqli_ston"], $query) or die(((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false))); if (mysqli_num_rows($result) ) { print 'Content Already Added'; } else { mysqli_query($GLOBALS["___mysqli_ston"], "INSERT INTO movies (id,title,poster,story,director,producer,writer,cast,music,genere,date) VALUES ('$id','$title','$poster','$story','$director','$producer','$writer','$cast','$music','$genere','$date')"); } echo"Content Added"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/287490-textarea-phpmyadmin-settings/ Share on other sites More sharing options...
ginerjm Posted April 3, 2014 Share Posted April 3, 2014 Looking at this code, how did you make the determination that a "textarea" (?) was your problem? If you code returned an actual error message it would be nice if you show it to us. You could also turn on php error checking to be sure that there is no other error. Quote Link to comment https://forums.phpfreaks.com/topic/287490-textarea-phpmyadmin-settings/#findComment-1474793 Share on other sites More sharing options...
ArshSingh Posted April 3, 2014 Author Share Posted April 3, 2014 (edited) becoz when i submit the form query works only with varchar fields not with text or mediumtext ,,, and i have tried now , i have submited 3000 words into textarea field and it worked but when i submit 200 or 300 words it doesn't works :/ , and i have turned error on , there are no errors . Edited April 3, 2014 by ArshSingh Quote Link to comment https://forums.phpfreaks.com/topic/287490-textarea-phpmyadmin-settings/#findComment-1474795 Share on other sites More sharing options...
Ch0cu3r Posted April 3, 2014 Share Posted April 3, 2014 Your query could possibly encountering an error . Run mysqli_error to see what the error could be Quote Link to comment https://forums.phpfreaks.com/topic/287490-textarea-phpmyadmin-settings/#findComment-1474798 Share on other sites More sharing options...
ArshSingh Posted April 3, 2014 Author Share Posted April 3, 2014 Your query could possibly encountering an error . Run mysqli_error to see what the error could be where should i include mysqli_error() ? Quote Link to comment https://forums.phpfreaks.com/topic/287490-textarea-phpmyadmin-settings/#findComment-1474801 Share on other sites More sharing options...
Ch0cu3r Posted April 3, 2014 Share Posted April 3, 2014 Preferably after you run your query You'd know that if you read the documentation for mysqli_error Quote Link to comment https://forums.phpfreaks.com/topic/287490-textarea-phpmyadmin-settings/#findComment-1474802 Share on other sites More sharing options...
Solution ginerjm Posted April 3, 2014 Solution Share Posted April 3, 2014 mysqli-error should replace all that 'global' stuff you have in your die clause. As for the 'textarea' problem - since you are not scrubbing any of your input, is it possible I(probable?) that you have invalid chars in the text coming in that you need to escape? A single quote in that paragraph will break your query statement. Proper handling of your input prior to including it in a query would have protected you from this. Quote Link to comment https://forums.phpfreaks.com/topic/287490-textarea-phpmyadmin-settings/#findComment-1474803 Share on other sites More sharing options...
ArshSingh Posted April 3, 2014 Author Share Posted April 3, 2014 mysqli-error should replace all that 'global' stuff you have in your die clause. As for the 'textarea' problem - since you are not scrubbing any of your input, is it possible I(probable?) that you have invalid chars in the text coming in that you need to escape? A single quote in that paragraph will break your query statement. Proper handling of your input prior to including it in a query would have protected you from this. yup budy , i have a single quote in cast name its like : D'CRUZ ,,, how can i avoid and submit it ? Quote Link to comment https://forums.phpfreaks.com/topic/287490-textarea-phpmyadmin-settings/#findComment-1474804 Share on other sites More sharing options...
ginerjm Posted April 3, 2014 Share Posted April 3, 2014 You really, really need to learn some things about data handling. Especially when you are going to put it into a query - you risk having your data corrupted, your tables deleted and worse. Take 30 mins and google something like "php input sanitizing". Yes - I could give you one simple fix right now, but you would then still be sorely lacking in the knowledge you need. Quote Link to comment https://forums.phpfreaks.com/topic/287490-textarea-phpmyadmin-settings/#findComment-1474806 Share on other sites More sharing options...
ArshSingh Posted April 3, 2014 Author Share Posted April 3, 2014 You really, really need to learn some things about data handling. Especially when you are going to put it into a query - you risk having your data corrupted, your tables deleted and worse. Take 30 mins and google something like "php input sanitizing". Yes - I could give you one simple fix right now, but you would then still be sorely lacking in the knowledge you need. at this time i really need it ,,, and as you said will take a look at input sanitizing. , please provide an fix Quote Link to comment https://forums.phpfreaks.com/topic/287490-textarea-phpmyadmin-settings/#findComment-1474808 Share on other sites More sharing options...
ginerjm Posted April 3, 2014 Share Posted April 3, 2014 I've heard that before..... Quote Link to comment https://forums.phpfreaks.com/topic/287490-textarea-phpmyadmin-settings/#findComment-1474809 Share on other sites More sharing options...
ArshSingh Posted April 3, 2014 Author Share Posted April 3, 2014 I've heard that before..... sorry??? Quote Link to comment https://forums.phpfreaks.com/topic/287490-textarea-phpmyadmin-settings/#findComment-1474810 Share on other sites More sharing options...
ginerjm Posted April 3, 2014 Share Posted April 3, 2014 Look - I debugged your problem and pointed out your failure to follow proper programming practices. At this point it's your job to solve your dilemma and Do Some Homework. (You could already be reading up on this.) Of course some other well-meaning reader here will probably capitulate and give you an answer that will allow you to continue. Oh, well...... Quote Link to comment https://forums.phpfreaks.com/topic/287490-textarea-phpmyadmin-settings/#findComment-1474811 Share on other sites More sharing options...
Ch0cu3r Posted April 3, 2014 Share Posted April 3, 2014 You might want to have read this http://www.phptherightway.com/#data_filtering Quote Link to comment https://forums.phpfreaks.com/topic/287490-textarea-phpmyadmin-settings/#findComment-1474812 Share on other sites More sharing options...
ArshSingh Posted April 3, 2014 Author Share Posted April 3, 2014 Look - I debugged your problem and pointed out your failure to follow proper programming practices. At this point it's your job to solve your dilemma and Do Some Homework. (You could already be reading up on this.) Of course some other well-meaning reader here will probably capitulate and give you an answer that will allow you to continue. Oh, well...... no rpob , im reading the sanitizing things and getting the idea of how secure is to use the FILTER_VAR ,,, thanks Quote Link to comment https://forums.phpfreaks.com/topic/287490-textarea-phpmyadmin-settings/#findComment-1474813 Share on other sites More sharing options...
ginerjm Posted April 3, 2014 Share Posted April 3, 2014 :) Quote Link to comment https://forums.phpfreaks.com/topic/287490-textarea-phpmyadmin-settings/#findComment-1474815 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.