Jump to content
php.lv forumi

SQL syntax


Kikisss

Recommended Posts

$class_query = $dbg[$_serv]->sql_query("SELECT `ClassName` FROM `char_templates` WHERE `ClassId`=". $subclass['char_id'] );

$class = $dbg[$_serv]->sql_fetchrow($class_query);

$class = $class['ClassName'];

 

 

Ошибка запроса (localhost, l2emu_db):

 

SELECT `ClassName` FROM `char_templates` WHERE `ClassId`=

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 '' at line 1

 

nesaprotu kas nav tā...

Link to comment
Share on other sites

Risinājums - pirms metodes izsaukšanas pārbaudīt vai mainīgais $subclass['char_id'] eksistē, vai tas ir skaitlis (virkni tur nevarēsi likt, ja nav pēdiņu) un vai atbilst nepieciešamajam intervālam (parasti - vai lielāks par 0).

Nekas neizdodas(nepārāk man padodas php)... Varbūt kāds varētu palīdzēt ar kodēšanu?

Link to comment
Share on other sites

if(isset(int()$subclass['char_id'])){
//daram to ko vajag
}
else{
//mirstam
}

tas skripts itkā jau ir gatavs, bet man vaig izmainīt tabulas nosaukumus tajā vai ko citu. Ja kāds saprot kaut ko no DataLife Engine ta lūdzu atsaucaties...

Edited by Kikisss
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...