Announcement

Collapse
No announcement yet.

Data are not stored!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Data are not stored!

    i tried to insert some data to the mysql database.
    i'm sure that i've connected to the database, and the sql query are corrects. but why the data are not stored in database? there's no errors shown.


    this is the function i use to insert data:

    function insert_data($tablename,$field,$value){ //insert_data
    $inssql = "INSERT INTO $tablename ($field) values ($value)";
    //echo "$inssql";
    $insresult = $this -> queryDB($inssql);
    //echo "$insresult";
    return $insresult;
    }

    pls help!

  • #2
    Are you getting an error?

    Where did $this come from? It's not being passed to the function, and it's not being declaired global.

    Comment


    • #3
      is the the inputation of text from a text box, because if it has " or ' in then it won't input into the database. you have to use a code to change the string like..

      $value = str_replace(chr(13), "<br>", $value);
      $value = str_replace("'", chr(96), $value);
      $value = str_replace('\"', '\\"', $value);

      ..that to make it work

      Comment

      widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
      Working...
      X