WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.6 is now available!


Will it continue with WB? It goes on! | Geht es mit WB weiter? Es geht weiter!
https://forum.websitebaker.org/index.php/topic,32340.msg226702.html#msg226702


The forum email address board@websitebaker.org is working again
https://forum.websitebaker.org/index.php/topic,32358.0.html


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.13.x) »
  • General Help & Support »
  • There was an uncatched exception. Call to undefined function mysql_db_query()
  • Print
Pages: [1]   Go Down

Author Topic: There was an uncatched exception. Call to undefined function mysql_db_query()  (Read 13455 times)

Offline svsanchez

  • Posts: 589
There was an uncatched exception. Call to undefined function mysql_db_query()
« on: April 30, 2024, 06:05:42 AM »
Hello,

I am trying to upgrade several sites made in WB from 2.8.3 to 2.12 or 2.13

After running the upgrade, the backend works but the front-end shows the following message:

There was an uncatched exception
Call to undefined function mysql_db_query()
in line (247) of (/templates/round/index.php):

This happens on SOME of the sites I upgrade, while others work alright. I am leaving this one with the problem hoping that someone can tell me what the problem is in order to fix the others that are having this same issue. (I had to move to another host that still has PHP 5.6 support with the first sites showing this issue but that will only work for some time  :-().
Logged

Offline svsanchez

  • Posts: 589
Re: There was an uncatched exception. Call to undefined function mysql_db_query()
« Reply #1 on: April 30, 2024, 06:13:08 AM »
Sorry, forgot to include the URL of the problematic site:

www.embajadadedinam arca.org

And line 247 has this:

Code: [Select]
<?php $result999 = mysql_db_query("$base_datos","select * from tb_art_cat where id_categoria_articulo <> 1 order by id_categoria_articulo asc"); ?>
Which I ***THINK*** it is not part of WB?
Logged

Offline dbs

  • Betatester
  • **
  • Posts: 8914
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: There was an uncatched exception. Call to undefined function mysql_db_query()
« Reply #2 on: April 30, 2024, 06:31:37 AM »
Hi, can be the solution is easy.
The part mysql_ needs an i.
Try:
Code: [Select]
mysqli_db_query
Logged
https://onkel-franky.de

Offline svsanchez

  • Posts: 589
Re: There was an uncatched exception. Call to undefined function mysql_db_query()
« Reply #3 on: April 30, 2024, 07:22:02 AM »
Hi dbs, unfortunately it didn't work, now the error message is the same but with the "i":

There was an uncatched exception
Call to undefined function mysqli_db_query()
in line (247) of (/templates/round/index.php):
Logged

Offline svsanchez

  • Posts: 589
Re: There was an uncatched exception. Call to undefined function mysql_db_query()
« Reply #4 on: April 30, 2024, 07:34:59 AM »
Hello again, I used AI to try and fix it, it apparently gave me the whole line and it seems that the only change made was the one suggested by dbs, not sure why it didn't work when I added the "i" the first time. Here's the apparently corrected code:

Code: [Select]
<?php $result999 = mysqli_db_query("$base_datos","select * from tb_art_cat where id_categoria_articulo <> 1 order by id_categoria_articulo asc"); ?>
Logged

Offline svsanchez

  • Posts: 589
Re: There was an uncatched exception. Call to undefined function mysql_db_query()
« Reply #5 on: April 30, 2024, 07:39:20 AM »
Sorry again, I didn't copy the code provided by the AI, this is what worked (only adding the "i" didn't):

Code: [Select]
<?php $result999 = mysqli_query($conn, "SELECT * FROM tb_art_cat WHERE id_categoria_articulo <> 1 ORDER BY id_categoria_articulo ASC"); ?>
Not sure if it is supposed to do the same as the code that was showing an error.
Logged

Offline sternchen8875

  • Global Moderator
  • *****
  • Posts: 601
Re: There was an uncatched exception. Call to undefined function mysql_db_query()
« Reply #6 on: April 30, 2024, 09:51:28 AM »
i've to say it like a teacher, sorry:
best solution is a switch to the WB-own $database-object, otherwhise you run from problem to problem. of course, its anything to do, but you'll love it, if everything works at the end
Here some links from our forum - in the first Link, the user define a global $database at the begin, but use the the stand-alone-solution with mysql
https://forum.WebsiteBaker.org/index.php/topic,28402.msg198930.html#msg198930
https://forum.WebsiteBaker.org/index.php/topic,30954.msg215857.html#msg215857
https://forum.WebsiteBaker.org/index.php/topic,29043.msg203946.html#msg203946

to the mysqli-problem

check at first the phpinfo, is there a own block for mysqli like this?
https://i.gyazo.com/5326a147eea466938e50b7f0fcc7bfc9.png

Quote from: svsanchez on April 30, 2024, 07:39:20 AM
Code: [Select]
<?php $result999 = mysqli_query($conn, "SELECT * FROM tb_art_cat WHERE id_categoria_articulo <> 1 ORDER BY id_categoria_articulo ASC"); ?>


this query has two parts, the connector $conn and the Select
in step one search for the definition of the connector, in this example "$conn", the connector for mysqli is a little bit different to the simple mysql. Be sure, that the connector use now mysqli_connect instead of a simple "new mysql" or "mysql_connect"

example for mysqli
Quote
$conn = mysqli_connect("name of the host","your_db_username","your_db_password","used_database");

check and change the colored parts

Tip: php and mysql goes stricter and stricter

Quote
"select * from tb_art_cat where id_categoria_articulo <> 1 order by id_categoria_articulo asc");

for better reading, coding standards and also better work in the future, i marked some part in this example, the sql-commands are green, table-specific datas are in red
Use upper letters for the sql-commands and put every table-specific-datas between apostrophes

same code corrected
Code: [Select]
"SELECT * from `tb_art_cat` WHERE `id_categoria_articulo` <> 1 ORDER BY `id_categoria_articulo`  ASC");


Logged

Offline svsanchez

  • Posts: 589
Re: There was an uncatched exception. Call to undefined function mysql_db_query()
« Reply #7 on: May 03, 2024, 04:22:31 AM »
Thank you for your help!!!  :-)
Logged

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.13.x) »
  • General Help & Support »
  • There was an uncatched exception. Call to undefined function mysql_db_query()
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2