0

I'm new to PHP and I tried to make the code at the very bottom work but I can't make it work so I'm asking for help here. so please help me

php version i use: 8.1.2

errors i get while i try to load the page with the code:

[Thu Feb 17 12:51:36.272143 2022] [proxy_fcgi:error] [pid 473273] [client (ip)] AH01071: Got error 'PHP message: PHP Parse error: syntax error, unexpected variable "$link_id", expecting ")" in /var/www/legionbooter/public_html/lib/class_db.php on line 86'

[Thu Feb 17 12:52:21.093521 2022] [proxy_fcgi:error] [pid 473263] [client (ip)] AH01071: Got error 'PHP message: PHP Parse error: syntax error, unexpected variable "$database", expecting ")" in /var/www/legionbooter/public_html/lib/class_db.php on line 86'

the /var/www/legionbooter/public_html/lib/class_db.php file (the code that doesn't work): https://pastebin.com/Es33qTiw

3
  • 1
    the code you posted on line 84 there's a typo mistake...function select_db($link_id, $database,) it should be instead this function select_db($link_id, $database) Commented Feb 17, 2022 at 13:22
  • welcome to SO. you don't need to ask such questions directly here in SO, in this situation you its better to try the parser/compiler error and most probably you can solve it yourself. Commented Feb 18, 2022 at 11:15
  • Does this answer your question? PHP parse/syntax errors; and how to solve them Commented Feb 27, 2022 at 2:36

1 Answer 1

0
  1. remove comma - function select_db($link_id, $database**,**)
  2. first parameter should be connection and second should be database name, so correct this line also - if (!$this->select_db($this->database, $this->link_id))
Sign up to request clarification or add additional context in comments.

4 Comments

i tried that and i think i did something wrong the new code: pastebin.com/Dcbu9AY6 errors: pastebin.com/D4x2ZbnN
previous code was correct, you just have to remove comma after $database in line 86(previous code) and instead of if (!$this->select_db($this->database, $this->link_id)), convert it if (!$this->select_db($this->link_id,$this->database)) in line 50
i did everything as u said and now i have these errors: pastebin.com/LfR7nvkU
can you show your code of line 86

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.