Jump to content

bundy

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

bundy's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi, I'm having trouble displaying a list of events. I want to join 5 tables but I can't figure out how to do it. This is the table where I log my events, lets call it log ID | TYPE | UID | PID | TID | CID | DATE 0 | 1 | 0 | 2 | null | null | some date 1 | 2 | 1 | null | 23 | null | some date 2 | 3 | 2 | null | null | 2 | some date (uid = user id, pid = project id, tid = task id, cid = comment id) This is table 'projects': ID|TITLE|DATE 0|Project 1|some date 2|Project 2|some date 23|Project 3|some date This is table 'tasks': ID|PID|TITLE|DATE 0|0|Task 1|some date 13|1|Task 2|some date 23|0|Task 3|some date This is table 'comments': ID|PID|CONTENT|DATE 0|12|Comment on project.id 12|some date 1|2|Comment on project.id 2|some date 2|23|Comment on project.id 23|some date This is table 'users': ID|NAME 0|Tom 1|Sam 2|Erik So my idea was to query each row of table log and displaying a message for each type of event. Example: if type (column type in table log) of event is 1 somebody created a new project thus the message would be: Tom has created a new project called 'Project 2' If type is 2, the message would be: Sam has created a task called 'Task 3' for project called 'Project 1' If type is 3, the message would be: Erik has commented on a project called 'Project 3' I hope I explained my problem clearly enough. Greets
  2. Hello, i'm stuck with something. [b][u]1 The Problem[/u][/b] I have website that uses a directory like this... [img]http://www.explorp.com/screenshot1.jpg[/img] if you click the link let's say 'Products' you get this... [img]http://www.explorp.com/screenshot2.jpg[/img] now what I want is that the first three of the subcategories of screenshot 2 become links beneath the proper parent-category of screenshot 1 something like this (but [color=#666666]'subs'[/color] become the subcategories of the proper parent-category)... [img]http://www.explorp.com/screenshot3.jpg[/img] [b][u]2 The Code[/u][/b] I give you the code where the table with where the categories are generated and displayed [code] <table width="100%" border="0" cellspacing="1" cellpadding="2" class="innertablestyle"> <?     $cats_sql="select * from sbbleads_categories where sb_pid=$cid ";     if($config["sb_cat_listing"]=="alpha")   {       $cats_sql.=" order by sb_cat_name";   }   else   {         $cats_sql.="  order by sb_order_index";   }   $cats_query=mysql_query($cats_sql);   $cnt=1;     while($cats=mysql_fetch_array($cats_query))   {       $rst_query=mysql_query("Select * from sbbleads_categories where sb_pid=".$cats["sb_id"] );       $clist=$cats["sb_id"];       while ( $rst=mysql_fetch_array($rst_query) )       {           $clist.="," . $rst["sb_id"];           $thislist="-1," . $rst["sb_id"];           while ( $rst=mysql_fetch_array($rst_query) )           {               $clist.="," . $rst["sb_id"];   $thislist.="," . $rst["sb_id"];           }           $rst_query=mysql_query("Select * from sbbleads_categories where sb_pid in (" . $thislist . ")" );         }         $sbcat_str= " and  sb_cid IN (" .$clist . ")" ;         $sbq_product_cat="select * from sbbleads_product_cats, sbbleads_products where sb_approved='yes' and sbbleads_products.sb_id=sbbleads_product_cats.sb_offer_id $sbcat_str";         $sbproduct_count=mysql_num_rows(mysql_query($sbq_product_cat));         $sbtotal=$sbproduct_count;         if($cnt%2==1)         {         ?>         <tr>             <td width="20">&nbsp;</td>             <?   }   ?>             <td align="left">     <font class='normal'>         <a href="cat_products.php?cid=<? echo $cats["sb_id"];?>"><? echo $cats["sb_cat_name"]; ?></a>     </font>     <font class="totals">         (<? echo $sbtotal; ?>)     </font> </td>             <?   if($cnt%2==0)   {   ?>             </tr>             <?   }   $cnt++;         } ?> </table> [/code] [b][i]3 The SQL Structure[/i][/b] Here is a screenshot of the SQL structure from the table 'sbbleads_categories' [img]http://www.explorp.com/screenshot4.jpg[/img] and here is a screenshot browsing the table [img]http://www.explorp.com/screenshot5.jpg[/img] as you can see every category has a 'sb_id' and a 'sb_pid', for example the parent-category 'Products' has a sb_pid=0 and a sb_id=70, then the subcategory 'Bottles' has a sb_id=79 and a sb_pid=70, then the subcategory 'Base Cup' has a sb_id=138 and a sb_pid=79 so the hierarchy is as follows Products   Bottles       Base cup           etc... so the sb_pid of a subcategory equals the sb_id of the parent-category. I'm really stuck here what to do  :-\ Thanx, Bundy
  3. [quote author=kenrbnsn link=topic=100188.msg395090#msg395090 date=1152623383] You can also use plain str_replace() [code]<?php $str = 'www.test.com'; echo str_replace('www.','',$str); ?>[/code] Ken [/quote] that worked perfectly! many thanks to everyone!
  4. Hi, I'm using a referral script on my page and it looks like this [quote] 11/07/06, 12:48 www.blablabla.com 11/07/06, 12:31 www.blablabla.org 11/07/06, 12:27 www.blablabla.be 11/07/06, 12:24 www.blablabla.nl 11/07/06, 12:21 www.blablabla.be 11/07/06, 12:18 blablabla.com 11/07/06, 12:13 www.blablabla.com 11/07/06, 12:03 www.blablabla.be 11/07/06, 12:00 blablabla.be 11/07/06, 12:00 www.blablabla.be [/quote] is there a way to remove the www. on the referrals (that have one of course). So in other words I need a script that deletes a certain follow up of chars (in this case www.) in a given string. have another question about the date this time. it's generated by this code (it's a phpbb forum) [code]'LAST' => create_date($board_config['default_dateformat'], $row['referrer_lastvisit'], $board_config['board_timezone'])) [/code] is it possible to drop the date and only display the time? thanks in advance Bundy
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.