When $myTable[‘title’] is “abcdeK”, I like to choose “abcde”.
When $myTable[‘title’] is “xyzA”, I like to choose “xyz”.
The code below is for it…
$removedTitle = substr($myTable['title'], 0, -1) ;
$updateMyTable = $databaseConnect->query("update myTable
set myColumn = '$removedTitle' where moyID = $myID");
The code above works filne.
I like to use database function instead of the php variable " $removedTitle".
The code below which does not work correctly is one of my trials for it…
$updateMyTable = $databaseConnect->query("update myTable
set myColumn = substr('$myTable[title]', 0, -1) where moyID = $myID");
Is there any database code instead of the php code of the above?