#1 21. März 2007 Problem: QUERY FAILED Sers Leute, ich komme einfachnicht weiter. Ich hab hier ein Serverscript, (von Webspell) und es kommt die ganze Zeit wenn ich was speichern möchte bzw. eine Server editiere "Query Failed" So ich schaute in der Datenbank nach und hab mir die php datei 2 std lang durchgeschaut, jedoch ohne Erfolg! Datenbank schaut so aus: tabelle: prefix_server - serverID, hoster, pingboost, ticrate, fps, ip, type, game, name, sort und hier mal die php datei: PHP: <? php if(! ispageadmin ( $userID ) OR substr ( basename ( $_SERVER [ REQUEST_URI ]), 0 , 15 ) != "admincenter.php" ) die( 'Access denied.' ); error_reporting ( E_ALL ); if( $_POST [ 'save' ]) { safe_query ( "INSERT INTO " . PREFIX . "servers ( name, ip, hoster, fps, ticrate, pingboost, type, game, info ) values( '" . $_POST [ 'name' ]. "', '" . $_POST [ 'serverip' ]. "', '" . $_POST [ 'hoster' ]. "', '" . $_POST [ 'fps' ]. "', '" . $_POST [ 'ticrate' ]. "', '" . $_POST [ 'pingboost' ]. "', '" . $_POST [ 'type' ]. "', '" . $_POST [ 'game' ]. "' ) " ); } elseif( $_POST [ 'saveedit' ]) { safe_query ( "UPDATE " . PREFIX . "servers SET name='" . $_POST [ 'name' ]. "', ip='" . $_POST [ 'serverip' ]. "', hoster='" . $_POST [ 'hoster' ]. "', '" . $_POST [ 'fps' ]. "', ticrate='" . $_POST [ 'ticrate' ]. "', pingboost='" . $_POST [ 'pingboost' ]. "', type='" . $_POST [ 'type' ]. "', game='" . $_POST [ 'game' ]. "', WHERE serverID='" . $_POST [ 'serverID' ]. "'" ); } elseif( $_POST [ 'sort' ]) { if( is_array ( $_POST [ 'sortlist' ])) { foreach( $_POST [ 'sortlist' ] as $sortstring ) { $sorter = explode ( "-" , $sortstring ); safe_query ( "UPDATE " . PREFIX . "servers SET sort=' $sorter [ 1 ] ' WHERE serverID=' $sorter [ 0 ] ' " ); } } } elseif( $_GET [ 'delete' ]) { safe_query ( "DELETE FROM " . PREFIX . "servers WHERE serverID='" . $_GET [ 'serverID' ]. "'" ); } echo '<h2>servers</h2>' ; $gamesa = safe_query ( "SELECT tag, name FROM " . PREFIX . "games ORDER BY name" ); while( $dv = mysql_fetch_array ( $gamesa )) { $games .= '<option value="' . $dv [ tag ]. '">' . $dv [ name ]. '</option>' ; } if( $_GET [ 'action' ]== "add" ) { echo '<form method="post" action="admincenter.php?site=servers"> <table cellpadding="4" cellspacing="0"> <tr> <td>Server-Name:</td> <td><input type="text" name="name" size="30" class="form_off" onFocus="this.className=\'form_on\'" onBlur="this.className=\'form_off\'"></td> </tr> <tr> <td>Game:</td> <td><select name="game">' . $games . '</select></td> </tr> <tr> <td>Serveradresse/Port:</td> <td><input type="text" name="serverip" size="30" class="form_off" onFocus="this.className=\'form_on\'" onBlur="this.className=\'form_off\'"></td> </tr> <tr> <td>Serverhoster:</td> <td> <select name="hoster" id="hoster" class="form_off" onFocus="this.className=\'form_on\'" onBlur="this.className=\'form_off\'"> <option>Shark-Systems</option> <option>G-Portal</option> <option>Clanserver4you</option> <option>Server4you</option> <option>Strato-Gameserver</option> <option>1blu</option> <option>Blixserver</option> <option>Servhost</option> <option>Mafia-inc</option> </select> </td> </tr> <tr> <td>ServerFPS: </td> <td><select name="fps" id="fps" class="form_off" onFocus="this.className=\'form_on\'" onBlur="this.className=\'form_off\'"> <option>100</option> <option>200</option> <option>500</option> <option>1000</option> </select> </td> </tr> <tr> <td width="1">Ticrate: </td> <td><select name="ticrate" id="ticrate"> <option>100</option> <option>200</option> <option>500</option> <option>1000</option> </select> </td> </tr> <tr> <td width="1">Pingboost: </td> <td><select name="pingboost" id="pingboost"> <option><i>keinen</i></option> <option>1</option> <option>2</option> <option>3</option> </select> </td> </tr> </tr> <tr> <td>Servertype:</td> <td><select name="type" id="type" class="form_off" onFocus="this.className=\'form_on\'" onBlur="this.className=\'form_off\'"> <option><i>Matchserver</i></option> <option>Publicserver</option> <option>Surfserver</option> <option>Kreedzserver</option> <option>JoccerJam</option> </select></td> </tr> <tr> <td> </td> <td><input type="submit" name="save" value="add Server"></td> </tr> </table> </form>' ; } elseif( $_GET [ 'action' ]== "edit" ) { $serverID = $_GET [ 'serverID' ]; $ergebnis = safe_query ( "SELECT * FROM " . PREFIX . "servers WHERE serverID='" . $serverID . "'" ); $ds = mysql_fetch_array ( $ergebnis ); $games = str_replace ( ' selected' , '' , $games ); $games = str_replace ( 'value="' . $ds [ game ]. '"' , 'value="' . $ds [ game ]. '" selected' , $games ); echo '<form method="post" action="admincenter.php?site=servers"> <table cellpadding="4" cellspacing="0"> <tr> <td>Server-Name:</td> <td><input type="text" name="name" size="30" value="' . $ds [ name ]. '" class="form_off" onFocus="this.className=\'form_on\'" onBlur="this.className=\'form_off\'"></td> </tr> <tr> <td>Game:</td> <td><select name="game">' . $games . '</select></td> </tr> <tr> <td>Serveradresse/Port:</td> <td><input type="text" name="serverip" size="30" value="' . $ds [ ip ]. '" class="form_off" onFocus="this.className=\'form_on\'" onBlur="this.className=\'form_off\'"></td> </tr> <tr> <td>Serverhoster:</td> <td> <select name="hoster" class="form_off" onFocus="this.className=\'form_on\'" onBlur="this.className=\'form_off\'"> <option>Shark-Systems</option> <option>G-Portal</option> <option>Clanserver4you</option> <option>Server4you</option> <option>Strato-Gameserver</option> <option>1blu</option> <option>Blixserver</option> <option>Servhost</option> <option>Mafia-inc</option> </select> </td> </tr> <tr> <td>ServerFPS: </td> <td><select name="fps" class="form_off" onFocus="this.className=\'form_on\'" onBlur="this.className=\'form_off\'"> <option>100</option> <option>200</option> <option>500</option> <option>1000</option> </select> </td> </tr> <tr> <td width="1">Ticrate: </td> <td ><select name="ticrate"> <option>100</option> <option>200</option> <option>500</option> <option>1000</option> </select> </td> </tr> <tr> <td width="1">Pingboost: </td> <td><select name="pingboost" id="pingboost"> <option><i>keinen</i></option> <option>1</option> <option>2</option> <option>3</option> </select> </td> </tr> </tr> <tr> <td>Servertype:</td> <td><select name="type" class="form_off" onFocus="this.className=\'form_on\'" onBlur="this.className=\'form_off\'"> <option>Matchserver</option> <option>Publicserver</option> <option>Surfserver</option> <option>Kreedzserver</option> <option>JoccerJam</option> </select></td> </tr> <tr> <td><input type="hidden" name="serverID" value="' . $serverID . '"></td> <td><input type="submit" name="saveedit" value="update"></td> </tr> </table> </form>' ; } else { echo '<input type="button" class="button" onClick="MM_goToURL(\'parent\',\'admincenter.php?site=servers&action=add\');return document.MM_returnValue" value="new Server"><br><br>' ; $ergebnis = safe_query ( "SELECT * FROM " . PREFIX . "servers ORDER BY sort" ); $anz = mysql_num_rows ( $ergebnis ); if( $anz ) { echo '<form method="post" name="ws_servers" action="admincenter.php?site=servers"><table width="100%" cellpadding="4" cellspacing="1" bgcolor="#999999"> <tr bgcolor="#CCCCCC"> <td class="title" align="center" width="40">Adresse:</td> <td class="title" align="center" width="20">Servertype:</td> <td class="title" align="center" width="30">hoster:</td> <td class="title" align="center" colspan="4" width="20">Actions:</td> </tr> <tr bgcolor="#ffffff"><td colspan="6"></td></tr>' ; while( $ds = mysql_fetch_array ( $ergebnis )) { $list = '<select name="sortlist[]">' ; for( $i = 1 ; $i <= mysql_num_rows ( $ergebnis ); $i ++) { $list .= '<option value="' . $ds [ serverID ]. '-' . $i . '">' . $i . '</option>' ; } $list .= '</select>' ; $list = str_replace ( 'value="' . $ds [ serverID ]. '-' . $ds [ sort ]. '"' , 'value="' . $ds [ serverID ]. '-' . $ds [ sort ]. '" selected' , $list ); echo '<tr bgcolor="#FFFFFF"> <td align="center" width="20"><b>' . $ds [ ip ]. '</b></td> <td align="center" width="20"><b>' . $ds [ type ]. '</b></td> <td align="center" width="30"><b>' . $ds [ hoster ]. '</b></td> <td align="center"><input type="button" class="button" onClick="MM_goToURL(\'parent\',\'admincenter.php?site=servers&action=edit&serverID=' . $ds [ serverID ]. '\');return document.MM_returnValue" value="" style="background-image:url(../images/icons/icon_edit.gif); height:16px ; width:16px; border:none; cursor:pointer;"></td> <td align="center"><input type="button" class="button" onClick="MM_confirm(\'really delete this server?\', \'admincenter.php?site=servers&delete=true&serverID=' . $ds [ serverID ]. '\')" value="" style="background-image:url(../images/icons/icon_delete.gif); height:16px ; width:16px; border:none; cursor:pointer;"></td> <td align="center">' . $list . '</td> </tr>' ; } echo '<tr bgcolor="#CCCCCC"><td colspan="5"></td><td align="center"><input type="submit" name="sort" style="background-image:url(../images/icons/server_save.gif); height:16px ; width:16px; border:none; cursor:pointer;" alt="speichern" value=""></td></table></form>' ; } else echo 'no servers available' ; } ?> + Multi-Zitat Zitieren
#2 21. März 2007 AW: Problem: QUERY FAILED Stell mal in irgendeiner Datei bei Webspell den Debugmodus an. Dann siehst du, welcher Query fehlschlaegt. + Multi-Zitat Zitieren
#3 21. März 2007 AW: Problem: QUERY FAILED wenn nicht gib die sql_querys mit echo aus und versuch ob sie direkt auf phpmyadmin gehen, dann wirst sehen welche geht und welche nicht. so mach ich es zumindestens immer. gruß wollknoll + Multi-Zitat Zitieren
#5 21. März 2007 AW: Problem: QUERY FAILED Such mal in den Dateien. mysql.php confic.inc.php functions.php etc.. + Multi-Zitat Zitieren
#6 21. März 2007 AW: Problem: QUERY FAILED steht in der admincenter.php zufällig von zeile 28 bis 32 nicht das hier: hab mir auch mal ein script gezogen und mich dumm und dämlich gesucht bis ich draufgekommen bin, dass die in der admincenter.php diese zeilen herausgenommen haben... + Multi-Zitat Zitieren