I deployed my Laravel project on Cpanel but there’s an error “could not find driver(SQL)” I’m using Mysql database in Cpanel, and I have checked pdo_mysql in PHP extension. but when I looked on phpinfo(); and find pdo_mysql, the result is 0/0 How to fix this? Thanks in advance Answer T…
Tag: syntax-error
Php mysql query update of data gives syntax error
This is my php code to update products in database: It gives this error: Answer This code should work: But a better approach would be to use parameterized prepared statements as you are vulnerable now to SQL injections. Also refer to: https://dev.mysql.com/doc/apis-php/en/apis-php-mysqli.quickstart.prepared-s…
PHP Unexpected String in a return of a function
I am trying to make a function to calculate the time difference of two values, but my return in my code below gives me unexpected string, how come? Answer You do appear to be getting the syntax of Javascript and PHP mixed up. There is no var in PHP – that belongs in Javascript and variables in PHP begin…
PHP how to use OR in the right way
I have simple part of code to detect type of Discount, i added another type, but how to use operator OR (||) right way in this case ? ->where(‘taken’, “N”) or “R” do something. this wont work ->where(‘taken’, “N” || “R”) Answer in t…
PHP parse/syntax errors; and how to solve them
Everyone runs into syntax errors. Even experienced programmers make typos. For newcomers, it’s just part of the learning process. However, it’s often easy to interpret error messages such as: PHP Parse error: syntax error, unexpected ‘{‘ in index.php on line 20 The unexpected symbol is…
PHP expects T_PAAMAYIM_NEKUDOTAYIM?
Does anyone have a T_PAAMAYIM_NEKUDOTAYIM? Answer It’s the double colon operator :: (see list of parser tokens).