Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Calculate Totals From Repeat Region


I need some help with calculating totals from a repeat region. Some times one number sometimes ten. How can this be done.




View Complete Forum Thread with Replies

Related Forum Messages:
Repeat Region
I am trying to convert from using Dreamweaver PHP to hand coding stuff and am having problems with this. I am trying to repeat this line of code for just the first 3 records.

<?php do { ?><p><?php echo $row_newsinfo['newstitle']; ?></p>
<p><?php echo $row_newsinfo['newsbody']; ?></p>
<p><a href="insurance-employee-benefit-news.php?newsid=<?php echo $row_newsinfo['newsid']; ?>">Read the full story >></a></p><br>
<p><img src="../images/hr_small_right.jpg" width="239" height="3"></p><br><?php } while ($row_newsinfo <= 3) ?>

View Replies !
Repeat Region & Checkboxes
Here's what I'm trying to do: I have a simple form for submitting some user choices, and the choices are presented as a recordset with each field using a checkbox to indicate the user's choice. As such, the recordset is embedded within the form. I'm labeling each individual entry of the checkbox array, and everything works fine when I submit the form information...

Except that I have multiple records and I'm displaying them using the Dreamweaver MX repeat region behavior. The records span over multiple pages, and so when i submit the entire form, only the checkbox information from the current page gets sent. What would be the recommended method for passing the checkbox information from other pages as well? Do I need to turn the navigation buttons for the repeat region into individual forms so that they maintain the POST data?

View Replies !
Dreamweaver MX Repeat Region
Im working in Dreamweaver MX with PHP and on a search retults page I keep getting the following MySQL error:

Warning: Supplied argument is not a valid MySQL result resource in /usr/home/dspurdle/public_html/admin/admin_news.php on line 33

Line 33 looks like this:

$totalRows_rsAdminNews = mysql_num_rows($all_rsAdminNews);

It only happens when I put a repeat region onthe page. Is this a Dreamweaver thing or am i missing something?

View Replies !
Sort Repeat Region
I have a table with 3 columns. Points, Matches, and Average. 'Points' and 'Matches' are getting their values from a mysql database and for the 'Average' I'm dividing 'Score' by 'Matches' using the following php code: Code:

<?php echo bcdiv($row_rstbl_players1['Points'], $row_rstbl_players1['Matches'], 2);
?>

These results are all being displayed using Dreamweaver's 'Repeat Region' function. My question is: Is there a way to have a heading above the Average column, that is actually a link, which when clicked on, will sort the results in ascending/descending order? Or, is there a way to get the database to automatically divide the 'Points' column value by the 'Matches' column value and fill the 'Average' column with the result?

View Replies !
Database Delete Repeat Records And Add Up Totals
I have a database full of order records for our website. My goal is to delete people from the same 'address' field and add up the 'total' into one record. Can i get some example code on how this would be done?

View Replies !
Excluding Records From Repeat Region In PHP
PHP 4
MySQL 4.0.20
DW MW 2004 7.01

This problem is giving me a bit of a headache, and I'm getting nowhere
with it so thought I'd open it up to all, any help would be greatly
appreciated.

OVERVIEW
--------
I am creating an ecommerce site for an IT reseller. Customers must log
in to use the purchasing side of the site.

Individual customers that log in have certain products that they are
not allowed to see but this varies between users, so no two customer
may have the same hidden products.

To set this scenario up, I have a main table containing the whole range
of products the reseller sells, and a table referencing the hidden
products, consisting of a "User ID" column and a "Product ID" column.

In MySQL 4.1 I would have no problem running a subselect query and
pulling just allowed products into a recordset, unfortunately I am
running 4.0 which does not support this and I am not in a position to
upgrade the server.

I am currently getting around the problem by creating an 'Allowed
products' table rather thatn 'hidden' and listing "User ID" and
"Product ID" for all products they are allowed to view. This causes a
bit of a problem as the reseller has about 6500 purchasing customers
and 20000 products, so the 'allowed' table would grow incredibly huge,
thats 130,000,000 records if all are allowed!
----
The way I am planning to get around this problem is keep the 'Hidden'
table, create TWO recordsets on a page - one, rsFetchProducts, a
"SELECT * FROM Products" and the other, rsFetchHiddenProducts, "SELECT
Product_ID from HiddenProducts where User_ID = 'users id number'".

I then apply a repeat region to rsFetchProducts to list all data from
the recordset.

******************
What I need to do next is to filter this repeat region with PHP,
basically saying - if any of the Product_ID(s) in rsFetchProducts is
equal to any of the Product_ID(s) in rsFetchHiddenProducts, DON'T
include them in the repeat region.
******************

This must be possible, but by background on PHP isn't too great, I know
I need an if condition in the repeat region, but am not sure if I need
to filter directly from the recordset or pop it into an array first and
then filter.

View Replies !
Nested Repeat Region/data Display
I have the following nested repeat region:

$base_phylum = ''
$base_class = ''
$base_order = ''
$base_family = ''

mysql_query. Code:

View Replies !
Calculate Totals In A Loop
I am trying to calculate the totals of all the fields pulled up in a loop... i.e. I have a database called "checkout" that has bidder numbers, lot numbers, and amount for each lot number. When a person wins an auction (this is a live auction not an online auction) we enter a new row in the database that has the bidder number, the lot number, and the amount.

After the auction is complete and they are checking out we have the script pull all the rows where the bidder number equals the bidder who is paying, it displays their bidder number, and lists each lot number and amount for that lot on separate lines in a loop statement. I would like to have a final line at the end of the page that displays the total of all the amounts listed. I.e. if they have lot number 12 at $50 and lot number 10 @ $27 and lot number 55 @ $63 the script displays as follows...

bidder number: 101
lot number 12: $50
lot number 10: $27
lot number 55: $63

And I would like the end to say total: $140

How can I do this? I appreciate any help... Here is a copy of what I am working with now. Code:

View Replies !
Why The Totals Don't Add Up?
Can anyone tell me why the totals don't add up? PHP Code:

View Replies !
Monthly Totals
I have a table with some records. Only one record per day, but maybe none or lots per month. The values entered are valid for every day from the date of record to next record or today. The user enters a date, And i need two totals: the total for just the chosen month, and the balance (total of all records upto the chosen month). Code:

View Replies !
Totals In A Sql-table
I have a mysql table which stores points of users from a competition. I can
display the table with php, you see which user has points and how much, the
one with the highest points stands on one (off course).

But, I want to display the total amount of points of all users together form
the table standm in the column pts.

I really don't know how to get the total value of all values together. My
first idea is to do something with count, but this only counts the rows.

View Replies !
How Do I Get Totals From A Field?
I am building a simple income and expenditure app for myself, with seperate tables for income and

expenditure. The income table looks like the following:
id INT AUTO_INCREMENT PRIMARY KEY,
date DATE,
income1 INT(10) NULL,
icome2 INT(10) NULL,
income3 INT(10) NULL,
income4 INT(10) NULL,
etc

What has stumped me is how to extract all the entries and get totals of each field?

I want to be able to extract and view totals for each field (eg total_for_field1,

total_for_field2, etc) and then add them all to give me the total for all. One option I had was to automatically increment the current amount with the new entry, but I would like to be able to later trace each entry.

View Replies !
Get Totals For Query
I have a table called call_event. The call_events table has colum called Time_taken. Data in this colum is stored as a decimal vaulue. EG. 4hrs and 15 minutest would be stored as 4.25.

I would like to be able to do a mysql query which give a total of all the returned values from a query but Im not quite sure what syntax I need.

The query I would like to do is to find out the the total time for a call.

I would imagen the query would be somthing like this

Query = SELECT Time_Taken FROM call_event WHERE call_id ="$call_ID";

When running this query it will return all the times_taken which have the call_id field = to $call_ID.

eg 4.5, 3.25 0.00 5.0

However what do I need to do get the total for all these values eg 4.5 + 3.25 + 0.00 + 5.00 = 12.75 I want to be do a query that will return the value of all the time_Taken added up for example in this case I wanted the query to return 12.75

Is this possible with just a query or do I need to do somthing funky with php to add up all the returned values?

View Replies !
Totals From Database
In my database, I have users who each have a certain amount of minutes logged. What I want to do is display the total amount of minutes everybody has logged collectively. Can someone help me with some code that will add all the minutes of each user together? The furthest I've got in selecting the minutes from the database table.

View Replies !
Counting And Storing Totals
I need the $score value in the code below to be cumulative rather than just keep adding the last value and forgetting the previous total.

So, if the score is 5 and the batsmans scores 3 more, the score becomes &#398;', and then if he scores 3 more, 11, etc... Code:

View Replies !
Adding Totals To Table Of Data
I have a table of data that is generated with a query php/mysql. I'd like to show a total for one of the columns that include dollar amounts. How would i go about doing that?

View Replies !
A Repeated Region Within A Repeated Region...
I am trying to list each client in my database. The loop begins with the Clients table and starts spitting out information about the client. Then the second loop begins. This loop goes through the Projects table and it is suppossed to count the number of projects that belong to each member.

Instead of looping through the Projects table each time the Client's loop loops through and gets information for the next client, the Projects table is only looped through on the first run-through of the first client. Can someone tell me how I can get the loop to start at the beginning of the Projects table each time the Clients loop starts over? Code:

View Replies !
Hide Region
I have a page that can be accessed by two differnet urls - what I would like to do is hide a link when coming from the second url

can anyone point me in the roght diection?

View Replies !
Editable Region
I am looking for a code that will allow users to customize an area within the site. I am not advanced coder, but have one working for me. The site is PHP but is auction based.

View Replies !
Protected Region Id
I'm looking informations about use PROTECTED REGION's ie: Code:

//PROTECTED REGION ID[LTY0Yy0xYy0xODYzE0MjFjLTExMDY0YzEwYzEyYzE0MWMxMWMxMzZjLTFjLTE3YzE1NTY=] START
return ($this->error!=null);
//PROTECTED REGION END

View Replies !
Resolved Region
<?php if ($row_rsContactos['web']!="" and $row_rsContactos['email']!="" and $row_rsContactos['fax']!="" and $row_rsContactos['tlm']!="" and $row_rsContactos['tel']!="" and $row_rsContactos['organizador']!="") { ?>
<table width="306" border="0">
<tr>
<td height="12">Contactos</span></td>
</tr>
</table>
<? } ?>

I just want to hide this table when the query fields (except id) return no data (null).
the result of this is that the table never appears, even when the fields return data. if I change !="" with !=="", in that case, the table appears.

View Replies !
Creating Totals Based On Field Input
I am trying to create a report with PHP that pulls data from a mysql database. Lets say in table called survey I have a field called zipcode, in which users fill out a form and enter their zip code. In the database the following entries have been made in the zipcode field: Code:

View Replies !
Sorting A Repeating Region
1. There is a list of products stored in mysql each with a unique auto increment ID
2. There is a repeating region (yes created in dreamweaver) don't hate! This repeating region is a simple div that repeats with each product in it's own div.

I've got some ideas on how to sort this. Which would anyone here recommend?

1. Create a sortID that the user can modify through a form
2. Create a drag and drop using PHP and AJAX

Or is there some other standard way to custom sort these products.

View Replies !
Count The Number Of Peoples In A Region
I've ever the same problem.

Table1
idperson, name, zip

table2
zip, city, region.

Table2: same zip, many cities (1000, Lausanne - 1000, Lausanne1, ...)

Now I'd like ONE query wich return the name, zip and city, but just one
record per zip.

I mean if a record in table1 has zip 1000, I only want the first occurence
of the city (in my case Lausanne).
Actually I get as many records as they are cities with the same zip.

namex,1000,Lausanne
namex,1000,Lausanne1
namex,1000,LausanneN....

How to do so ? in fact what I need is count the number of peoples in a
region, and the region is linked to a zip.

1000, Lausanne, VD
1000, Lausanne1, VD....

the actual query is
select count(idperson), region from table1 inner join table2 on table1.zip =
table2.zip group by region.

View Replies !
PHP - Passing A Variable From A Repeated Region?
I have a repeated region with a 'Name' a 'ID' and a 'Submit' button

Repeated Region
------------------------------------------------
{Recordset1.Name}, {Recordset1.ID} |  SUBMIT |
------------------------------------------------

so on my page I see every name next to every ID in my database and each one has their own submit button.

Now what I need to do is on Submit pass the specific ID of the row in the table for which the submit button was pressed.

For example if they scroll down to the 5 element in the repeated region (with ID 5) and they hit Submit I need to pass the number 5 to a function.

I understand that you cant call a php function from a button press so I have been trying to do this with the
if(isset($_POST['submit']))
{
 // do whatever with the variable.
}

statement. Does anyone know how I can do this properly?

View Replies !
Multiple Queries - How To Loop The Region.
I have created two mysql queries. The result from one query is echoed in one column of a table and the result from the other query is echoed in the next column. These table cells repeat through a loop so that they display all records. However, because I am using TWO queries, I have no clue how to loop the region. I am using dreamweaver's standard 'repeat region' behavior, which obviously isn't going to work because my repeated region relies on two recordsets:

<?php do {?>
<tr><td><?php echo $row_rs_msg_data['topic_id'];?></td></tr>
<?php } while ($row_rs_msg_data = mysql_fetch_assoc($rs_msg_data));?>

View Replies !
Getting MySQL SUM Values For Time Period, Ie Sum Of Totals From Date1 To Date2.
I am trying to make sales reports from a MySQL database. I have successfully made a report for 1 day, ie 2005-08-08, what I would like to do is generate a report from lets say 2005-07-08 to 2005-08-08,

I am not sure how I could write this, if it can be done. Any help or feedback would be great. The date is passed fron the URL, so I would assume that it would be $date1 = start date; $date2 = end date;

This is the code I use for one query to get totals for 1 date:

Code:
SELECT SUM(item_price*quantity) FROM invoice_items WHERE date = '$date1' AND item_type = 'Parts' AND status = 'POSTED'"

View Replies !
Sort Data By Region And The Alphabetical Order
I try to sort my data by region and the alphabetical order for each page the code is okay this way PHP Code:

$query = 'SELECT * FROM artist WHERE LEFT(english_name, 1) = "'.$_GET['letter'].'" ORDER BY english_name ASC'

but when i add region = '.us.' into the query, i have problem display, and it gives me this error message Unknown column 'a' in 'where clause'

$query = "SELECT * FROM artist WHERE region = '.us.' AND LEFT(english_name, 1) = ".$_GET['letter']."";

How can i fix the problem?

View Replies !
Unique Vs. Repeat
how I can make my link script only count unique hits. Would it be easier to set up a new MySQL table? or to have a text database reset daily?

View Replies !
Why Does Each Page Repeat?
I have a site, www.ensemblemsp.com, which i inherited and now manage
has this issue that when you click a page - it does it's little flash
thing, and then starts over again.

is this PHP related?

View Replies !
Don't Show If Repeat
I am running an SQL query through a database that will probably have repeat addresses.
The purpose of this query is to download addresses for printing Labels to send out catalogs.

I need a fast way to make sure no repeat address fields are repeated. I know this is possible by running through the whole query again for each record to see if it has any matches, but that will take forever. I need a fast way to do this.

View Replies !
Get Data To Repeat Itself In Pdf
I need to get some data to repeat itself underneath where it is. It's in a table. If i just repeat the code underneath the last code it will only return one lot of data. The part of code in blue needs to be repeated and output again.

Code: ....

View Replies !
Nested Repeat
Nested repeat and horizontal loop, I think as I am stuck on a small issue with a nested repeat region which is needed and looping through it horizontally with or without tables.
Like 2 or 3 per columns but horizontally? Categoryname1

Image //for this category
Image //for this category

Categoryname2

Image //for this category
Image //for this category.

View Replies !
Keep Repeat Users Out
What would be the best way to keep users from going to a page more then once in a day?
The way I see it there are tons of ways to do it, but what is the best?
cookies? sessions? IP check?

View Replies !
Repeat Mail
I want to get feedback from mine page and use form with mail() function after receiving $_post from form.

If someone refresh the web browser, feedback will be double. How to control this for only one feedback after submit.

View Replies !
Repeat Rows Plus
I have this:

while($row = mysql_fetch_array( $result )) {
echo "<tr><td>";
echo "&nbsp;".$row['user_name']."&nbsp;";
echo "</td><td>";
echo "&nbsp;".$row['user_facility']."&nbsp;";
echo "</td><td>";
echo "&nbsp;".$row['user_position']."&nbsp;";
echo "</td><td>";
echo "&nbsp;".$row['user_email']."&nbsp;";
echo "</td><td>";
echo "&nbsp;".$row['user_contact']."&nbsp;";
echo "</td><td>";
echo "&nbsp;".$row['update_date']."&nbsp;";
echo "</td><td>";
echo "&nbsp;&nbsp;&nbsp;<a href="index.php?page=edit-a-user&id=".$row['user_id']."">edit</a>&nbsp;&nbsp;&nbsp;" ;
echo "</td></tr>";

View Replies !
Repeat Command
I have a page where I have an include(). This include calls up images to be displayed on the page. The images will always be different depending on when you call up the images. Is it possible to call the include("whatever_page.php"); to repeat itself after a delay of perhaps ten seconds. I've been experimenting with sleep(10) and reloading the page but it's not giving me the effect I want.

View Replies !
Repeat Until Find
I have a script that creates a name, and I want to insert this name in the database. However I don't wan't to insert a name that already exists in the database. My real problem is repeat the process of creation of the until it finds a valid name.

View Replies !
Stop Repeat Entries
Can you stop pulling out exactly the same data from a database, for
example, if you had 2 entries which had the name Chris,

View Replies !
Nested Repeat Regions?
I'm building a review system for a list of products in a PRODUCTS table. In my ProductDetail page I'm pulling the product details filtered by their PID and beneath that I'm pulling the review details, which I need to be specific to that product.

My problem is that I've inserted two sample reviews and entered "2" as the PID in the REVIEWS table but the reviews show up on EVERY product page!? Do I need to use nested repeat regions for this which I don't know anything about but rad something about them which made me think that I did need them? PHP Code:

View Replies !
Horizontal Repeat Loop
I have a recordset which i want to populate a table. I want there to be 3 colums accross and as many rows down as necessary. I can loop down the row, but cant work out how i can loop horizontally only three times then go to the next row and repeat. I guess i have to use an array, Code:

View Replies !
For Loop - Repeat Variable
How can I make this recursive.. so that I don't have to put one for each? So say I want to have 10 $n[0]'s be evaluated.. then do that.. or if I want 68.. Instead of doing it like this for 5..? Code:

View Replies !
Mysql Repeat Data
i have looked at database normalization but what i cant desicde where do i stop with not having repeat data and having each feild in its own table? Like say i have a feild in the users table for fsig (forum signature), not everyone is going to have one so should there be another table with fsig,psig and msig (Forum, profile and mail) and assign a userid (related to the users table) to that table or just have the 3 feilds in the user table?

View Replies !
Crop Sentence Repeat
Im am trying to crop a sentance using php and a repeat region but the code I have works for the first item but he second one sends an error. Here is the code

<?php do { ?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="middle" class="toc_img"><?php echo $row_rsFeature['Photos']; ?></td>
<td valign="top" class="toc_desc"><span class="toc_headers"><?php echo $row_rsFeature['title']; ?></span><br /><?php
function CropSentence ($strText, $intLength, $strTrail)
{
$wsCount = 0;
$intTempSize = 0;
$intTotalLen = 0;
$intLength = $intLength - strlen($strTrail);
$strTemp = "";
if (strlen($strText) > $intLength) {
$arrTemp = explode(" ", $strText);
....

View Replies !
Repeat As Many Times As User Specify Then Stop
I'm trying to write a script that uses and tag called steps to creat a tutorial database. This is how it works. the user comes to the page and chooses how many steps are in there tutorial. The $steps are always resubmitted to the same page depending on how many steps the are part shown and the bottom repeats until it reaches that value.

My Problem
I don't know grab the value submitted and make it repeat til that value is match.

<form name="form">
<select name="site" size=1 onChange="javascript:formHandler()">
<?php

$count = 0;

while($count <= 24)

{
$count++;
echo "<option value="submittut.php?steps=$count">
$count</option>";

};
if ($steps != 0)
------------------------> Part 2
{
echo "<br><br><table width="100%" border="0" cellspacing="1" cellpadding="1">

<tr>
<td rowspan="2" valign="middle"><font size="+2"></font>
</td>
<td bgcolor="#cacaca">
<div align="center">
<b>Upload the corresponding picture here</b></div>
</td>
<td bgcolor="#cacaca">
<div align="center">
<b> Paste your the Text and HTML into the text are below</b></div>
</td>
</tr>
<tr>
<td valign="middle">
<div align="center">
<br>
<input type="file" name="fileGetterName" size="26" border="0"></div>
</td>
<td>
<div align="center">
<br>
<textarea name="textareaName" rows="4" cols="40"></textarea></div>
</td>
</tr>";

}
while ()
?>

View Replies !
Display Data In Columns Of 4 And Repeat Rows
What I would really like for it to do is display the results across 4 cells and then start on the next row and so on. Code:

View Replies !
Loop That Will Repeat The Alphabet And Follow The Incrementation
I ve been trying to write a small script that will generate 1000 books (book 1, book 2,...,book 1000)

now  i want to have a loop that will repeat the alphabet and follow the incrementation.
But instead my code gives me -book 1 author: a,....book 1 author: z, book 2 author: a, book 2 author:z... etc-

And i want the code to produce book1 author: a, book2 author:b and when it reaches Z to start again Code:

View Replies !
Repeat Form Field Based On $_POST Data
i have a script that sets up a second page with multiple select boxes. the first script has a hidden field for the ID number, and a text input field for quantity. the second part of the script has a foreach loop that gets the info that goes with the ID number and then creates the select box next to it. for the most part it's all working correctly, but i don't know how to get the submitted "quantity" to repeat that ID number (and everything else). here is the initial form: Code:

View Replies !
Random Number - Repeat A Set Of Code Until A Certain If Statement Is Satisfied
Is there a way to repeat a set of code until a certain if statement is satisfied. If it is then to exit the loop and if not repeat the code? Say I want to write a card game application in PHP and I want to chose a card from the deck $card1 = rand(1,52); gets me my first card. I need to record which card has been dealt so I have a variable $dealt which starts out as a string of 52 zeros. I update the position of $card1 in the
$dealt string to "1".

So the 5 of Spades makes $dealt = "000010000000000 ..."

I want to choose another card so I use $card2 = rand(1,52); and then need to check if it has already been dealt. If the position in $dealt is a 1 then I need to repeat the random number code until it is a 0 when I can update it to a 1 and move on Or is there a better way of doing this sort of thing?

View Replies !
Preg_replace :: Warning: Compilation Failed: Nothing To Repeat At Offset 2
preg_replace() is throwing the following php error when I try to run the following variables through it:
$find = "+ +";
$replace = "+";

Why is this occuring?

Warning: Compilation failed: nothing to repeat at offset 2 in /home/httpd/vhosts/devdomain.com/httpdocs/inc/functions.inc.php on line 68

$find = strtolower($_POST['find']);
$replace = strtolower($_POST['replace']);
$keywords = trim(strtolower($_POST['keywords']));

if ($_POST['replace_words'] == "Replace Words") {
if ($find!= "" AND $find!= NULL) { ....

View Replies !
Calculate A Value That Is In The Db
i want it to calculate a value that is in the db if the db has the value 6 pound(s) (i have a submit button) and the users enters in the input box a value for more pounds then how do i make it calculate in fractions or even divisions.. cause see this is what i have. PHP Code:

View Replies !
Age Calculate
I need to run a query if a user age is within specified age range. User age is store in a table in 0000-00-00 format the age limits are passed by two vars: PHP Code:

$ageMin = 25;
$ageMax = 35;

I can do it in a php function but I'd like to perform this validation in a query string. Is it possible?

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved