Menu
  • HOME
  • TAGS

PHP:: mySqli does not insert a new line with a variable

php,mysql,session,mysqli,tinytext

You need to pass the variable as a variable to your query ad wrap your values into an "'s, example: $mysqli->query("INSERT INTO `myDatabase`.`myTable`(Date,Time,SID) VALUES ('1','2','" . $sessionID . "')"); ...

Computation: better to truncate before insertion or let MySQL truncate?

php,mysql,string,truncation,tinytext

In cases like this it's probably best to measure. If you don't notice a difference then it doesn't matter. My intuition tells me that, since your snippet size is very small and the plain text can be very big it would be better to truncate before hand. Take the performance...