WebsiteBaker Support (2.13.x) > General Help & Support

There was an uncatched exception. Call to undefined function mysql_db_query()

<< < (2/2)

svsanchez:
Sorry again, I didn't copy the code provided by the AI, this is what worked (only adding the "i" didn't):


--- Code: ---<?php $result999 = mysqli_query($conn, "SELECT * FROM tb_art_cat WHERE id_categoria_articulo <> 1 ORDER BY id_categoria_articulo ASC"); ?>
--- End code ---

Not sure if it is supposed to do the same as the code that was showing an error.

sternchen8875:
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: ---<?php $result999 = mysqli_query($conn, "SELECT * FROM tb_art_cat WHERE id_categoria_articulo <> 1 ORDER BY id_categoria_articulo ASC"); ?>
--- End code ---

--- End quote ---


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");
--- End quote ---

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");
--- End quote ---

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 * from `tb_art_cat` WHERE `id_categoria_articulo` <> 1 ORDER BY `id_categoria_articulo`  ASC");
--- End code ---



svsanchez:
Thank you for your help!!!  :-)

Navigation

[0] Message Index

[*] Previous page

Go to full version