473,405 Members | 2,310 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

how to get particular id from mysql db

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3.     $result = mysql_query("SELECT user_id,cb_parentid FROM comprofiler ");
  4.     while($row = mysql_fetch_array($result))
  5.     {    
  6.      echo "<td>" . $row['cb_parentid'] . "</td>\n <br/>";    
  7.  
  8.     }    
  9. ?>
i want calculation on particular parent_id but there is problem how can i take particular parent if form while loop. if any one can suggest me how can is possible.
Dec 31 '11 #1
1 2022
Expand|Select|Wrap|Line Numbers
  1. function earning($user_id1)
  2. {
  3.     $income=0;
  4.     $sql_earn="SELECT * FROM jos_comprofiler where cb_parentid='".$user_id1."'";
  5.     $result_earn = mysql_query($sql_earn);
  6.     while($row_earn = mysql_fetch_array($result_earn))
  7.     {
  8.         if($row_earn['cb_package']=='Basic Details Rupees 3400')
  9.         {
  10.             echo $income+=(3400/100)*25; echo "<hr>";
  11.         }
  12.         else if($row_earn['cb_package']=='Advance Details Rupees 6100')
  13.         {
  14.             echo $income+=(6100/100)*25; echo "<hr>";
  15.         }
  16.         //--------------------------//Level 2-------------------------
  17.         $sql_earn1="SELECT * FROM jos_comprofiler where cb_parentid='".$row_earn['user_id']."'";
  18.         $result_earn1 = mysql_query($sql_earn1);
  19.         while($row_earn1 = mysql_fetch_array($result_earn1))
  20.         {
  21.             if($row_earn1['cb_package']=='Basic Details Rupees 3400')
  22.             {
  23.                 echo $income+=(3400/100)*25; echo "<hr>";
  24.             }
  25.             else if($row_earn1['cb_package']=='Advance Details Rupees 6100')
  26.             {
  27.                 echo $income+=(6100/100)*25; echo "<hr>";
  28.             }
  29.         }
  30.         //--------------------------//Level 2-------------------------
  31.     }
  32.     echo $income;
  33. }


here we mention

Expand|Select|Wrap|Line Numbers
  1. <div><?php echo "Earning: ".earning($row0->user_id); ?></div>
Dec 31 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: renster | last post by:
Hi, I was wondering if anyone here had a decent solution to this mysql/php problem. I have a mysql database with a list of groups (group_id, group_name, group_location, group_time,...
1
by: user mysql | last post by:
HELLO FRIENDS. HERE A FANTASTIC NEWS FOR MYSQL WINDOWS USER. READE THIS. The article is grab from www/internetnews/com/ DO YOU THINK THAT IS A GOOD NEWS ? ...
6
by: jacob nikom | last post by:
I would like to create data model for a group of stores. All stores in this group are very similar to each other, so it is natural to allocate one MySQL database per store. Each database is going...
1
by: David | last post by:
Hi, I have a quick question. I have a .asp application in which certain parts, clients can now edit/update/add information to their records in our DB. I basically use an include statement at...
2
by: Saqib Ali | last post by:
I installed mySQL and have it running.... but I think I made a mistake somewhere along the line...... I believe I did follow the instructions that were provided with the distribution at:...
17
by: chicha | last post by:
Hey people, I have to convert MS Access 2000 database into mysql database, the whole thing being part of this project I'm doing for one of my faculty classes. My professor somehow presumed I...
7
by: binary-nomad | last post by:
Hello, When I do a "AND" in a SQL query, eg. SELECT NAME WHERE SEX="male" AND AGE= "30", MySQL does a sub-search, right? i.e. it does the "WHERE SEX=male" first, and then searches through the list...
2
by: shahram.shirazi | last post by:
Hi I am looking to develop an application that provides decision support through various graphs and charts using a mysql backend. My problem is between the data collection and data...
7
by: Randy | last post by:
Folks: We have a web-based app that's _really_ slowing down because multiple clients are writing their own private data into a single, central database. I guess the previous programmer did...
1
by: judy | last post by:
I have several databases that are used to collect data for different client-projects. My intention was to collect the data, and administer mySQL so each client could see only their data. Each of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.