Snažím sa z tabuľky vybrať ID ktoré má autoincrement value a uložiť ho do premennej aby som ho neskôr mohol vložiť ho do ďalšej tabuľky.
Problém, je že neviem prečo mi to nefunguje a vždy je výsledok 0
Skúšal som to už asi 150x upravovať nič mi nefunguje vidíte niekto v čom je problém?
Takto parsujem hodnoty:
$url = filter_input_array( INPUT_GET );
$url['sms'] = trim( $url['sms'] );
$url['credit'] = intval( trim( $url['credit'] ) );
$url['real_credit'] = intval( trim( $url['real_credit'] ) );
$url['time'] = trim( $url['time'] );
$url['id'] = intval( trim( $url['id'] ) );
$url['customer_text'] = trim( $url['customer_text'] );
$url['custom_NICK'] = trim( $url['custom_NICK'] );
$url['custom_STEAMID'] = trim( $url['custom_STEAMID'] );
$url['custom_PASSWORD'] = trim( $url['custom_PASSWORD'] );
$url['refip'] = $_SERVER['REMOTE_ADDR'];
Zvyšok programu:
$result = @mysql_query( "INSERT INTO `".$mysql_prefix."sms_keys` (`sms_text`, `sms_credit`, `sms_real_credit`, `sms_time`, `sms_id`, `sms_customer_text`, `sms_custom_nick`, `sms_custom_steamid`, `sms_custom_password`, `sms_refip`) VALUES ('".mysql_real_escape_string( $url['sms'] )."', '".mysql_real_escape_string( $url['credit'] )."', '".mysql_real_escape_string( $url['real_credit'] )."', '".$url['time']."', '".$url['id']."', '".mysql_real_escape_string( $url['customer_text'] )."', '".mysql_real_escape_string( $url['custom_NICK'] )."', '".mysql_real_escape_string( $url['custom_STEAMID'] )."', '".mysql_real_escape_string( $url['custom_PASSWORD'] )."', '".mysql_real_escape_string( $url['refip'] )."')" ) or die (mysql_error());
logfile( "../log.txt", "a", " Write to Mysql Database Sucessfull!");
mysql_close($db_connect);
$mysqli2_host = "MOJHOST";
$mysqli2_user = "MOJUSER";
$mysqli2_pass = "MOJEHESLO";
$mysqli2_name = "MOJEMENO";
$mysql2_prefix = "MOJPREFIX";
$db_connect2 = @mysql_connect( $mysqli2_host, $mysqli2_user, $mysqli2_pass );
$db_select2 = @mysql_select_db( $mysqli2_name );
if( !$db_connect2 || !$db_select2 )
{
logfile( "../log.txt", "a", "MySQL Connect Error (".mysql_error().") ".mysql_errno() );
}
else
{
$result = @mysql_query( "INSERT INTO `".$mysql2_prefix."amxadmins` (`username`, `password`, `access`, `flags`, `steamid`, `nickname`, `ashow`, `days`) VALUES ('".mysql_real_escape_string( $url['custom_NICK'] )."', '".mysql_real_escape_string( $url['custom_PASSWORD'] )."', '".mysql_real_escape_string( 'bnopqrstz')."', '".mysql_real_escape_string( 'a')."', '".mysql_real_escape_string( $url['custom_STEAMID'] )."', '".mysql_real_escape_string( $url['custom_NICK'] )."', '".mysql_real_escape_string( '0')."', '".mysql_real_escape_string( '30')."')" ) or die (mysql_error());
$id = @mysql_query( "SELECT `id` FROM `".$mysql2_prefix."amxadmins` WHERE (`username`, `password`, `access`, `flags`, `steamid`, `nickname`, `ashow`, `days`) = ('".mysql_real_escape_string( $url['custom_NICK'] )."', '".mysql_real_escape_string( $url['custom_PASSWORD'] )."', '".mysql_real_escape_string( 'bnopqrstz')."', '".mysql_real_escape_string( 'a')."', '".mysql_real_escape_string( $url['custom_STEAMID'] )."', '".$url['custom_NICK']."', '".mysql_real_escape_string( '0')."', '".mysql_real_escape_string( '30')."')" ) or die (mysql_error());
$id = (int) $row['id'];
$answer = " ".$id." ";
exit( $answer );
$result2 = @mysql_query( "INSERT INTO `".$mysql2_prefix."admins_servers`(`admin_id`, `server_id`, `custom_flags`, `use_static_bantime`) VALUES ('".mysql_real_escape_string( '$id')."', '".mysql_real_escape_string( '6')."', '".mysql_real_escape_string( 'bnopqrstz')."', '".mysql_real_escape_string( 'no' )."') ") or die (mysql_error());
logfile( "../VIP_LOG/vip_act_log.txt", "a", "Write to Mysql Database Sucessfull! " );