Однако проблема, с которой я сталкиваюсь, заключается в том, что когда я пытаюсь получить данные массива в строке, поэтому я могу запустить «оператор If», а затем команду удаления, при печати массива я получаю дубликаты, как показано ниже
Код: Выделить всё
33520891520891do not usedo not use----aaron hattonaaron hattonSunday 8th of September 2013 12:46:20 PMSunday 8th of September 2013 12:46:20 PMUnusedUnused--
Код: Выделить всё
// Set variable for the time
$timenow = date('l jS \of F Y h:i:s A');
// Start Expired password check and drop function
function cronexec_expired ($timenow) {
include('../../config.php');
// Open up a new MySQLi connection to the MySQL database
mysql_connect($dbHost, $dbUsername, $dbPassword);
mysql_select_db($dbTable);
// Query to check the status of the code input
$expiry_check = "SELECT * FROM code_log WHERE status='Unused'";
// Run the query
$expiry_checkexec = mysql_query($expiry_check);
while ($expiry_possibles = mysql_fetch_array($expiry_checkexec)) {
foreach ($expiry_possibles as $expiry_possible) {
print_r ($expiry_possible);
};
}
}
// Start Redeemed Password check and drop function
// Execute Functions
cronexec_expired ($timenow);
При удалении foreach и запуске следующего:
Код: Выделить всё
print_r ($expiry_possibles);
Код: Выделить всё
Array (
[0] => 3
[id] => 3
[1] => 520891
[code] => 520891
[2] => do not use
[refid] => do not use
[3] => -
[hostname] => -
[4] => -
[userip] => -
[5] => aaron hatton
[creater] => aaron hatton
[6] => Sunday 8th of September 2013 12:46:20 PM
[timecreated] => Sunday 8th of September 2013 12:46:20 PM
[7] => Unused
[status] => Unused
[8] => -
[timeredeemed] => -
)
Мобильная версия