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

wajaap
  • 273
  • 3
  • 20
bro
  • 1
  • 2
  • 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)` – Rao DYC Feb 17 '22 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. – Ebrahim Feb 18 '22 at 11:15
  • Does this answer your question? [PHP parse/syntax errors; and how to solve them](https://stackoverflow.com/questions/18050071/php-parse-syntax-errors-and-how-to-solve-them) – pppery Feb 27 '22 at 02:36

1 Answers1

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))
Isha
  • 99
  • 1
  • 9
  • i tried that and i think i did something wrong the new code: https://pastebin.com/Dcbu9AY6 errors: https://pastebin.com/D4x2ZbnN – bro Feb 17 '22 at 14:13
  • 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 – Isha Feb 17 '22 at 14:27
  • i did everything as u said and now i have these errors: https://pastebin.com/LfR7nvkU – bro Feb 17 '22 at 14:43
  • can you show your code of line 86 – Isha Feb 17 '22 at 14:53