Jump to content

textarea phpmyadmin settings


ArshSingh
Go to solution Solved by ginerjm,

Recommended Posts

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";
}  
?> 
 
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 by ArshSingh
Link to comment
Share on other sites

  • Solution

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.  :)

Link to comment
Share on other sites

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 ?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

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......

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.