Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [MySQL]Pobieranie wszytskich pustych rekordów
diamondking
post
Post #1





Grupa: Zarejestrowani
Postów: 100
Pomógł: 0
Dołączył: 7.02.2014

Ostrzeżenie: (0%)
-----


Witam - jestem bardzo początkujący (IMG:style_emoticons/default/wink.gif)

Mam w bazie danych tabelę users obecnie składa się z pól:

Jak mam pobrać wszystkie puste pola z tej tabeli i je zliczyć?



Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
diamondking
post
Post #2





Grupa: Zarejestrowani
Postów: 100
Pomógł: 0
Dołączył: 7.02.2014

Ostrzeżenie: (0%)
-----


Czy musicie mi to tak utrudniać (IMG:style_emoticons/default/smile.gif)
UCZE SIĘ (IMG:style_emoticons/default/smile.gif)
Czy ktoś mógłby napisać działający kod (IMG:style_emoticons/default/nerdsmiley.png) ?
Ja próbuję i nie umiem :/

  1. //procent profilu2
  2. function procent_profil2(){
  3.  
  4. $sql= "SELECT * FROM users WHERE user_id = 1";
  5. $q = mysql_query($sql);
  6. $result = mysql_fetch_assoc($q);
  7.  
  8. $allFields = count($result)-1;
  9. $filledFields = count(array_filter($results))-1;
  10.  
  11. $filledPercent = $filledFields / $allFields *100;
  12.  
  13. echo $filledPercent;
  14.  
  15. }


nadal błąd:

Warning: array_filter() expects parameter 1 to be array, null given in /home/u416505061/public_html/config.php on line 127 -11.111111111111
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 5.10.2025 - 15:17