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.





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 Complete Forum Thread with Replies

Related Forum Messages:
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 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 !
Breaking List In Columns
I have an array of states. Is there a way to output the list of states into 3 coluns?
Or do i need to ru the survey 3 times for each column? (0-17 ...)

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 !
Breaking: FBI
Like on 9/11, the Federal Government apparently WANTED people to die at the hands of Cho at VA Tech, because they told campus police not to pursue Cho after the double homicide occurred.

View Replies !
Breaking Strings?
I have a string (actually 100's of these, but lets take one):

$string ="TI: Some journal title AU: SomeAuthor,-S; Smith,-A; Jones,-B SO: SomeSource. 2002 Jan 9; 287(2): 188; discussion 189-90 JN: Some Journal Title";

This needs to be turned into an array:

$entry = array(
'Some Item Title',
'SomeAuthor,-S; Smith,-A; Jones,-B',
'SomeSource. 2002 Jan 9; 287(2): 188; discussion 189-90',
'Some Journal Title');

As you can see, each array item should be defined by what comes after either/all of the following: 'TI:' 'AU:' 'SO:' 'JN:'

So, I need to be able to create a pattern that can look through the string and return everything in between TI: and AU:, then AU: and SO, etc.

for example:

eregi(???, $string, $entry);

I'm fairly new to this and can't seem to figure out the regex I need for the pattern. Is this even the way to go about it?

View Replies !
Breaking Out Of An Iframe
I cannot figure this one out. My script is being displayed in an iframe (a wiki page) and I have one option won't give me the correct results unless the page is displayed in either

a) new tab in NS browser
b) new browser instance.

The option in question is used to print forms, and I use the browser Print Preview for the page setup. It's all pretty useless if I have the page and iframe content in my preview.

I thought using header() would do the trick.

View Replies !
Breaking A Page Down.
What is the best solution to break down a php page into certain section using MySql, For example i'm looking at designing a page that reffers to a MySQL database that contains the html code for the navigation. So that in future if the navigation changes I'll only need to changed the html code in the database and all the pages will be sorted. I'm also looking at doing the same for the information on the footer of the page, with teh contact details.

View Replies !
Breaking Out Of Quotes
I know I can use stuff like in front of " so that it can't break out of a "" and start doing bad things, but it seems there are other situations where, E.G., if the string is hex for " then it has the same effect, and stuff like that, and it gets tricky escaping it all, so I'm wandering, is there some kind of option I can enable or extension I can install that just simply prevents objects/variables/arrays from breaking out of single/double quotes and also for mysql queries?

And also for html so E.G. echo"<img src='$asdf'>"; can't be exploited to do other things? I don't care if it isn't free as long as it works good and isn't to expensive..

View Replies !
Breaking Up Querys
I have a page that updates a table every workday. (these are standard updates, like if someone has moved, or has a different phone number or something.)  It is too big of a query to run the entire table all at once, so it is split out. 

The split is grouped by the first letter of a first name field.  Right now it is broken up into 5 parts, and each part has a group of letters (i.e. "a" to "d" is one group, "e" to "k" is the next, and so on.  As you can see, these do not have an even number of letters, but that is because some letters have a lot more entries, and need to be in smaller groups.) 

The reason it is split out into 5 groups is that I can run one group on each workday (Monday through Friday), and I can have the PHP check what day of the week it is.  (I use a case statement, the first case is for Monday, the second is for Tuesday, etc.) Code:

View Replies !
Breaking A Loop.
I have one going through rows of a sql database until it matches some data with user input. I need to put a break command in there but can't seem to find out how to achieve this.

View Replies !
Breaking Rows
I am using a while statement to pull results from my database. Now if I have like 40 results how would I make it break into rows.

So instead of;

result result result result result result result result result result result result result result result result result result

I want;

result result result result result
result result result result result
result result result result result
result result result result result

View Replies !
Breaking From An 'if' Loop
i've been using 'break' to escape from an 'if' loop but now realise this can only be used to exit while, for, foreach etc etc.. I was wondering if someone could tell me the 'if' equivalent of break?

View Replies !
Breaking The While Loop
Ive got a while loop that searches through a database finding certain things. Now ive gotten it to actually find the thing its looking for, however it keeps looking and lists the same item 6 times before stopping. Code:

View Replies !
Breaking Up Into Several Pages
I have a query that pulls results for a page display. I am displaying like 350+ records on the page.

How do I break this up into it displays like the last 25 records on a page, then I have the link to page 2, to page 3...etc. Just like the links to the pages for this forum. It displays only so many threads & then you have pages.

View Replies !
Breaking Out Of While Loop
Having some trouble breaking out of an While Loop. I currently use two if statements, the first decides if all of the relavent array values have been set, if they have the second if statement then checks to make sure they are not all negative or zero. If they are all negative or zero, the while loop should end, with a break. I use break 3; to break out of the two if statements and the while loop. The code ...

if($resultArray[0] AND $resultArray[1] AND $resultArray[2] AND $resultArray[3] AND $resultArray[4])
{
if($resultArray[0]<=0 AND $resultArray[1]<=0 AND $resultArray[2]<=0 AND $resultArray[3]<=0 AND $resultArray[4]<=0){break 3;}
}

This is really ugly, if anyone knows of a better way then please tell me. Anyway, it doesnt work. I have viewed a raw dump of the array and all the values are either negative or zero and yet the loop keeps going, it does not break. Which then crashes the browser haha.

View Replies !
Breaking A Variable
I have a class in which there is a variable.

ublic static $textDonate = 'blah blah blah blahblah blah blah blahblah blah blah blahblah blah blah blah'

Now what I want is only the first 70 characters to be one line and the next on the 2nd line. So what I tried is

public static $textDonate = 'blah blah blah blahblah blah'.
'blah blahblah blah blah blahblah blah blah blah'

View Replies !
Why Is -> Breaking My Code ?
When I copy the driver program (ctest.php) which contains "require Calendar.php" the code stops executing (starts printing itself on the screen) at the first line which uses ->
like in:

cal = new MyCalendar;
.
.
.
cal->setStartDay(1);

start showing on the screen from setDay ... on. But I get no error on the "require" statement.

View Replies !
Reading XML With PHP Without Breaking
I am reading in a file. Here is one of the tags from the XML. <PropertyURL>http://developer.newcondosonline.com/direct1.php?property=1568&amp;amp;pname=The Potrero&amp;amp;compid=626</PropertyURL>

When I grab the URL all I get is "compid=626" because the &amp; breaks the data. Anyone know how to bring this in without breaking this? Or, possibly replace the characters when I down load the file?

$sf = "http://developer.newcondosonline.com/rss-properties-san-francisco.xml";
$sfxml = "sf.xml";
$source = $sf;
$dest = $sfxml;
if (!copy($source, $dest)) {print ("failed to copy $dest. It is possible the XML feed has been changed, please check with provider.<br>
");}

View Replies !
Breaking Down A String In PHP 4
I need to split a string so that each character is in its own holder within an array. I know str_split will do it, but I need something compatible with PHP v4.

View Replies !
Breaking Up Strings
I have a string of varying length, lets call it $mystring.
I wish to break it up and put it in the following form

echo"<span
class='myclass'>".1st_30chars_$mystring_to_nearest_word."<br>".2nd_30chars_$
mystring_to_nearest_word."<br>".....etc....last_lot_of_chars_of_$mystring."<
/span>";

does anyone know how to do this.

View Replies !
Breaking Apart HTTP_REFERER
I need three parts of information from the HTTP_REFERER.

1) Any sudomains, not including the http:// or a trailing period. This could be mail or even users.johnsmith

2) The domain, not including any folders, files, or trailing / For instance google.com

3) The page, not including any folders, get data, or anchors. For instance contactus.php

View Replies !
Breaking Up A Variable
I have a problem: PHP Code:

if($details[$i]['add_block'] != "") {
                    $splitbullets = explode("
", $details[$i]['add_block']);
                        $r=0; foreach($splitbullets AS $b) {                        
                        $data['addr_1'] = $db->mySQLSafe($b);
                        $data['addr_2'] = $db->mySQLSafe($b);
                        $data['town'] = $db->mySQLSafe($b);
                        $data['state'] = $db->mySQLSafe($b);                        
                        $r++; if($r == 4) break; }                }

View Replies !
XML Parser Breaking Up URLs
I'm having a problem parsing an xml file in which one of an elements character data is a url which contains multiple "&" characters. For some reason the parser breaks up the data into multiple pieces. For instance, when I call this function(abbreviated):

function characterDataHandler ($parser, $data)
{
global $element;
global $url;
if ($element == "URL") {
$url = $data;
echo "url=".$url."<br>";
}
}

I get some output like this:


url=http://www.somewebsite.com/index.jsp?s=af

url=&

url=filter=1

url=&

url=show=all


Do urls with querystrings have to be handled differently then regular character data?

View Replies !
For Loops Breaking At A Certain Multiple
Can someone help me out with writing a script that will make will loop 500 times, but at every 4th multiple, it will insert a peice of code?

I tried all day to get this, and so far, nothing has worked.

View Replies !
Characters Breaking My Query
Im using encrypted data to store cc info. The PHP code encrypts and sends the result to the database. the problem is that the encrypted string contains lots of characters that will break my sql query. I can do a replace but there are lots of characters.

for example, a character will look like this:

g%$^'GDF$%^//"@#$%/||''$#"/|#dfsa.

how can I put this information in a different format... and then retrieve the data to decrypt the string?

View Replies !
Not Breaking Loop In Function
I get this error: <b>Fatal error</b>: Cannot break/continue 1 levels in <b>file.php</b> on line <b>128</b><br>

This happens when I call a function. In the function there is a break; This is cause the break is in a function and not in the loop. But it gets called inside the loop. Is there a fix for this?

View Replies !
E-Mail Not Breaking Lines
I'm sending an e-mail via a contact form, but somehow the lines aren't breaking in the text, it always looks like this:

lorem ipsum

dolor

sit

amet

lorem


Which is of course not readable at all. What am I doing wrong here? I'm using a few security checks and such for cleaning the field up; $text = trim($text);
...
$text = stripslashes(strip_tags($text));
...
$text = mysql_real_escape_string($text);
.....

#and then the part where it's included in the message:
$message .= "Nachricht: {$text} ";

Can any of those be causing the display problem?

View Replies !
Script Breaking On Mysql_result
I was trying to figure out why one of my scripts was failing and by using an "or die" statement for the SQL narrowed it down to this bit of code:

$md5 = md5_file("swf/" . basename($jpg_link));
$dupe = mysql_result(mysql_query("select count(gId) from games where gSwfFile='$md5.swf"), 0);
if(!empty($dupe))
{
continue;
}

This is giving the following error - "Warning: mysql_result(): supplied argument is not a valid MySQL result resource"

The thing is, I've checked that SQL query by running other values in place of $md5 through it and it appears to be fine. 

select count(gId) from games where gSwfFile='Flat War july 30th 2007.swf';
Any ideas?

View Replies !
PHP5 Breaking Software
I have been testing some software that I was willing to buy until I read about PHP5. I still want the software, but I want it to last longer than the time it will take for my webhost to install PHP5 on the servers and break my site. My host says that the upgrade to PHP5 will be done as soon as possible.

The software company says the Basic Package requires PHP4+. The source code edition will run on PHP5. Does this maybe have something to do with the Zend Optimizer? Why would I need the developers edition (Source Code Edtion) of this software? I have no problem configuring software but I"m not a developer or a coder. I'm looking for answers to the above questions, PLUS any option that might cross your mind.

View Replies !
Breaking The Numeric Input
I am working on the medical form. There are some values that needs to be stored in decimal (like blood chlosterol). Now I am facing a problem of storing the value, and I want user to follow the rule. In the paper form the section is like this.

fS-Col: _ _, _ (to explain to you, it is "number number, number") like 56,3

There are two choices I have:
In SQL table, I should make two tinyint fields. Then I should display the input boxes on the webpage like [ ],[]. Not a good idea because we will be downloading that data. Seciond choice: is to make one tinyint field in the SQL. Then on the table I should "parse" the user input. For example, if he enters 53.4 then I should process decimal point as comma (European decimal system). How can I do that? And how can display ##,# and when user selects that textbox, the ##,# should disappear?

View Replies !
Breaking Out Of A Foreach Loop; Possible?
I want to optimize this code block so that it breaks out of the inner loop when stristr() is true. Here is what I currently have:

foreach ($aData as $key => $row) {
$iFound = false;
foreach($row as $cell) {
foreach ($aSearch as $sTerm) {
if (stristr($cell, $sTerm)) { $iFound = true; }
}
}
if ($iFound == false) { unset($aData[$key]); }
}

Is this possible within a foreach loop?

View Replies !
Form Breaking Out Of Frames
I am having problems with an HTML form in a php script that is inside a frame. When the form is posted I want it to open within the frame but it always opens a new window. Code:

View Replies !
Non-breaking Space Tags
How do you Insert and Select the

Code:
&nbsp;

tag into/out of mysql with php?

I'm creating a form and table to display user input, and if the user doesn't input data, the table has a blank cell, which in turn makes the coloring of the css/table skewed. What I'd like to do is either insert a Non-breaking Space if the user doesn't enter data, or preferably have a Non-breaking Space as the table field default.

I have used phpmyadmin to manual insert the tag, but it is not registering when I use my select statement to pull it from the database. I'm new to mysql, but I've poured through all my books and have spent hours pouring through forums, and I'm stuck. What am I doing wrong?

View Replies !
Writing Non-breaking Spaces
My script needs to write (a small number of) non-breaking spaces. I'm specifying charset=iso-8859-1 (in the HTTP header and HTML meta.)

Is chr(160) as good an option as '&nbsp;'? (Note that chr(160) occupies one byte, while the named entity, '&nbsp;', occupies six bytes.) Is chr(160) as widely supported by browsers as '&nbsp;'? Is it always rendered as a space?

View Replies !
Breaking Up Field Value (doable?)
"$cart" is being submitted to a form, but it contains information that I need to break apart and have separate field names for (i.e. $cart[0], $cart[1], $cart[3]).

The format it is being submitted as (keep in mind the form is coming to my php file but not from anything I control, I really do need a workaround) a format that I believe this should be doable. A sample $cart is submitted looking like this:

This Product : 2 : 52.00

See the good thing is each item I need individually is separated by " : ", so is there a way to pull this apart to =

$cart[0] = "This Product"
$cart[1] = "2"
$cart[2] = "52.00"

View Replies !

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