Mysql Insert Into

Wichtiger Hinweis: Bitte ändert nicht manuell die Schriftfarbe auf schwarz sondern belasst es bei der Standardeinstellung. Somit tragt ihr dazu bei dass euer Text auch bei Verwendung unseren dunklen Forenstils noch lesbar ist!

Tipp: Ihr wollt längere Codeausschnitte oder Logfiles bereitstellen? Benutzt unseren eigenen PasteBin-Dienst Link
  • Guten Tag,


    Wieso wird nix in die Tabbele eingeschrieben??


    hir der code:



    stock create_player_car(playerid,Float:pX,Float:pY,Float:pZ,Float:pA,c1,c2) {
    new query[128], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,MAX_PLAYER_NAME);
    format(query,128,"INSERT INTO `usercars` (`Besitzer`,`CarID`,`PosX`,`PosY`,`PosZ`,`PosA`,`Farbe1`,`Farbe2`) VALUES ('%s','%f','%f','%f','%f','%i','%i')", name,pX,pY,pZ,pA,c1,c2);
    mysql_query(query);
    return 1;
    }

    Mit freundlichen Grüßen,


    Fabi.StaR :love::saint:


  • Hir:


    Code
    [Wed Mar 13 21:10:55 2013] -------------------------[Wed Mar 13 21:10:55 2013]      Logging Started[Wed Mar 13 21:10:55 2013] -------------------------[Wed Mar 13 23:22:41 2013] -------------------------[Wed Mar 13 23:22:41 2013]      Logging Started[Wed Mar 13 23:22:41 2013] -------------------------[23:42:03] Plugin succesfully loaded![23:43:01] Plugin succesfully loaded![23:43:36] Plugin succesfully loaded![23:43:37] Plugin succesfully loaded![23:43:38] Plugin succesfully loaded![23:43:48] Plugin succesfully loaded![23:49:42] Plugin succesfully loaded![23:51:05] Plugin succesfully loaded![23:51:28] Plugin succesfully loaded![00:11:20] Plugin succesfully loaded![22:48:41]  [22:48:41] ---------------------------[22:48:41] MySQL Debugging activated (04/22/13)[22:48:41] ---------------------------[22:48:41]  [22:49:27] >> mysql_query( Connection handle: 1 )[22:49:27] CMySQLHandler::Query(SELECT * FROM `usercars` WEHRE `Besitzer` = 'Fabi.StaR') - An error has occured. (Error ID: 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 '`Besitzer` = 'Fabi.StaR'' at line 1)[22:49:27] >> mysql_real_escape_string( Connection handle: 1 )[22:49:27] CMySQLHandler::EscapeString(usercars); - Escaped 8 characters to usercars.[22:49:27] >> mysql_real_escape_string( Connection handle: 1 )[22:49:27] CMySQLHandler::EscapeString(CarID); - Escaped 5 characters to CarID.[22:49:27] >> mysql_real_escape_string( Connection handle: 1 )[22:49:27] CMySQLHandler::EscapeString(Besitzer); - Escaped 8 characters to Besitzer.[22:49:27] >> mysql_real_escape_string( Connection handle: 1 )[22:49:27] CMySQLHandler::EscapeString(Fabi.StaR); - Escaped 9 characters to Fabi.StaR.[22:49:27] >> mysql_query( Connection handle: 1 )[22:49:27] CMySQLHandler::Query(SELECT `CarID` FROM `usercars` WHERE `Besitzer` = 'Fabi.StaR') - Successfully executed.[22:49:27] >> mysql_store_result( Connection handle: 1 )[22:49:27] CMySQLHandler::StoreResult() - Result was stored.[22:49:27] >> mysql_fetch_int( Connection handle: 1 )[22:49:27] >> mysql_free_result( Connection handle: 1 )[22:49:27] CMySQLHandler::FreeResult() - Result was successfully free'd.[22:49:27] >> mysql_real_escape_string( Connection handle: 1 )[22:49:27] CMySQLHandler::EscapeString(usercars); - Escaped 8 characters to usercars.[22:49:27] >> mysql_real_escape_string( Connection handle: 1 )[22:49:27] CMySQLHandler::EscapeString(PosX); - Escaped 4 characters to PosX.[22:49:27] >> mysql_real_escape_string( Connection handle: 1 )[22:49:27] CMySQLHandler::EscapeString(Besitzer); - Escaped 8 characters to Besitzer.[22:49:27] >> mysql_real_escape_string( Connection handle: 1 )[22:49:27] CMySQLHandler::EscapeString(Fabi.StaR); - Escaped 9 characters to Fabi.StaR.[22:49:27] >> mysql_query( Connection handle: 1 )[22:49:27] CMySQLHandler::Query(SELECT `80` FROM `117` WHERE `Besitzer` = 'Fabi.StaR') - An error has occured. (Error ID: 1146, Table 'autohaustest.117' doesn't exist)[22:49:27] >> mysql_store_result( Connection handle: 1 )[22:49:27] CMySQLHandler::StoreResult() - No data to store.[22:49:27] >> mysql_fetch_float( Connection handle: 1 )[22:49:27] CMySQLHandler::FetchRow() - You cannot call this function now. (Reason: Empty Result)[22:49:27] >> mysql_free_result( Connection handle: 1 )[22:49:27] CMySQLHandler::FreeResult() - The result is already empty.[22:49:27] >> mysql_real_escape_string( Connection handle: 1 )[22:49:27] CMySQLHandler::EscapeString(usercars); - Escaped 8 characters to usercars.[22:49:27] >> mysql_real_escape_string( Connection handle: 1 )[22:49:27] CMySQLHandler::EscapeString(PosY); - Escaped 4 characters to PosY.[22:49:27] >> mysql_real_escape_string( Connection handle: 1 )[22:49:27] CMySQLHandler::EscapeString(Besitzer); - Escaped 8 characters to Besitzer.[22:49:27] >> mysql_real_escape_string( Connection handle: 1 )[22:49:27] CMySQLHandler::EscapeString(Fabi.StaR); - Escaped 9 characters to Fabi.StaR.[22:49:27] >> mysql_query( Connection handle: 1 )[22:49:27] CMySQLHandler::Query(SELECT `80` FROM `117` WHERE `Besitzer` = 'Fabi.StaR') - An error has occured. (Error ID: 1146, Table 'autohaustest.117' doesn't exist)[22:49:27] >> mysql_store_result( Connection handle: 1 )[22:49:27] CMySQLHandler::StoreResult() - No data to store.[22:49:27] >> mysql_fetch_float( Connection handle: 1 )[22:49:27] CMySQLHandler::FetchRow() - You cannot call this function now. (Reason: Empty Result)[22:49:27] >> mysql_free_result( Connection handle: 1 )[22:49:27] CMySQLHandler::FreeResult() - The result is already empty.[22:49:27] >> mysql_real_escape_string( Connection handle: 1 )[22:49:27] CMySQLHandler::EscapeString(usercars); - Escaped 8 characters to usercars.[22:49:27] >> mysql_real_escape_string( Connection handle: 1 )[22:49:27] CMySQLHandler::EscapeString(PosZ); - Escaped 4 characters to PosZ.[22:49:27] >> mysql_real_escape_string( Connection handle: 1 )[22:49:27] CMySQLHandler::EscapeString(Besitzer); - Escaped 8 characters to Besitzer.[22:49:27] >> mysql_real_escape_string( Connection handle: 1 )[22:49:27] CMySQLHandler::EscapeString(Fabi.StaR); - Escaped 9 characters to Fabi.StaR.[22:49:27] >> mysql_query( Connection handle: 1 )[22:49:27] CMySQLHandler::Query(SELECT `80` FROM `117` WHERE `Besitzer` = 'Fabi.StaR') - An error has occured. (Error ID: 1146, Table 'autohaustest.117' doesn't exist)[22:49:27] >> mysql_store_result( Connection handle: 1 )[22:49:27] CMySQLHandler::StoreResult() - No data to store.[22:49:27] >> mysql_fetch_float( Connection handle: 1 )[22:49:27] CMySQLHandler::FetchRow() - You cannot call this function now. (Reason: Empty Result)[22:49:27] >> mysql_free_result( Connection handle: 1 )[22:49:27] CMySQLHandler::FreeResult() - The result is already empty.[22:49:27] >> mysql_real_escape_string( Connection handle: 1 )[22:49:27] CMySQLHandler::EscapeString(usercars); - Escaped 8 characters to usercars.[22:49:27] >> mysql_real_escape_string( Connection handle: 1 )[22:49:27] CMySQLHandler::EscapeString(PosA); - Escaped 4 characters to PosA.[22:49:27] >> mysql_real_escape_string( Connection handle: 1 )[22:49:27] CMySQLHandler::EscapeString(Besitzer); - Escaped 8 characters to Besitzer.[22:49:27] >> mysql_real_escape_string( Connection handle: 1 )[22:49:27] CMySQLHandler::EscapeString(Fabi.StaR); - Escaped 9 characters to Fabi.StaR.[22:49:27] >> mysql_query( Connection handle: 1 )[22:49:27] CMySQLHandler::Query(SELECT `80` FROM `117` WHERE `Besitzer` = 'Fabi.StaR') - An error has occured. (Error ID: 1146, Table 'autohaustest.117' doesn't exist)[22:49:27] >> mysql_store_result( Connection handle: 1 )[22:49:27] CMySQLHandler::StoreResult() - No data to store.[22:49:27] >> mysql_fetch_float( Connection handle: 1 )[22:49:27] CMySQLHandler::FetchRow() - You cannot call this function now. (Reason: Empty Result)[22:49:27] >> mysql_free_result( Connection handle: 1 )[22:49:27] CMySQLHandler::FreeResult() - The result is already empty.[22:49:27] >> mysql_real_escape_string( Connection handle: 1 )[22:49:27] CMySQLHandler::EscapeString(usercars); - Escaped 8 characters to usercars.[22:49:27] >> mysql_real_escape_string( Connection handle: 1 )[22:49:27] CMySQLHandler::EscapeString(Farbe1); - Escaped 6 characters to Farbe1.[22:49:27] >> mysql_real_escape_string( Connection handle: 1 )[22:49:27] CMySQLHandler::EscapeString(Besitzer); - Escaped 8 characters to Besitzer.[22:49:27] >> mysql_real_escape_string( Connection handle: 1 )[22:49:27] CMySQLHandler::EscapeString(Fabi.StaR); - Escaped 9 characters to Fabi.StaR.[22:49:27] >> mysql_query( Connection handle: 1 )[22:49:27] CMySQLHandler::Query(SELECT `Farbe1` FROM `usercars` WHERE `Besitzer` = 'Fabi.StaR') - Successfully executed.[22:49:27] >> mysql_store_result( Connection handle: 1 )[22:49:27] CMySQLHandler::StoreResult() - Result was stored.[22:49:27] >> mysql_fetch_int( Connection handle: 1 )[22:49:27] >> mysql_free_result( Connection handle: 1 )[22:49:27] CMySQLHandler::FreeResult() - Result was successfully free'd.[22:49:27] >> mysql_real_escape_string( Connection handle: 1 )[22:49:27] CMySQLHandler::EscapeString(usercars); - Escaped 8 characters to usercars.[22:49:27] >> mysql_real_escape_string( Connection handle: 1 )[22:49:27] CMySQLHandler::EscapeString(Farbe2); - Escaped 6 characters to Farbe2.[22:49:27] >> mysql_real_escape_string( Connection handle: 1 )[22:49:27] CMySQLHandler::EscapeString(Besitzer); - Escaped 8 characters to Besitzer.[22:49:27] >> mysql_real_escape_string( Connection handle: 1 )[22:49:27] CMySQLHandler::EscapeString(Fabi.StaR); - Escaped 9 characters to Fabi.StaR.[22:49:27] >> mysql_query( Connection handle: 1 )[22:49:27] CMySQLHandler::Query(SELECT `Farbe2` FROM `usercars` WHERE `Besitzer` = 'Fabi.StaR') - Successfully executed.[22:49:27] >> mysql_store_result( Connection handle: 1 )[22:49:27] CMySQLHandler::StoreResult() - Result was stored.[22:49:27] >> mysql_fetch_int( Connection handle: 1 )[22:49:27] >> mysql_free_result( Connection handle: 1 )[22:49:27] CMySQLHandler::FreeResult() - Result was successfully free'd.[22:49:38] >> mysql_query( Connection handle: 1 )[22:49:38] CMySQLHandler::Query(INSERT INTO `usercars` (`Besitzer`,`CarID`,`PosX`,`PosY`,`PosZ`,`PosA`,`Farbe1`,`Farbe2`) VALUE ('Fabi.StaR','2028.631103','132) - An error has occured. (Error ID: 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 ''132' at line 1)[22:49:38] >> mysql_real_escape_string( Connection handle: 1 )[22:49:38] CMySQLHandler::EscapeString(usercars); - Escaped 8 characters to usercars.[22:49:38] >> mysql_real_escape_string( Connection handle: 1 )[22:49:38] CMySQLHandler::EscapeString(CarID); - Escaped 5 characters to CarID.[22:49:38] >> mysql_real_escape_string( Connection handle: 1 )[22:49:38] CMySQLHandler::EscapeString(Besitzer); - Escaped 8 characters to Besitzer.[22:49:38] >> mysql_real_escape_string( Connection handle: 1 )[22:49:38] CMySQLHandler::EscapeString(Fabi.StaR); - Escaped 9 characters to Fabi.StaR.[22:49:38] >> mysql_query( Connection handle: 1 )[22:49:38] CMySQLHandler::Query(SELECT `CarID` FROM `usercars` WHERE `Besitzer` = 'Fabi.StaR') - Successfully executed.[22:49:38] >> mysql_store_result( Connection handle: 1 )[22:49:38] CMySQLHandler::StoreResult() - Result was stored.[22:49:38] >> mysql_fetch_int( Connection handle: 1 )[22:49:38] >> mysql_free_result( Connection handle: 1 )[22:49:38] CMySQLHandler::FreeResult() - Result was successfully free'd.[22:49:38] >> mysql_real_escape_string( Connection handle: 1 )[22:49:38] CMySQLHandler::EscapeString(usercars); - Escaped 8 characters to usercars.[22:49:38] >> mysql_real_escape_string( Connection handle: 1 )[22:49:38] CMySQLHandler::EscapeString(PosX); - Escaped 4 characters to PosX.[22:49:38] >> mysql_real_escape_string( Connection handle: 1 )[22:49:38] CMySQLHandler::EscapeString(Besitzer); - Escaped 8 characters to Besitzer.[22:49:38] >> mysql_real_escape_string( Connection handle: 1 )[22:49:38] CMySQLHandler::EscapeString(Fabi.StaR); - Escaped 9 characters to Fabi.StaR.[22:49:38] >> mysql_query( Connection handle: 1 )[22:49:38] CMySQLHandler::Query(SELECT `80` FROM `117` WHERE `Besitzer` = 'Fabi.StaR') - An error has occured. (Error ID: 1146, Table 'autohaustest.117' doesn't exist)[22:49:38] >> mysql_store_result( Connection handle: 1 )[22:49:38] CMySQLHandler::StoreResult() - No data to store.[22:49:38] >> mysql_fetch_float( Connection handle: 1 )[22:49:38] CMySQLHandler::FetchRow() - You cannot call this function now. (Reason: Empty Result)[22:49:38] >> mysql_free_result( Connection handle: 1 )[22:49:38] CMySQLHandler::FreeResult() - The result is already empty.[22:49:38] >> mysql_real_escape_string( Connection handle: 1 )[22:49:38] CMySQLHandler::EscapeString(usercars); - Escaped 8 characters to usercars.[22:49:39] >> mysql_real_escape_string( Connection handle: 1 )[22:49:39] CMySQLHandler::EscapeString(PosY); - Escaped 4 characters to PosY.[22:49:39] >> mysql_real_escape_string( Connection handle: 1 )[22:49:39] CMySQLHandler::EscapeString(Besitzer); - Escaped 8 characters to Besitzer.[22:49:39] >> mysql_real_escape_string( Connection handle: 1 )[22:49:39] CMySQLHandler::EscapeString(Fabi.StaR); - Escaped 9 characters to Fabi.StaR.[22:49:39] >> mysql_query( Connection handle: 1 )[22:49:39] CMySQLHandler::Query(SELECT `80` FROM `117` WHERE `Besitzer` = 'Fabi.StaR') - An error has occured. (Error ID: 1146, Table 'autohaustest.117' doesn't exist)[22:49:39] >> mysql_store_result( Connection handle: 1 )[22:49:39] CMySQLHandler::StoreResult() - No data to store.[22:49:39] >> mysql_fetch_float( Connection handle: 1 )[22:49:39] CMySQLHandler::FetchRow() - You cannot call this function now. (Reason: Empty Result)[22:49:39] >> mysql_free_result( Connection handle: 1 )[22:49:39] CMySQLHandler::FreeResult() - The result is already empty.[22:49:39] >> mysql_real_escape_string( Connection handle: 1 )[22:49:39] CMySQLHandler::EscapeString(usercars); - Escaped 8 characters to usercars.[22:49:39] >> mysql_real_escape_string( Connection handle: 1 )[22:49:39] CMySQLHandler::EscapeString(PosZ); - Escaped 4 characters to PosZ.[22:49:39] >> mysql_real_escape_string( Connection handle: 1 )[22:49:39] CMySQLHandler::EscapeString(Besitzer); - Escaped 8 characters to Besitzer.[22:49:39] >> mysql_real_escape_string( Connection handle: 1 )[22:49:39] CMySQLHandler::EscapeString(Fabi.StaR); - Escaped 9 characters to Fabi.StaR.[22:49:39] >> mysql_query( Connection handle: 1 )[22:49:39] CMySQLHandler::Query(SELECT `80` FROM `117` WHERE `Besitzer` = 'Fabi.StaR') - An error has occured. (Error ID: 1146, Table 'autohaustest.117' doesn't exist)[22:49:39] >> mysql_store_result( Connection handle: 1 )[22:49:39] CMySQLHandler::StoreResult() - No data to store.[22:49:39] >> mysql_fetch_float( Connection handle: 1 )[22:49:39] CMySQLHandler::FetchRow() - You cannot call this function now. (Reason: Empty Result)[22:49:39] >> mysql_free_result( Connection handle: 1 )[22:49:39] CMySQLHandler::FreeResult() - The result is already empty.[22:49:39] >> mysql_real_escape_string( Connection handle: 1 )[22:49:39] CMySQLHandler::EscapeString(usercars); - Escaped 8 characters to usercars.[22:49:39] >> mysql_real_escape_string( Connection handle: 1 )[22:49:39] CMySQLHandler::EscapeString(PosA); - Escaped 4 characters to PosA.[22:49:39] >> mysql_real_escape_string( Connection handle: 1 )[22:49:39] CMySQLHandler::EscapeString(Besitzer); - Escaped 8 characters to Besitzer.[22:49:39] >> mysql_real_escape_string( Connection handle: 1 )[22:49:39] CMySQLHandler::EscapeString(Fabi.StaR); - Escaped 9 characters to Fabi.StaR.[22:49:39] >> mysql_query( Connection handle: 1 )[22:49:39] CMySQLHandler::Query(SELECT `80` FROM `117` WHERE `Besitzer` = 'Fabi.StaR') - An error has occured. (Error ID: 1146, Table 'autohaustest.117' doesn't exist)[22:49:39] >> mysql_store_result( Connection handle: 1 )[22:49:39] CMySQLHandler::StoreResult() - No data to store.[22:49:39] >> mysql_fetch_float( Connection handle: 1 )[22:49:39] CMySQLHandler::FetchRow() - You cannot call this function now. (Reason: Empty Result)[22:49:39] >> mysql_free_result( Connection handle: 1 )[22:49:39] CMySQLHandler::FreeResult() - The result is already empty.[22:49:39] >> mysql_real_escape_string( Connection handle: 1 )[22:49:39] CMySQLHandler::EscapeString(usercars); - Escaped 8 characters to usercars.[22:49:39] >> mysql_real_escape_string( Connection handle: 1 )[22:49:39] CMySQLHandler::EscapeString(Farbe1); - Escaped 6 characters to Farbe1.[22:49:39] >> mysql_real_escape_string( Connection handle: 1 )[22:49:39] CMySQLHandler::EscapeString(Besitzer); - Escaped 8 characters to Besitzer.[22:49:39] >> mysql_real_escape_string( Connection handle: 1 )[22:49:39] CMySQLHandler::EscapeString(Fabi.StaR); - Escaped 9 characters to Fabi.StaR.[22:49:39] >> mysql_query( Connection handle: 1 )[22:49:39] CMySQLHandler::Query(SELECT `Farbe1` FROM `usercars` WHERE `Besitzer` = 'Fabi.StaR') - Successfully executed.[22:49:39] >> mysql_store_result( Connection handle: 1 )[22:49:39] CMySQLHandler::StoreResult() - Result was stored.[22:49:39] >> mysql_fetch_int( Connection handle: 1 )[22:49:39] >> mysql_free_result( Connection handle: 1 )[22:49:39] CMySQLHandler::FreeResult() - Result was successfully free'd.[22:49:39] >> mysql_real_escape_string( Connection handle: 1 )[22:49:39] CMySQLHandler::EscapeString(usercars); - Escaped 8 characters to usercars.[22:49:39] >> mysql_real_escape_string( Connection handle: 1 )[22:49:39] CMySQLHandler::EscapeString(Farbe2); - Escaped 6 characters to Farbe2.[22:49:39] >> mysql_real_escape_string( Connection handle: 1 )[22:49:39] CMySQLHandler::EscapeString(Besitzer); - Escaped 8 characters to Besitzer.[22:49:39] >> mysql_real_escape_string( Connection handle: 1 )[22:49:39] CMySQLHandler::EscapeString(Fabi.StaR); - Escaped 9 characters to Fabi.StaR.[22:49:39] >> mysql_query( Connection handle: 1 )[22:49:39] CMySQLHandler::Query(SELECT `Farbe2` FROM `usercars` WHERE `Besitzer` = 'Fabi.StaR') - Successfully executed.[22:49:39] >> mysql_store_result( Connection handle: 1 )[22:49:39] CMySQLHandler::StoreResult() - Result was stored.[22:49:39] >> mysql_fetch_int( Connection handle: 1 )[22:49:39] >> mysql_free_result( Connection handle: 1 )[22:49:39] CMySQLHandler::FreeResult() - Result was successfully free'd.

    Mit freundlichen Grüßen,


    Fabi.StaR :love::saint:


  • Wozu brauch man die Teamviewer Daten,wenn doch das Erste doch Problem ersichtlich ist.


    stock create_player_car(playerid,Float:pX,Float:pY,Float:pZ,Float:pA,c1,c2) {
    new query[128], name[MAX_PLAYER_NAME]; // <- Der String ist definitiv zu klein. 200 sollte reichen
    GetPlayerName(playerid,name,MAX_PLAYER_NAME);
    format(query,128,"INSERT INTO `usercars` (`Besitzer`,`CarID`,`PosX`,`PosY`,`PosZ`,`PosA`,`Farbe1`,`Farbe2`) VALUES ('%s','%f','%f','%f','%f','%i','%i')", name,pX,pY,pZ,pA,c1,c2); // <- 128 anpassen UND du hast CarID nicht beachtet
    mysql_query(query);
    return 1;
    }
    Für den Fall CarID ist mit auto-increment versehen, dann solltest du dennoch als Wert NULL dafür angeben.



    Zitat

    CMySQLHandler::Query(SELECT `80` FROM `117` WHERE `Besitzer` = 'Fabi.StaR') - An error has occured. (Error ID: 1146, Table 'autohaustest.117' doesn't exist)


    Wieso heißt die Tabelle bei dir 117 und die Spalte 80 ? Falsch formatiert ? Das würde nämlich nicht mal mit der Fehlermeldung übereinstimmen.


    //Edit: Grammatik .

  • ne immer noch nicht ;(


    EDIT:


    Okay aber beim laden gibt es probleme weil das auto wird net erstellt :( hir der code:



    Mit freundlichen Grüßen,


    Fabi.StaR :love::saint:


    Einmal editiert, zuletzt von Fabi.StaR ()

  • do.de - Domain-Offensive - Domains für alle und zu super Preisen