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


Jawaban

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: https://codup.co/error-establishing-a-database-connection/ . 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.
avatar ToobaHarris

@ToobaHarris

2 Kontribusi 0 Poin


Coba baris kode ini :
$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";

diubah menjadi :
$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";

Semoga berhasil.
avatar ahanafi

@ahanafi

707 Kontribusi 449 Poin

  • udah aku coba, masih sama kak errornya - @kartikapatandianan
  • 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 :) - @kartikapatandianan
  • Coba struktur tabelnya fotoin seperti apa.. - @ahanafi

Tampikan semua |


seperti ini kak @ahanafiScreenshot-28.pngScreenshot (28).pngScreenshot-26.pngScreenshot (26).pngScreenshot-27.pngScreenshot (27).png
avatar kartikapatandianan

@kartikapatandianan

7 Kontribusi 1 Poin


biasa data session user data nya kosong
avatar amirulhidayat_google

@amirulhidayat_google

1 Kontribusi 0 Poin


$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();

 coba di bedain , kasih tanda petik kak


avatar beemons123

@beemons123

1 Kontribusi 0 Poin


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. boston escort sites
avatar worldescortshub

@worldescortshub

1 Kontribusi 0 Poin


Login untuk gabung berdiskusi
premium logo tube

Hey, sedang ada diskon premium untuk akses semua kelas. Lihat di sini