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 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 !
How Can I Use Getdate(...) Excluding TZ.
My timezone is GMT +2 So when I do a $date = getdate( 0 ); I get: $date = { ['seconds'] (integer) = 0 ['minutes'] (integer) = 0 ['hours'] (integer) = 2 //<-- Hour is not 0 but +2 ['mday'] (integer) = 1 ['wday'] (integer) = 4 ['mon'] (integer) = 1 ['year'] (integer) = 1970 ['yday'] (integer) = 0 ['weekday'] (string) = "Thursday" ['month'] (string) = "January" [Ɔ'] (integer) = 0 } I cannot do: $date = getdate( 0 - (2*3600) ); as negative numbers are not accepted, (on the window server). So how can I do getdate( 0 ) and return the value without it been converted by the server TZ. Using setlocal(...) is also a bit of a Hacky kind of way of doing things.
View Replies !
CVS And FTP (excluding Directories)
I use CVS to keep track of my source. CVS puts a "CVS" directory in each dir of the site. I don't want to transfer those. Can any one recommend a good FTP client that can transfer files and exclude certain directories from being tranferred based on their name? Free is better :) but, i would be willing to buy a good FTP client.
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 !
Excluding String In Select
I have been working on modifying this code to exclude the genre of Christmas from the query. No matter where I add a genre != 'Christmas' I get errors. Any ideas? I want to exclude any genres that are Christmas. PHP Code:
View Replies !
Random Number Excluding...
Okay, basically I am making a script that will search a random folder, find out how many MIDIs are in that folder (the MIDIs are named 01.mid, 02.mid etc) then generate a random number to decide which midi to play. The problem is that some MIDIs are missing, so it will be like 01.mid 02.mid 04.mid 07.mid 08.mid etc... so in this random number I have to take into account that there are some numbers I need to exclude. This is what I currently have: srand(time()); $rancd = (rand()%4)+1; $num = 0; $end = 0; do { Â Â Â Â $num++; Â Â Â Â Â Â Â Â if ($num < 10) $num = "0".$num; Â Â Â Â Â Â Â Â if (file_exists("media/".$rootid."/music/midi/cd".$rancd."/".$num.".mid")) $last = $num; Â Â Â Â Â Â Â Â else $end++; } while ($end < 6); $num = $num - 1; do { Â Â Â Â srand(time()); Â Â Â Â $random = (rand()%$last)+1; Â Â Â Â if ($random < 10) $random = "0".$random; } while (file_exists("media/".$rootid."/music/midi/cd".$rancd."/".$random.".mid") == FALSE); $song = ("media/".$rootid."/music/midi/cd".$rancd."/".$random.".mid"); Basically this is taking way too long to load, and its not very efficient. so I was thinking in my loop where it checks all the MIDIs in the folder, I could make a variable $file[$num] and set each slot to a boolean value of 1 if it exists, and 0 if it doesnt. But then in the random I'd have to somehow figure out how to make it disclude all the values assigned to 0 Any help? any better ideas?
View Replies !
Excluding Characters / Phrases
I researched on google, and I found ways to exclude a bunch of characters, such as A-Z, but no luck as to what I need. 2 things: If I have a set varchar, such as $100,000 How can I make it exclude the $ and the , so I could do PHP Code: $cost = '$100,000' $pricepaid = '$90,000' if ($pricepaid < $cost) And also, I need to get the surname of some files that i'm uploading.. such as flashfile.swf so how can I exclude the "flashfile." and just leave the swf?
View Replies !
Excluding Values In An Array
I'm trying to exclude variables in an array from my query. (need it to display latest threads a user posted in, excluding threads he started, cause i'm showing those seperately). This is my current code: PHP Code: //Mythreads Latest you posted in $Recordset2 = mysql_query("SELECT DISTINCT `topic_id` FROM `phpbb_posts` WHERE `poster_id` =2 AND `topic_id` != '$id' ORDER BY `post_time` DESC LIMIT 0 , 4") or die(mysql_error()); $blue = 0; while ($results = mysql_fetch_array($Recordset2)) Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â { Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â $id[$blue] = $results[topic_id]; Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â $title[$blue] = $results[topic_title]; Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â $blue++;Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â if ($blue == 5) break; Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â } $Recordset2 = mysql_query("SELECT * FROM `phpbb_topics`") or die(mysql_error());.......
View Replies !
Excluding Files In Array
I have a function which recursively scans a directory and puts things into an array for me. How can I set things up so I can exclude where the word 'schema' exists in the 'name' of this array, so I can then perform other functions on the remaining files? If it were SQL, I would use a LIKE statement; my only idea was to use in_array combined somehow with preg_match, but I'm not sure if this is viable. Code: Array ( [0] => Array ( [path] => ../../dl/MF20060305_223557_CIB_1.txt [name] => MF20060305_223557_CIB_1.txt [extension] => txt [size] => 263733 [kind] => file ) [1] => Array ( [path] => ../../dl/MF20060305_223557_FAL_Schema.txt [name] => MF20060305_223557_FAL_Schema.txt [extension] => txt [size] => 1337 [kind] => file ) [2] => Array ( [path] => ../../dl/MF20060305_223557_RES_1.txt [name] => MF20060305_223557_RES_1.txt [extension] => txt [size] => 5169678 [kind] => file ) )
View Replies !
Excluding Data From From Return.
here is my query: select COUNT(sr.TID) as t_count, r.Email FROM SalesReport sr INNER JOIN SalesReps r ON r.RepCode = sr.RepCode GROUP BY sr.RepCode HAVING t_count <= 19 AND t_count >= 15 is there a way to exclue the t_count from showing up in the returned result? I am just wondering becuase the only reason i need that there is to get the count, don't need the data passed that point.
View Replies !
How Can I Scrape The Name Excluding & # 160 ; (without Spaces)
I am trying to scrape the name Juan and Cruz from the following html script: I see this & # 160 ; without spaces in between Juan and Cruz. Can you please tell me how can i scrape the name excluding & # 160 ; (without spaces) <div id="subtext" style="padding-top: 8px;"> <span style="line-height:18pt;"><strong>Juan *Cruz</strong><br></span> </div>
View Replies !
Omitting / Excluding Files
how to exclude certain files from a remote xdebug session? I am only interested in one file but every file involved in generating the page is included in the debug session which makes it very slow going.
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 !
Member List - Excluding A Record
I have a PHP code that displays a list of members out of a database. The code is the following: $results = mysql_query("SELECT username, userlevel FROM users"); while($values = mysql_fetch_array($results)){      echo $values['username']."- Rank: "; echo $values['userlevel'] != 9 ? "Member" : "Captain"; echo "<br />"; } It displays the Username and the Userlevel, and changes the userlevel to a word (eg 1>Member, 9>Captain). Now I made a user called "Admin", and it shows up in the memberlist. What I want to do is have a code that excludes the username "Admin" from it, so only Users that don't have that username show up.
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 !
List Files In Directory Excluding Directories
I have the following code which I require to get the list of files in a given directory. However in that given directory I have other directories as well. I thought the second if condition was taking care of excluding the directories, but its not. I get a bunch of directories listed along with the files. PHP Code:
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 !
Excluding Parenthesis, Space And Dashes From Phone Number
I store phone number in mysql as integer, e.g. (123) 456-7890 is stored as 1234567890. though, in search form they usually type in a phone number with parenthesis/space/dashes. I have to extract numbers before I search through mysql. currently, I use eregi_replace() function, several times, to do the job:...
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 " ".$row['user_name']." "; echo "</td><td>"; echo " ".$row['user_facility']." "; echo "</td><td>"; echo " ".$row['user_position']." "; echo "</td><td>"; echo " ".$row['user_email']." "; echo "</td><td>"; echo " ".$row['user_contact']." "; echo "</td><td>"; echo " ".$row['update_date']." "; echo "</td><td>"; echo " <a href="index.php?page=edit-a-user&id=".$row['user_id']."">edit</a> " ; 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 !
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 !
Displaying Priorty Records And Normal Records In The One Dataset.
I have a page which displays the records from the database and uses paging to display the records in groupes of 10 per page. I now want to be able to show results depending on the database field (display) in the database (can be set to either "full" or "limited"). If the record and the field display is equal to "full" i want to then display this record at the top of the record set and display all the fields. If the record is equal to "limited" i want to display different results and they must show after all the records which are equal to "full". I can't output two different recordsets as i use paging and only want to show 10 records per page. Code:
View Replies !
|