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 Complete Forum Thread with Replies
Related Forum Messages:
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 !
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 !
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 !
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 !
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 !
Curly Bracket
I have two scripts that previously worked independently, and I'm trying to combine them into one header for my member pages... one script checked for session, another for a "keep me logged in" cookie... if neither the session or the "keep me logged in" cookie (which is checked aganst a DB to make sure the user is still a current member) exist... the user is sent back to the login page. Code:
View Replies !
Escaping A Square Bracket
i am trying to match a square brakcet using Ereg but i cant get it to work at all . my code (or the line of it is) if (!ereg("[","$region_array[$row[ct_region]")) { so this will look to see if the value doesnt contain an "[" then carry on. i thought the "" would escape teh next character but i just get an error saying : Parse error: parse error, expecting `']''
View Replies !
Use Of Complex (Curly Bracket) Syntax
If I use the curly bracket syntax (referred to as the complex syntax) within a string, how do I get to call a function within it? The php manual says that the first (or previous) character for the curly bracket has to be a dollar sign '$'. This is fine for variables, arrays and some objects but doesn't allow me to call a function such as addslashes() or trim() before I return the string in the variable. I have tried using assignment, concatenation and even methods of an instantiated object and have found the parser refuses to allow the equal '=' sign, fullstop '.', or even a standard left bracket '(' within the complex curly brackets. For example, I had expected the following to work: $x = ""; $string = <<<EOT This is a text string ... .... {$x . addslashes(trim($myinput1))} ... .... {$x . addslashes(trim($myinput2))} ... more text etc ..... EOT; It doesn't work, the parser objects to the full stop symbol '.' Worse still, the following was objected to $string = "This is text .. {$x->myGetMethod($specifier)} .. more text etc "; The refusal to accept a left bracket here means that it is not a real object oriented language as you can't always get to objects within complex syntax! Considering that they have called this the complex syntax, I think that it is very poorly implemented. My expectation was that any legal PHP expression should be able to be used inside the braces so long as it resulted in a string. It is far from that! Strangely, I have read (but haven't tried) that the following expression works: $string = "This is text {${$result ? 'var1' : 'var2'}} .. more text etc "; Can anybody please tell me some way to use a function within the curly bracket (complex) syntax? (without a discussion on faults of Heredoc or doing it without the complex syntax)
View Replies !
#s Meaning In Reg
$user_sig = preg_replace('#(<)([/]?.*?)(>)#is', '<2>', $user_sig i dunno much bout regular expressions? can u tell me how the sharp(#) works and what does the ƈ' mean?
View Replies !
Meaning Of ->
$this->connection = mysql_connect(DB_SERVER, DB_USER, DB_PASS) or die(mysql_error()); Can someone give me the meaning of the "->" symbol in the above? I dug for awhile in the Manual but it's hard to do a search on a symbol and couldn't find it listed with any of the operators.
View Replies !
Meaning Of Specified Parts Of This Code
if ($result) { $rs->datums = mysql_fetch_array ($result, MYSQL_ASSOC); What does -do after the recordset variable $rs? Is datums a field name or something else? I have a text by Larry Ullman and have searched the web for these 2 answers with no result.
View Replies !
Meaning Of Sendmail Switches
My php.ini file is set to point to sendmail as :- /usr/sbin/sendmail -t -i. Does anyone know what the -t and -i options do and whether they would prevent me from sending emails in the RFC format of name <email address> i.e. Philip Radford <pradford@gmail.com> All I get when using the mail() function is bad address (invalid format).
View Replies !
BB Code - Escape A Bracket In BB Code?
Is there a way to escape a "bracket" in BB code? The beginning of a bbcode post I made starts with something in brackets [like this]. This causes a strange thing to happen to the remainder of my post. Removing the brackets makes my post normal. That shows me that I need to escape the brackets. However, a simple backslash does not seem to do the trick i.e. this [wont work] I am not the administrator of the bb forum, just a poster. So I need to know what to do on my end (as opposed to an adiministrator's power to reconfigure, etc.
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 !
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 !
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 !
Removing A Comma From The End Of An Array
I am reading a file into an array using this: $listFile = "add2db.txt"; if (!($fp = fopen($listFile, "r"))) exit("Unable to open the input file, $listFile."); $buffer = fread($fp, filesize($listFile)); fclose($fp); The very last character in that $listFile will always be a comma. What I need to do is remove that last comma (and only that comma) from $buffer before I can continue on. What do I need to do to accomplish this?
View Replies !
Comma Delimited File
I am trying to read comma delimited rows of text. The problem is that some fields may be encapsulated in "" - particularly the text fields but not numeric fields. Is there a simple efficient way to parse the fields with comma but also strip off the "" encapsulating some of the fields with php? The problem is the "" encapsulation is optional. Some fields will have it, some won't.
View Replies !
How To Instert Comma Into Number?
I am having users submit large numbers into a form, and when those values are returned to them later I want to have the commas in the correct places. ie. 123456.00 changes to 123,456.00. Is there a function that does this conversion? Also, how would I ensure that the number is always displayed with 2 decimal places, ie. 123 changes to 123.00, but 123.00 remains 123.00.
View Replies !
Loops - Not Print The Very Last Comma
How can I tell the below to not print the very last comma after $line[id] if it is the last record of the loop? while($line= mysql_fetch_array($getresult, MYSQL_ASSOC)){ print "["$line[lastName] $line[firstName]","$line[id]"],"; }
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 !
Extra Comma In Update Sql
I am using a foreach loop to create the statement. Everything looks good with the sql statement when I echo it; but the last update field has a comma , that is not needed. How to I account for the last $key => $value set in the array that match my criteria and not have a comma? $sql = "UPDATE facform SET "; foreach ($_POST as $key => $value) { if($key != 'submit' && $value != ''){ $sql .= "$key = $value, "; } } $sql .= "WHERE id = $id";
View Replies !
Adding Comma To Data
I have an SQL database with a price field. The field is INT(10), as I do not need decimal to show cents. My problem is that when the data is sorted and displayed, it shows as "20000" or "200000" or "2000", etc. I need it to have commas like so - "20,000" or "200,000" or "2,000". Is there an easy way to "format" the output?
View Replies !
Delete String After Comma
How would I truncate a string after a certain character? I don't know the index of that character. I think this is close, but I need to replace the 18 with the index of the comma in the variable mystring since I won't know where the user put in a comma. $mystring = "Hello I'm a string, and I have a comma."; $mystring = substr_replace($mystring , '', 18, -1); my result of echoling $mystring would be: Hello I'm a string"
View Replies !
Remove Ending Comma
I have this code: <?php $sql = "SELECT * from cfm_lower_level_story_categories WHERE tl_section_id=1"; $result = mysql_query($sql) OR die(mysql_error()); while ($row = mysql_fetch_assoc($result)){   rtrim( ', ' );   echo '"';   echo $row['subsection_name'];   echo '"';   echo','; } ?>
View Replies !
Comma Delineated Files
I have an file whose contents are as follows: "test","com,ma","food" $file_contents = array('"test"','"com,ma"','"food"'); Doing explode(',',$file_contents) wouldn't be sufficient because the resultant array would have four entries - not three - and would instead read like this: $file_contents = array('"test"','"com','ma"','"food"');
View Replies !
Exploding Comma Separated In Array
I'm looking to explode the comma separated values in an array like this: Array ( => 10811 [1] => 7527,7556 ) and then add the exploded value as a new key in the array...like this: Array ( => 10811 [1] => 7527 [2] => 7556 )
View Replies !
Seperator Instead Of A Comma For Listed Items In DB?
I'm making a recipe database, and need to have DB fields in mySQL that will have lists of values that would get sent to an array to be worked on. I anticipate that at times a comma will need to be used in the value itself. So, what's a commonly used symbol or something that people tend to use as a separator of a list that would then be used in the split() function to send the elements into an array?
View Replies !
How To Check If It's The Last Result And Remove Comma
I am wondering if anyone could help. I have a loop that displays my results and places a comma after each. The problem is that when the last result is displayed, it shows the comma. Example: for loop{ echo $row['test'].', '; } displays... test1, test2, test3, Notice after test3, there is still a comma? How do I remove it and have it display... test1, test2, test3
View Replies !
|