![]() |
IF NOT EXIST abfrage mit MySQL
Hallo :D Wenn ihr euch fragt warum ich immer euch frage, der Grund ist: Ihr seit die beste Hilfe.
Da ich nun ein Bot mache, muss ich ja auch auswählen können welchen Spieler er spielt! Doch falls der Spielername nicht existiert, soll der Spieler erstellt werden. Für das brauche ich IF NOT EXISTS Doch mein Proble ist, es wird nicht ausgeführt. Liegt es am SQL code? Ach ja das ganze wird in PHP ausgeführt.
Code:
mysql_query("INSERT INTO IF NOT EXISTS ´username´ = $botname `users` (`id`,
`username`, `password`, `banned`, `villages`, `points`, `ennobled_by`, `ally`, `ally_titel`, `ally_found`, `ally_lead`, `ally_invite`, `ally_diplomacy`, `ally_mass_mail`, `rang`, `villages_mode`, `attacks`, `new_report`, `new_mail`, `market_sell`, `market_buy`, `market_ratio_max`, `killed_units_att`, `killed_units_att_rank`, `killed_units_def`, `killed_units_def_rank`, `killed_units_altogether`, `killed_units_altogether_rank`, `do_action`, `last_activity`, `birthday`, `vacation_id`, `vacation_name`, `vacation_accept`, `b_day`, `b_month`, `b_year`, `sex`, `home`, `image`, `personal_text`, `window_width`, `show_toolbar`, `dyn_menu`, `confirm_queue`, `map_size`, `memo`, `map_reload`, `graphical_overwiev`, `overview`, `stufen`, `winter`) VALUES (NULL, '$botname', 'e10adc3949ba59abbe56e057f20f883e', 'N', '', '', '', '-1', '', '0', '0', '0', '0', '0', '', 'prod', '0', '0', '0', 'all', 'all', '3', '', '', '', '', '', '', '', '', '', '-1', '', '0', '', '', '', 'x', '', '', '', '840', '1', '1', '1', '9', '', '', '1', 'new', 'yes', '');'1', '1', '1', '9', '', '', '1', 'new', 'yes', '');"); |
Re: IF NOT EXIST abfrage mit MySQL
Das geht gar nicht wenn schon dann Replace statt INSERT INTO guck mal in der Mysql Doku.
Und selbst dafür braucht mann den Primar KEY denn du anscheinen nicht hast. |
Re: IF NOT EXIST abfrage mit MySQL
Es ist alles in localhost :D Es ist kein online spiel sondern ein lan game :D Aber Was zeigt dann mysql_result wenn es ein Falsches resultat bekommt?
|
Re: IF NOT EXIST abfrage mit MySQL
Zitat:
|
Re: IF NOT EXIST abfrage mit MySQL
Der Fehler ist es wird nicht in phpMyAdmin ausgeführt
|
Re: IF NOT EXIST abfrage mit MySQL
Dann wird Dir phpMyAdmin auch eine Fehlermeldung ausgeben, oder?
[edit] Oder schau mal hier, das scheint Deinem Vorhaben nahe zu kommen: ![]() |
Re: IF NOT EXIST abfrage mit MySQL
Zitat:
|
Re: IF NOT EXIST abfrage mit MySQL
Das würde mich wundern, wenn das ginge. Wie heißt denn die Tabelle, das kann ich in Deinem Statement nicht erkennen.
|
Re: IF NOT EXIST abfrage mit MySQL
EDIT: Ich habe es geschaft...
Ich musste nach insert into tabelle "If not exists" nehmen uns nicht vor tabelle |
Re: IF NOT EXIST abfrage mit MySQL
EDIT2: nein geht nicht :(
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 13:17 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz