Cara Memperbaiki A Database Error Occurred Error Number: 1064

Mohon bantuannya error yang saya temukan seperti ini :

A Database Error Occurred

Error Number: 1064

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ORDER BY `user_access_menu`.`menu_id` ASC' at line 5

SELECT `user_menu`.`id`,`menu` FROM `user_menu` JOIN `user_access_menu` ON `user_menu`.`id` = `user_access_menu`.`menu_id` WHERE `user_access_menu`.`role_id`= ORDER BY `user_access_menu`.`menu_id` ASC

Filename: D:/xampp/htdocs/wpu-login/system/database/DB_driver.php

Line Number: 691

<?php
    $role_id = $this->session->userdata('role_id');
    $queryMenu = "SELECT  `user_menu`.`id`,`menu`
                         FROM `user_menu` JOIN `user_access_menu`
                            ON `user_menu`.`id` = `user_access_menu`.`menu_id`
                        WHERE `user_access_menu`.`role_id`= $role_id
                    ORDER BY `user_access_menu`.`menu_id` ASC";

    $menu = $this->db->query($queryMenu)->result_array();

    var_dump($menu);
    die;

    ?>
avatar kartikapatandianan
@kartikapatandianan

7 Kontribusi 1 Poin

Diperbarui 3 tahun yang lalu

6 Jawaban:

<div>Your issue is similar to mine, I also faced such issue of data base error and I tried many ways and tricks to solve the issue but nothing worked for me, While searching, I found this guide: <a href="https://codup.co/error-establishing-a-database-connection/">https://codup.co/error-establishing-a-database-connection/</a> . Here they have mentioned the several ways to fix this database error, which I also applied and its worked for me and resolved my issue. Hopefully it may useful for you and the other members of community too.</div>

avatar ToobaHarris
@ToobaHarris

2 Kontribusi 0 Poin

Dipost 3 tahun yang lalu

Tanggapan

Maaf, mksdnya gimana ya kak ?

<div>Coba baris kode ini :</div><pre>$queryMenu = "SELECT user_menu.id,menu FROM user_menu JOIN user_access_menu ON user_menu.id = user_access_menu.menu_id WHERE user_access_menu.role_id= $role_id ORDER BY user_access_menu.menu_id ASC";</pre><div><br>diubah menjadi :</div><pre>$queryMenu = "SELECT user_menu.id,menu FROM user_menu JOIN user_access_menu ON user_menu.id = user_access_menu.menu_id WHERE user_access_menu.role_id= $role_id ORDER BY menu_id ASC";</pre><div><br>Semoga berhasil.</div>

avatar ahanafi
@ahanafi

815 Kontribusi 554 Poin

Dipost 3 tahun yang lalu

Tanggapan

udah aku coba, masih sama kak errornya

aku baca di forum ini juga pertanyaan hampir sama seperti ini cuma aku gk dapat solusinya, katanya masalahnya di versi mariadb nya udah aku ganti ngikut versi yang punya tutorial mah sama aja error kak :)

Coba struktur tabelnya fotoin seperti apa..

siap kak ....

<div>seperti ini kak @ahanafi</div><div class="attachment-gallery attachment-gallery--3"><figure data-trix-attachment="{&quot;contentType&quot;:&quot;image/png&quot;,&quot;filename&quot;:&quot;Screenshot (28).png&quot;,&quot;filesize&quot;:179358,&quot;height&quot;:768,&quot;url&quot;:&quot;https://i.ibb.co/0nYXjsF/Screenshot-28.png&quot;,&quot;width&quot;:1366}" data-trix-content-type="image/png" data-trix-attributes="{&quot;presentation&quot;:&quot;gallery&quot;}" class="attachment attachment--preview attachment--png"><img src="https://i.ibb.co/0nYXjsF/Screenshot-28.png" width="1366" height="768"><figcaption class="attachment__caption"><span class="attachment__name">Screenshot (28).png</span></figcaption></figure><figure data-trix-attachment="{&quot;contentType&quot;:&quot;image/png&quot;,&quot;filename&quot;:&quot;Screenshot (26).png&quot;,&quot;filesize&quot;:197753,&quot;height&quot;:768,&quot;url&quot;:&quot;https://i.ibb.co/sPBXQDB/Screenshot-26.png&quot;,&quot;width&quot;:1366}" data-trix-content-type="image/png" data-trix-attributes="{&quot;presentation&quot;:&quot;gallery&quot;}" class="attachment attachment--preview attachment--png"><img src="https://i.ibb.co/sPBXQDB/Screenshot-26.png" width="1366" height="768"><figcaption class="attachment__caption"><span class="attachment__name">Screenshot (26).png</span></figcaption></figure><figure data-trix-attachment="{&quot;contentType&quot;:&quot;image/png&quot;,&quot;filename&quot;:&quot;Screenshot (27).png&quot;,&quot;filesize&quot;:183058,&quot;height&quot;:768,&quot;url&quot;:&quot;https://i.ibb.co/RBLPFxD/Screenshot-27.png&quot;,&quot;width&quot;:1366}" data-trix-content-type="image/png" data-trix-attributes="{&quot;presentation&quot;:&quot;gallery&quot;}" class="attachment attachment--preview attachment--png"><img src="https://i.ibb.co/RBLPFxD/Screenshot-27.png" width="1366" height="768"><figcaption class="attachment__caption"><span class="attachment__name">Screenshot (27).png</span></figcaption></figure></div>

avatar kartikapatandianan
@kartikapatandianan

7 Kontribusi 1 Poin

Dipost 3 tahun yang lalu

<div>biasa data session user data nya kosong</div>

avatar amirulhidayat_google
@amirulhidayat_google

1 Kontribusi 0 Poin

Dipost 3 tahun yang lalu

<pre>$role_id = $this-&gt;session-&gt;userdata('role_id'); $queryMenu = "SELECT user_menu.id,menu FROM user_menu JOIN user_access_menu ON user_menu.id = user_access_menu.menu_id WHERE user_access_menu.role_id= ".$role_id." ORDER BY user_access_menu.menu_id ASC";

$menu = $this-&amp;gt;db-&amp;gt;query($queryMenu)-&amp;gt;result_array();

<br></pre><div>&nbsp;coba di bedain , kasih tanda petik kak<br><br></div><div><br></div>

avatar beemons123
@beemons123

1 Kontribusi 0 Poin

Dipost 3 tahun yang lalu

<div>until you are someplace within the orbit of the jacksonville franchise or spend it gradual analyzing the nfl’s unrelenting drumbeat of business company operations, you possibly didn’t phrase. however there’s a motive that london expiration is going to be of some essential significance to the nfl in 2021. leader among them are 3 large elements of commercial corporation associated with the league and the jaguars inside the coming months. and trust it or now not, the team securing the no. 1 basic select inside the 2021 nfl draft — and in all likelihood the future of clemson quarterback trevor lawrence in a jaguars uniform — may additionally need to issue into alternatives that shift loads of thousands and thousands of greenbacks in nfl selections, if no longer billions. <a href="https://www.worldescortshub.com/us/bostonmaescorts">boston escort sites</a></div>

avatar worldescortshub
@worldescortshub

1 Kontribusi 0 Poin

Dipost 3 tahun yang lalu

Login untuk ikut Jawaban