Dec 1, 2016

Fix Error #1064 PHPMyAdmin MySQL/MariaDB When Creating ENUM

  No comments
Error ini biasanya terjadi ketika kita membuat table menggunakan table builder dimana ada filed yang menggunakan type data ENUM

#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 '0) NULL DEFAULT blablablaaaahh


How to fix this error??

Open your phpMyAdmin folder > go to libraries > open Table.php

In thi case I use Laragon
C:\laragon\etc\apps\phpMyAdmin\libraries

Search for line 402



And change it like this



Code
        if ($length != '' && ! preg_match($pattern, $type)) {
          $lengthFix = str_replace(",", ".", $length);
          if($lengthFix != $length){
              $modified = true;
          }
          if(is_numeric($lengthFix)){
              if($modified){
                  $length = str_replace(".", ",", $lengthFix);
              }
              $query .= '(' . intval($length) . ')';
          } else {
              $query .= '(' . $length . ')';
          }
        }

Save and Restart your apache/mysql


Special thanks to bamz3r

No comments :

Post a Comment

What do you want? Just leave a comment :)