[Solved] My query cannot update into database after using function substr() [closed]


Actually i cannot see an obvious error in your code, but i don’t know the context and maybe this steps can help finding the error.

First i would not reuse the variable $result, instead use a new variable. This avoids misunderstandings, if some code could be not executed.

$queryResult = mysql_query($sql);

Then it is better to check the result correctly, because mysql_query() can return mixed types. Note the === operator, you cannot reliably check the result with a simple if statement.

if ($queryResult === false)
  echo "ERROR";
else
  echo "Successful";

Then i would turn error reporting on, this may give you a hint about the actual problem.

error_reporting(E_ALL);

Check what $invoice really contains before using it to do the query.

var_dump($invoice);

Edit:

Just one suggestion more, absolutely try to find another name for your table, using reserved words as tablename, is inviting trouble of all kind.

3

solved My query cannot update into database after using function substr() [closed]