Jump to content
php.lv forumi

SQL kļūda


kalabox

Recommended Posts

Sveiki, kaut kas nav ar sintakti manam sql

 

lūk tabula

 

DROP TABLE IF EXISTS `default_setup_academic`;

CREATE TABLE IF NOT EXISTS `default_setup_academic` (

`academic_id` bigint(20) NOT NULL auto_increment,

`academic_name` text NOT NULL,

`academic_order` bigint(20) NOT NULL,

PRIMARY KEY (`academic_id`)

) TYPE=MyISAM AUTO_INCREMENT=7 AUTO_INCREMENT=7 ;

 

INSERT INTO `default_setup_academic` VALUES (1, 'Doctorate', 1);

INSERT INTO `default_setup_academic` VALUES (2, 'Master', 2);

INSERT INTO `default_setup_academic` VALUES (3, 'Bachelor', 3);

INSERT INTO `default_setup_academic` VALUES (4, 'Associate', 4);

INSERT INTO `default_setup_academic` VALUES (5, 'Senior High', 5);

INSERT INTO `default_setup_academic` VALUES (6, 'Junior High', 6);

 

Un lūk kādu kļūdu met.

SQL vaicājums:

 

CREATE TABLE IF NOT EXISTS `default_setup_academic` (

 

`academic_id` BIGINT( 20 ) NOT NULL AUTO_INCREMENT ,

`academic_name` TEXT NOT NULL ,

`academic_order` BIGINT( 20 ) NOT NULL ,

PRIMARY KEY ( `academic_id` )

) TYPE = MYISAM AUTO_INCREMENT =7 AUTO_INCREMENT =7;

 

MySQL teica:

 

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TYPE=MyISAM AUTO_INCREMENT=7 AUTO_INCREMENT=7' at line 6

 

 

-----------------------------------------

Vaina bija pie TYPE, vajadzēja uz ENGINE nomainīt

Edited by kalabox
Link to comment
Share on other sites

Vaina bija pie TYPE, vajadzēja uz ENGINE nomainīt

mulkjibas - vainigs ir tas ka 2 reizes atkartojas AUTO_INCREMENT =7 AUTO_INCREMENT =7;

un jaunaka SQL versija parasti lieliski saprtot veco versiju vaicajumus ( TYPE un ENGINE )

Edited by Grey_Wolf
Link to comment
Share on other sites

Varētu būt ka dēl AUTO_INCREMENT=7 atkārtošanās tiek izvadītās neskaitāmas šādas kļūdas?

 

 

Notice: Undefined variable: slocation in C:\xampp\htdocs\job\setting.php on line 73

 

Notice: Use of undefined constant joblocation_id - assumed 'joblocation_id' in C:\xampp\htdocs\job\setting.php on line 68

 

PHP.ini vareeja kaut kaa izslēgt šos paziņojumus, man tā liekas..

Link to comment
Share on other sites

Hmm, bet saliekot visur "

 

tagat rāda

Notice: Undefined variable: lang in C:\xampp\htdocs\job\admin\setting.php on line 236

 

 

= Array($lang["lang_dayname_1"], $lang["lang_dayname_2"], $lang["lang_dayname_3"], $lang["lang_dayname_4"], $lang["lang_dayname_5"], $lang["lang_dayname_6"], $lang["lang_dayname_7"]);

 

 

Cik noprotu ar vecāku PHP versiju tādi gļuki nebūtu..?

Link to comment
Share on other sites

Nē. Būtu gan. Skaties kā tas notiekās...

 

Notice: Undefined variable: lang in C:\xampp\htdocs\job\admin\setting.php on line 236

 

Tas ir jāizlasa. Tur rakstīts, ka mainīgais "lang" nav definēts. Definēts nozīmē to, ka Tu centies izdarīt kaut ko ar to mainīgo, bet tam nav dota vērtība. Piemēri...

 

++$x;
$x += 1;
$x = $x + 1;

// Nav zināms cik ir $x.


strToUpper( $myString );

// Nav zināms kas ir $myString.

 

Vispirms ir jāpiešķir vērtība...

 

$x = 3.14;

$myString = 'daGrevis';

 

P.S. Tāpēc cilvēki, kad sāk mācīties programmēt, sāk to darīt ar Pascal'u (visbiežāk). Pascal'ā ir obligāti jādefinē mainīgais pirms tas tiek izmantots.

 

program foobar;


var
x : integer; {* Integrālis bez noteiktas vērtības ir "0". *}
myString : string;


begin

myString = 'daGrevis';


x := x + 1;

myString := AnsiUpperCase( myString );

end.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...