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.





Comma Seperated List Comparison


is it possible to compare acomma separated list aginst another

eg comma list 1 => 1,2,3,4,5
comma list 2 => 3,5
can you check that 3 is in both, and 5 is in both, therfore they match?

the comparison is to check that if product a who supplies products 1,2,3,4,5
can be used instead of product b who supplies 3,5 as product a already
supplies them




View Complete Forum Thread with Replies

Related Forum Messages:
Breaking Up A Comma Seperated List
i have a list seperated by commas: 1. 3. 5. 7. 9 actually is a varible

$members ="1, 3, 5, 7, 9"; what would be the best way to break that up to insert the values into a table in a loop.

View Replies !
Alphabet Seperated By A Comma
How would I take every letter in the alphabet seperated by a comma and mix them up in every which way possible with only four letters, so that it comes up differently each time and has only 30 on each line ? Example:

aaab,awdr,cfty,bvfg,ewvt, and so on so that in each line it has 30 different ones

View Replies !
Preg_split - Field Is Seperated By Comma
I have a text file which each field is seperated by comma. And each field can contain either numeric character or non-numeric character(which is
surrounded by a pair of double quotes).

But my problem is: if I seperate the fields using comma, then the address field will be seperated into 2 array elements array, since my address field itself contains comma. Code:

View Replies !
Seperate Links From Comma Seperated Value In A Databse
I have a value which is $keywords in my database The key words are separated by commas, like:  fun, funny, exciting, weird I want to make each of those keywords link to "link.php" I can only get them all to be one link, how would I make them each into seperate links.

View Replies !
Seperating Comma Seperated Field Entries
i want to seperate my comma seperated field and replace the comma with a line break when displaying so that url1 , url2 , url3 and so on becomes:

url1
url2
url3
and so on.

I know what to do when i know how many urls, but this number is indefinite.

View Replies !
Setting Comma Seperated Values As Variables
I am trying to load numbers from a list in a MySQL database then I need to seperate them all out and have a variable for each. For example, I have 6 comma seperated values stored in a datbase (1,2,3,4,5,6 for example) I then need to set a variable for each e.g. $n1 is set to 1, $n2 is set to 2, $n3 is set to 3, and so on (obviously these won't be the actual numbers, otherwise I could have just hard-coded them) and then I will be using these values in the rest of the script. I can not change it so that the values from the database are provided any other way - they are always in this format. Say the list in my database looks like this. 1,2,4,8,16,32. I would want variables like this:

$1 = 1
$2 = 2
$3 = 4
$4 = 8
$5 = 16
$6 = 32

View Replies !
Pull Data From Mysql From A Varchar Field With Comma Seperated Data
I'm trying to pull data from mysql from a varchar field with comma seperated data, like: test, test, test, and so on. when I try to display the data i just get "array" in the input field. what i'm wondering is how can I show the data correctly? I'm a little lost here.

View Replies !
Re Comma Separated List - Another Question
I can do the match perfectly but what i also need to do is create a third
list of comma separated values that are in both

eg:

List 1 => 1,2,3,4,5,6,7,8,11
List 2 => 1,3,4,5,6,7,10,23

Therefore

List 3 => 1,3,4,5,6,7

How do I populate this third list - I'm really stuck ....

View Replies !
How To Remove Last Comma From A Multiple List?
I have a multiple select list in my site where the values are inserted in a database table, in a column named available_country. I enter these values in the db separated with comma. I don't know however how to remove the last comma so it will be something like this:

USA, Europe, Asia

and not:

USA, Europe, Asia,

Here's what I tried but it didn't worked: ...

View Replies !
Meaning Of Comma After Bracket Eg. List(, $value)
i cant find what this means when you have a comma after a bracket as in for example

php list(, $value)

anyone could explain why that comma is there or at least what its called so i can read about it?

View Replies !
Comma Separated List In MySQL Field
say I have a list of categories in a field, and a page that is supposed to pull from the db based on a category. Is there any way I can do a query where it searches the contents of that field for the category in question?

like SELECT FROM table WHERE category = $category  but have it search the category field (the comma separated list for each entry) for the $category var

View Replies !
Array Form A Comma Delineated List
What's the best way to create an array from a comma delineated list?

I have a string assigned to a variable that looks like this: 1,2,3,4

And I would like to create an array so that $arr[0] = 1 and $arr[1] = 2 etc.

It seems so simple but I just can't crack it.

View Replies !
Easy Comma-delimited List To Dropdown Box Converter
I was working on a simple converter when I realized that by not setting the id param of the option tag, it wasn't going to send the value of the dropdown box to my php script. I had this to start with: Code:

View Replies !
Regular Expression :: Find Word Matches To Words In A Comma-delimited List
What's the *right* way to find word matches to words in a comma-delimited list. For example, if I have the following comma-delimited list of categories in a mysql db field:

gameboy, nintendo, playstation

and I do a search, I know I can use regexp to do something like:

select * from categories where regexp 'gameboy,'

Notice that I have the comma in there to match the whole word and the comma without matching part of a word (to prevent unwanted matches such as "play" to "playstation" or "game" to "gameboy"). The problem I'm running into is words that match that match the end of each word next to the comma (in this example, "boy" and "station"). What's the right way to match a word *exactly* using regexp *without* also matching *part* of a word.

View Replies !
Keeping HTML And PHP Seperated?
Could anyone explain the different ways there are to keeping HTML and PHP seperated?

View Replies !
Seperated Function Files
I've always used seperated function files for organization and bandwidth saving purposes, but I want to know, is this really necessary? Do you guys recommending splitting the functions to save bandwidth, according to the user needs it'd be required.

View Replies !
Getting Total Of 2 Values Seperated By Space
i have a DB and which has a field called rates. in rates i have 2 values stored by using a space in between. i.e 45 65

i just need to TOTAL the 2 values in the field, when i PHP a total i only get the 45, it does not read the space and misses the 65. i need to be able to total them both and get 110.

View Replies !
How To Get A Dynamic Javacript Form Variables Seperated In PHP
PROBLEM: I have this form that allows the user to dynamically create
additional fields (see javascript code bellow). I am trying to retrieve
the values entered into these fields from my php script. I ultimatly
need to pick out the variables and place the values into my php script
page. I have worked with a little code I found on php.net (see php code
below), but I wan unable to grasp the knowledge on how to seperate the
variables in the address bar. Please reply.

QUESTION: How do I create variables in my php script from my dynamic
javascript form?

PHP CODE:
foreach($_GET as $name => $value) {
print "$name : $value<br>";
}

JAVASCRIPT CODE:
<HEAD>
<!-- Begin
function createForm(number) {
data = "";
inter = "'";
if (number < 16 && number > -1) {
for (i=1; i <= number; i++) {
if (i < 10) spaces=" ";
else spaces=" ";
data = data + "URL " + i + " :" + spaces
+ "<input type='text' size=10 name=" + inter
+ "url" + i + inter + "'><br>";
}
if (document.layers) {
document.layers.cust.document.write(data);
document.layers.cust.document.close();
}
else {
if (document.all) {
cust.innerHTML = data;
}
}
}
else {
window.alert("Please select up to 15 entries.");
}
}

View Replies !
Get Alpha/numeric Data, Seperated By A Space
I need some help with sorting.  If the field attribute is INT, and the data is 1, 2, 3, 10, 20, 30, they sort as:

1
2
3
10
20
30

But if the field attribute is VARCHAR, and the data is ABC 1, ABC 2, ABC 3, ABC 10, ABC 20, ABC 30, they sort as:

ABC 1
ABC 10
ABC 2
ABC 20
ABC 3
ABC 30

How can I get alpha/numeric data, seperated by a space, to sort like INT?

View Replies !
Comparison
I use this code to pull out messages less than 7 days old on my message board:PHP Code:

View Replies !
Comparison ASP.NET And PHP
i m working on PHP my boss decide to move all project to ASP.NET ,because it is more secure , how can i prove that PHP more secure than ASP.NET.

View Replies !
Comma Seperator
I have numbers retrieved from database which is quite big. Is it possible to give a comma seperator in the sql query or otherwise
how can I format with a thousand comma separator?

View Replies !
Deleting Last Comma
The code below displays pet names like so:

Fido, Bowser, Kittycat, Spot,

and I want to delete only the last comma. I tried 'substr' and 'rtrim' and both of those delete the space and comma between each name, not just the last name as I'd like, so I end up with:
Fido,Bowser,Kittycat,Spot,

How would I delete only the last comma, so that it is this instead?
Fido, Bowser, Kittycat, Spot

Even with trim and substr, I end up with:

View Replies !
Exporting To CSV Contain Comma In It.
There are some text fields that I am exporting to CSV contain comma in it. And so when I open the csv file, everything is shifted.

e.g. "Apple, Banana, Orange", "Excellent", "12345"

gives me 5 columns instead of 3 in the csv: Apple Banana Orange Excellent 12345 How can I solve this problem?

View Replies !
Formatting With A Comma>
i inserted a salary into mysql with a text file but the command i said was to end field with comma, so i just made 750,000 like this in the txt file like this 750000.

ok so how can i format my php to display it as the 750,000 and even better add a floating dollar sign would help as well Code:

View Replies !
Don't Want The Comma For The Very Last Record
I don't want the comma for the very last record. How can I state this in the loop below? while($emailline= mysql_fetch_array($getemailresult, MYSQL_ASSOC)){
$sendTo.="$emailline[email],";
}

View Replies !
Stripping Last Comma
When pulling flavors from a mySQL database, I want to strip the last comma from the array, however I'm not sure how to do this. The stripped down code is below with the comma I want stripped in bold red:

$query2 = "SELECT flavors from chip_stan_flav";
$result2 = @mysql_query($query2) or Die("Couldn't execute query");

while ($row2 = mysql_fetch_array($result2)) {

printf ("%s, ",
$row2[flavors]);

}

View Replies !
Sending Comma In Url
I have a page that has a drop down menu, when item is selected the request is send to info.php?item=selectedIndex. Everything works, however when I have selected value with a comma: "Comany, Inc" the url redirection does not work. Is there a function in php I should use to encode url, or commas are not allowed at all.

View Replies !
Only Split First Comma
i have to split a substring from a string how do it? my requirement is i have a variable $var =,1,4,7 out put should be like $var =1,4,7(split first comma from the value.

View Replies !
Remove First Comma
I have this string:

",c2=5,c3=6,c4=5......"

Now I need to remove the first comma. I know it is simple, but I can find the right command.

View Replies !
Comparison Problem...
What's the equivalent of perl's =~ operator in PHP?

I have a variable and I need to check if somewhere in its value a certain piece of data exists.

View Replies !
What Does == Comparison Operator Mean?
I know what these operators stand for:
=,<,>,<=,>=,!=

But I'm not sure what this one means:
==

Can someone tell me?

View Replies !
3 Or More Variable Comparison
I was trying to compare the value of 3 different variables in a row but I was only able to compare two of them. What I want to do is to compare if the value of $VarOne, $VarTwo and $VarThree are all equal to "Ok" string. PHP Code:

View Replies !
Anyone Knows A Technical Comparison Of IPB And VB And UBB?
I want the best board: low CPU/memory take. Low
MySQl usage.

I have heard that PHPBB is the worst if you know PHP and read the codes. So
I pass on that one.

Can anyone who knows PHP inside out tell me the technical comparison of IPB
and vB and UBB? Which one is the fastest? Which takes the least MySQL
update? Which one can handle the largest BBS?

View Replies !
Database Comparison?
I've only got a couple years experience developing for Access but have
recently been experimenting with HTML/javascript for gui and
client-side scripting, mysql for database and php for server-side
scripting. I've been running it all on the development machine until
the application I'm building is advanced enough to start
optimising/testing with network lag in mind. So it's no slower, and in
some ways at least it seems faster.

Has anyone had much experience with both? If so, what are your
relative opinions of the two packages if used for the same purposes? I
haven't made up my mind as to convenience overall since the web-based
app hasn't been deployed to any users yet (although I can imagine that
will be simpler, since people just need to connect to an ip address),
but a few advantages I have noticed in developing it include:

- Less confusion due to separation of components.

While I thought it might make things more complicated, it seems clear
after using it that php is built more than anything to easily sit on
an apache server, talking to a mysql database and spitting out html to
a web browser. That makes sense I guess since php is made only by its
users and that's what most people seem to use it for. The actual
advantage to separating the components is you know where the problem
is. If you get an error in the javascript console, it's a javascript
error, if it's in the browser it's php, unless it's in the database,
in which case it says it's a mysql error. Given how unintuitive
error-messages often are for any programming tools, knowing where to
start at least, is nice.

Besides debugging myself, it also makes it easier to find posts on the
net from other people who have had the same problem. Which brings me
to...

- Developer discussions on the internet include more people with
access to the source code.

So bugs or problems in the tools themselves often prove less obscure,
if they haven't already been fixed. I've never personally inspected
the source code of any of the programming tools I use unless I've
written them myself, but when you go on the net looking for fixes or
workarounds, a lot of people have. This could be my psychological bias
towards the ideals of open-source software, but it does seem that
mysterious quirks which, even when you fix them, make no sense; are
less common.

- Less risk of future incompatibility.

Web browsers, to take one obvious example, seem to be more compatible
with things written for older versions of themselves, than microsoft
access is. Sometimes the automatic upgrade of your mdb will work, but
often you need to make a lot of code changes to support a newer (or
older) version of access, and in the worst case it's much easier to
have two web browsers running on your machine if you need, than it is
to have two versions of Access.

Maybe there are more advantages. As for disadvantages I thought I
would miss the form designer, and in some ways I still do, but
html/js/php are very versatile, and in the process of learning how to
use these things better I've made a rudimentary gui designer and some
templating functions, which allow fairly easy manipulation and reuse
of gui components.

Another fear I had was the lack of functionality, especially since
html has a much smaller widget set than access forms (although I guess
it's always possible to use xul instead and then distribute firefox to
all the users), but that problem seems much smaller now, especially as
I learn more about javascript's abilities. There are definitely some
things html/js/php can do which access forms and vba can't (or not as
easily), some of which seem useful, but as to what practical
importance all these differences will make, that remains to be seen.

Oh and also there are a lot more easily accessible examples of
creative/clever ways of using this combination of tools since it's
what many (most?) web developers use, so you can just look at a bunch
of websites to get ideas for how to best achieve what you want.

View Replies !
Array Comparison
Lets say i have these two arrays (PHP 4.3.3)

$arr_1 = array( [left] =22,
[up] =4,
[right] =10
);

$arr_2 = array( [bottom] =13,
[up] =6,
[right] =12
);

I need to get the new array which would look like this:

$arr = array( [left] =22,
[up] =10,
[right] =22,
[bottom] =13
);

the thing is that i should put two arrays into one by this rules:
for same keys create one key with value of all values of that key
for different keys just create their key with their value

View Replies !
Difference Between == And === Comparison
I hope some of you good people would clarify this to me.

Recently I saw a bug in phpBB, which circumvented the way a user is
automatically logged in. The bug is described at:
http://seclists.org/lists/bugtraq/2005/Mar/0104.html

Well, the solution is to change this line:

if( $sessiondata['autologinid'] == $auto_login_key )

into:

if( $sessiondata['autologinid'] === $auto_login_key )

and that confuses me :(

Since in my programming I always use == operator, I was wondering am I
at risk? What is the real difference and when should I use the ===
operator.

I hope you'll understand what I'm asking... since I think it's way
better to learn on others mistakes then on my own...

View Replies !
String Comparison
If anybody knows Google Docs. They have a revision history. And when you compare two docs they say what has been added and what has been removed. I've done something similar. But it's now working very good and i want to change the hall thing.

So...can anybody tell me.. is there a library of some sort? I got something called inline_diff. But it's not very good. It does just word comparison and I don't need just word comparison, but also phrase comparison and paragraph comparison if case. That means that let's say if 50% of a phrase has changed then the hall phrase has changed. The same for the paragraph. Anybody know how to do that?

View Replies !
Time Comparison
i have the following condition inside an if but something is wrong because i get different output from what i expect i'm comparing a database table record fields with a user input datathe the database table record fields representing a busy slot are saved into variables as follows: Code:

View Replies !
Comparison Script
I dont have any script to show anyone, as i have not started the build yet. Im looking to do a mobile phone price comparison for my review site Using csv files from affiliates. As this would be sorted by handset what would be the easiet way of getting the phone model to all be the same. As different scripts call the same phone different things.

I know it would probably be to replace it in the csv file before uploading but i was trying to get something a bit quicker as they need to be updated every day and there are over 30 sheets.

View Replies !
Table Comparison
I'm selecting information from two MySQL tables using a UNION query. The data output will be in a list format. A snippet is as follows:

$query = "select cl_id, cl_status from clients_confirm UNION select cl_id, cl_status from clients ORDER BY cl_id";
$result = @mysql_query ($query);
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {

echo $row['cl_status']'<br />';}

There are some rows (purposely) that will have the same number(id) from both tables (e.g cl_id from clients_confirm & cl_id from clients). Here is a sample list output:

1 cl_status
2 cl_status
2 cl_status  (don't want this second one... or maybe the first)
3 cl_status
4 cl_status
etc.

I need to find a way to choose only one of the id's when two of the same (one from each table) are selected. In other words, I don't want duplicate rows echo'd.

View Replies !
PHP >= Comparison Problem
I had a simple if statement that checked the values of 2 variables, and if one is greater or equal then the other, it added a value to an array. The problem is that the numbers are the same, but it's still failing.

So I then converted them both to float values. Both values before were 22. When I use var_dump() they display the following: Code:

View Replies !
Database Comparison
One table called contacts and another table called user_info. Each table has a field called "email". There are 80 entries in "user_info" and 400 in "contacts". I want to take the info from user_info and check if that email address is in contacts and if it is add "Regestered" to the field "Status" in the "contacts" table otherwise I want it to add "Unregistered" Is there an easy way to do this?

View Replies !
Comparison Tool
My knowledge of PHP is limited to making slight changes to existing scripts. I now have the ambition to do a comparison tool as follows. I want to compare apples, oranges, bananas, grapes and pears. Each option would have a checkbox.

When someone checks apples, oranges and bananas, they'd be taken to static page comp_aob.html, when someone checks apples and bananas, they'd be taken to comp_ab.html. Could someone help me get started? I'd like this to be as simple as possible but I have no idea where to start.

View Replies !
Binary Comparison,
I've just a short question. As im using some binary comparison in order to check which part of my homepage is visible for the user i want to compare two values against each other. I've got the following visible levels:

Guest = 2 = 001 Binary
Registered = 4 = 010 Binary
Admin = 8 = 100 Binary.

Now when i want an Element of the homepage to be visible only for Registered users and admins i will assign the value 12 (which is 110 Binary). When it comes to the visible desission i thought i can do the following operation:

$visibleTo = 12; //Element should be visible to Admin and registered user
$currentUserVisibleLevel = 8; //user is admin
$elementIsVisible=($visibleTo & $currentUserVisibleLevel) > 0;
//expected:
//$elementIsVisible = 8 or at least greater then 0
//because 12 & 8 == 110 & 100 = 100 = 8
echo "result:".$elementIsVisible."!"; //prints result:!

What am i doing wrong?

View Replies !
Comparison Operator
what is wrong with this?

$num_Pages = 147;
$max_pages_to_show = 20;

if ($max_pages_to_show <= $num_pages) {
print "less than";
} else {
print "more than";
}

I have used is_int to make sure the values are integers, yet this code consistently prints "more than". What am I doing wrong?

View Replies !
Price Comparison
I want to add a price comparison feature to website so that users can click on one of my products and compare its price to the price of other sellers on the web. Can anyone point me to a good tutorial or article about how to do this? I have no idea where to start.

View Replies !
Comparison Question
I need to be able to compare availability of people to find common availability.

I'd like to have Person A, who is available from say 10:00 to 14:00, and be able to search my database for people with matching availability. Has anyone done anything similar to this?

I'll admit, I don't even really know where to start. I'm trying to decide if it would be better to store availability in blocks, like having Person, Start, Finish fields in a table or if it would be better to store the times they are available, like having just Person, and Time fields in a table.

View Replies !
Object Comparison
I've got the following issue:

I've menaged to parse RSS data from a given XML file into a PHP object with SimpleXML. As this is quiet a trivial task, so far so good. At a particluar spot within the code I have the following object instances.

Here's a print_r($obj);

Two first two object instances are equal because they have the same attributes and values, wheras the third one is different. What I like to be doing here before going any further is to get rid of duplicates and only take unequal instances  to proced with my methods and code.

My idea now is to compare a particular attribute (E.g. $obj->title)  and if that attribute appears to exist more than once, get rid of the/all duplicate/s.

Something like DISTINCT in SQL if that make sense

How can I get that going?

stdClass Object
(
   ........

View Replies !
Date Comparison
I have a date in a mysql database that was entered as a varchar field rather then a date formatted field. So the dates in the database look like so:

03/28/06
11/28/06
4/02/06

so either MM/DD/YY or M/DD/YY

problem is now I need to do date in ranges from lets say
03/01/06 - 07/01/06

View Replies !
Comma Separated Values
What i've done is when the user enters the client list separated by commas..... this works, but I need to know how to warn the user when they have enter the client list with no commas.

Is there some sort of function which does this or is it a regular expression thing??

View Replies !
Seperating An Array With A Comma
I'm trying to seperate the output of an array with a comma. I can't figure out how to eliminate the last comma. Here is my code:

$result = mysql_query($query,$connection) or die (mysql_error());
$fw = fopen("/var/www/html/ecast/windex/graph.html","w");
fwrite($fw, "/ ");
if ($new_rows = mysql_fetch_array($result)){
do{
fwrite($fw, $new_rows[0]);
fwrite($fw, ", ");
}while($new_rows = mysql_fetch_array($result));
}
fwrite($fw, " /");
fclose($fw);
?>
Output: / 85, 86, 87, 89, /
How can I eliminate that last comma?

View Replies !

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