convert value from routes/uri to string |
(04-15-2019, 06:26 PM)DELE Wrote: I know and I have tried it and failed if I use the method above. the error is only caused because the value of value is not string type. if I use a basic query I am not happy to see $value flanked by single quotes, if I use an automatic query builder consider the value of $value to be a string but the disadvantage (in my opinion) if using this method is less flexibility. In my testing, it does not matter if $value is a string or an integer. Nor does it matter if the string is flanked with single quotes or not. My test set up has the $key field of type int. I can set $value to a digit or a string representation of that digit and the correct record is returned. In other words, using this code PHP Code: $sql = "SELECT * FROM users WHERE $key = ?"; I get the same results from either of these PHP Code: $value = 307; Are using some other non-string data type for the $key field? |
Messages In This Thread |
convert value from routes/uri to string - by DELE - 04-13-2019, 01:42 AM
RE: convert value from routes/uri to string - by Wouter60 - 04-13-2019, 02:13 AM
RE: convert value from routes/uri to string - by DELE - 04-13-2019, 02:50 AM
RE: convert value from routes/uri to string - by Wouter60 - 04-13-2019, 03:04 AM
RE: convert value from routes/uri to string - by DELE - 04-14-2019, 05:48 AM
RE: convert value from routes/uri to string - by dave friend - 04-14-2019, 07:01 AM
RE: convert value from routes/uri to string - by DELE - 04-15-2019, 06:26 PM
RE: convert value from routes/uri to string - by dave friend - 04-16-2019, 07:02 AM
RE: convert value from routes/uri to string - by dave friend - 04-16-2019, 07:21 AM
RE: convert value from routes/uri to string - by DELE - 04-16-2019, 08:40 AM
|