Skip to content
Advertisement

Tag: syntax-error

Laravel could not find driver Cpanel

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 Thanks for your reply. The culprit is my PHP version

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-statements.html

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 this case use whereIn() and pass array to second parameter -where(‘taken’, “N” || “R”) to whereIn(‘taken’, [“N”,”R”])

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 isn’t always the real culprit. But the line number gives a rough idea of where to

Advertisement