Ciao a tutti,
ho una query che SE username && pw sono sbagliati, restituisce cmq questo risultato:
Ora, in PHP, io salvo il risultato in un array:codice:idCustomer nameShop totalMembersCard NULL NULL 0
Il problema è che io dovrei fare un confronto, per poi stampare a video due cose diverse.codice:if($result->num_rows > 0) { while($row = mysqli_fetch_array($result)) { $customer = array( 'idCustomer'=>$row['idCustomer'], 'nameShop'=>$row['nameShop'], 'totalMembersCard'=>$row['totalMembersCard']); } // while $result->close();
Se l'array è correttamente popolato (se quindi ho passato i corretti user e password) allora stampa "OK", altrimenti stampa KO.
Ho provato a confrontare anche cosi, ma senza successo:
Esegue il codice e stampa "id is not null"codice:if($customer[idCustomer]!=NULL) { echo "id is not null... enjoy"; } else { echo "id is null"; }
se dovesse servire la query è questa...
grazie in anticipo!codice:'SELECT customers.idCustomer, nameShop, COUNT(membersCard.idCustomer) AS totalMembersCard FROM customers LEFT JOIN membersCard ON customers.idCustomer = membersCard.idCustomer WHERE usernameCustomer = \''.$username.'\' AND passwordCustomer = \''.$password.'\'';


Rispondi quotando