Jump to content
php.lv forumi

Nezinu kā pareizi nosaukt!


ziedinjsh

Recommended Posts

Sveiki!

 

ir tāda lieta ka dtubāzē tiek saglabātās šādas lietas: ip, url, domain.

 

pie izvadīšanas ar while protams viss ir pēc kārtās. Jautājums ir sekojoš: Kā var izvadīt tā lai parādas piem tikai domain ar count cik ir saistīts ar šo domēnu zem kura ir atkal dažādi url kuriem ir šis domēns un pie šī url ir atkal count ja ir identiski url.

 

Piemēram:

 

www.google.lv (3):

www.facebook.com?page=4 (x1);

www.facebook.com?page=7 (x5);

www.kkas.lv?id=3 (x1)

 

 

www.facebook.com (2):

www.google.com?search=lapa (x1)

www.google.com?search=savaadaak (x4)

Edited by ziedinjsh
Link to comment
Share on other sites

Paldies par ideju, bet uzmocīju šādi:

$hvz = mysql_query("select domain, count(1) as rpt_count from referer group by domain");
while($data = mysql_fetch_array($hvz)){
echo '<p>'.$data['domain'].'('.$data['rpt_count'].')</p>';

 $d = mysql_query("select url, count(1) as rp_count from referer where domain='".$data['domain']."' group by url") or die(mysql_error());
  while($data = mysql_fetch_array($d)){
   echo '<p style="font-size:12px;color:#ccc;">'.$data['url'].' ('.$data['rp_count'].')</p>';
  }
}

Link to comment
Share on other sites

$hvz = mysql_query("select domain, count(1) as rpt_count from referer group by domain");

 

Gadījumā vēlams nebija rakstīt

$hvz = mysql_query("SELECT domain, count(1) AS rpt_count FROM referer GROUP by domain");

?

 

Kapēc vispār ir jātaisa "echo" ar "HTML" saturu?

Noderētu palasīt - "MVC"

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...