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 Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
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.
Comma Delimited Csv Has Commas Inside Fields
I need to import a CSV file into a database daily. That operation in itself is simple enough but the trouble is that some fields are quoted because they have commas inside them. How do I handle this with my import script?
It would be much better if the CSV was created with all fields quoted or used a different delimited but sadly that is not an option.
Regular Expression For Comma-delimited Pairs
I have a textarea form field for inputting (or pasting) pairs of data.
I need a regular expression pattern to validate each line for the following
double quote number double quote comma double quote alpha string double quote carriage return
The following comes close, but doesn't check for a carriage return at the end of each line:
^"([0-9]?)+"([,]s?"([A-Za-z0-9]+)")*$
For example the following would return true:
"1","John" "2","Paul" "3","George" "4","Ringo"
Reading Excel To MySql Or Comma Delimited ...
right direction on how to deal with an xls flie.
but the only other file I have to work with is pdf.
I'm not sure, is xls the better of two evils?
Stripping Quotes Out Of A Comma Delimited File?
I have a flat file that I'm trying to stick into a MySQL database. One record per line, multiple fields per record, and many of them are null fields which are just double quotes without a space between. It's probably nothing really major for people who have done this before, but I'm a bit stumped. The file is comma delimited. Every field is surrounded by double quotes. I've done quite a bit of searching, on the php site and elsewhere, but I can't seem to get it to strip the quotes out so I can explode the file line by line to grab the fields.
Populating A List Box Or A Dropdown List Using Php And Odbc
I need to populate a list box and/or a dropdown list on a form. I have all the bits and pieces together, all bar the code which takes the result of a query and creates a list box.
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 ....
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.
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
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
Dropdown List
I have a Dropdown list with Select with 1, 2, 3, 4, after select on of them it bust to refresh the page to what you select but it don't do it. PHP Code:
Dropdown List
i am trying to get two dropdown lists working on a page. How do i go about this. For example, I have 1 table which holds countries and cities. When a user selects a country in the first dropdown list, i'd like the second dropdownlist populate with a list of cities etc. from my database.
Populating Dropdown List
I am wanting to know how to populate the <SELECT> dropdown menu with all existing values from the DB and also have the value associated with that id selected. This is an updating area of my admin. Any ideas? Here's the code so far. At the moment it only retrieves the value assigned to that id. PHP Code:
Smarter Way Of Doing Dropdown List?
I've got a dropdown list that is acting as a filter on a table, so the user can select a value and the page is reloaded only showing the matching values from the database.
Now when the page reloads the dropdown was set to 'all' as it was first in the list, even if I'd selected a different value, this was confusing for users, so I added an initial <option> field which pulled the correct value from $_GET (code below) - however this is a little odd as it means the value appears twice!
Does anyone have a genius solution to this? I've seen a <select selected="yes"> sort of thing around, but I don't know how I can tell the php to add this value dynamically?
<select size='1' name='occupation'> <option>".$_GET['occupation']."</option> <option value='All'>All</option> <option value='Student'>Students</a></option> <option value='Professional'>Professional</option> <option value='Hobbyist'>Hobbyists</option> </select>
Autopopulate Dropdown List From Database
An events-registration page with a form containing a dropdown list for upcoming events, the events will be pulled from a table which is updated by...?
what i've gathered so far is that this can be done with PHP. I am a little unclear on the concept of how this is done. How does the updated information get input into the table?
1) can this be done (updating database) through a web interface by the client, or is it something i would have to do locally and then upload. If done by the client, can he delete/edit existing information--assuming he is not familiar with code.
2) what other things aside from html(good), sql(so-so), and php(newb) will i have to know?
i've seen a lot of good tutorials here and will have access to the necessary software. I just want to know if there is anything else i should know before i dive in head first without testing the PHP water, which i assume is frigid.
Dropdown List Of Files In Folder
I am preparing a form that includes a drop-down list consisting of the names of files in a certain folder on the server.
I only need to trap the file name (jpg), not the path and I'm not trying to upload the files or anything - simply allow the user to select one of a number of different image files (they're actually location maps).
Dropdown List - Trying To Get Default Populated From Db.
Nooby question but when I try and get this to work (it should identify which rows in the database have GK, MID, DEF, FWD against them and then put SELECTED into the option value to give a default of what the entry is currently) it just adds SELECTED to all the results as if $row["Position"] is returning true against all four conditions? What am I doing wrong? CODE:..
Cascade Dropdown Or Conditional List
I would like to create a conditional cascade form. based on the selection, it can display or not display an input form for the user to enter an string of text. then at the bottom of the page (or when a user submit) connect all the sections including the input field all together (it's like a story maker?)
Microsoft Access Dropdown List
l am building a new site using PHP which has a lot of pages pulling from an Access Database. I would like to have a dropdown list that pulls exhibitions from the database and then when the user selects one it shows the rest of the details from DB just below the dropdown list, hope that makes sense. Code:
Change List View To Dropdown Menu
Im working on a script that has to be change so a user can choose from a dropdown menu instead of a list that now is displayed. Here is the part that is insert on the index page.
Easy Way To Make "pages" From A Database List
If I list all the rows in a database and "LIMIT 20", how do I make it so I can go to, the next 20 rows? Say if I have 50 rows, and only want to show 20 per a page?
Dynamic Dropdown And Hardcode Dropdown In Select Form
I have plenty of examples of dynamic dropdown choices but none of hardcoded dropdown choices. The ultimate goal is to have a job with various tasks and to track the status of those tasks for a given job. I've used one of the tutorials here to begin the process. Below is the code I have to add work on a given task. Perhaps I actually need to "Update" a job as opposed to "add".
But the problem of the moment is I can't seem to hardcode one set of my options. This is the code I have: PHP Code:
FLV Converter With Php
Somedy know how to convert avi, mpg or other video files in flv format, with PHP script?
Html To Pdf Converter?
I am searching for code that convert html to pdf. Do anybody had idea or anylink to exisisting source code.
Md5 Password Converter
just want to ask if there is any tool or code that can convert md5 password to the normal password?
Converter For PhpBB To VBullettin
I want to convert an existing site in phpBB to Vbullettin.Is there any converters available for the same.Please let me know more about this as this is an urgent requirement
Want Currency Converter In Php Code
i want to convert one country currency to another country currency in my shopping web site without redirecting to another site. can u suggest some idea to do this.
PhpWiki To Mediawiki Converter In Php Or Perl?
I'm looknig for advice / inspiration / modules / libraries, I'm a little more fluent in perl, but a php solution would also be fine.
I'm having two Wiki servers:
Server1: - phpwiki with user authentication - direct access to the mysql data base possible - contains about 400 entries
Server1: - MediaWiki (Wikipedia is Mediawiki based) with user authentification - direct access to the mysql data base possible - contains about 30 entries
I'd like to copy over about 350 entries from Server1 to Server2(I could apply a filter rule or semiautomatically create a list with entries to copy
As the amount of entries is low I don't really need an optimized solution.
Entries in server 2 can be overwritten.
I wanted to have your advice: 1.) Is there already something similiar, that exists? 2.) Is there a Wikiadmin focused news group (I don't like mailing lists and web based forums, as you have to create a noew account for most of them or to increase your spam rate even more) ?
If not: I know very little about the wiki internals and was thinking about a 'brute force' method, not knowing if something better exists:
The idea: 1.) get all the entries from the phpWiki via mysql ( from table "wiki" ) 2.) fix naming style (my phpwiki entries contain spaces) 3.) replace the phpWiki syntax with Mediawiki syntax (I found url with some sed rules, which are probably incomplete, but could be a goiod starting point) and fix naming styles of interlnal links. 4.) access the Mediawiki via http, authenticate and post the new entries
My idea was to 'post' new entries though it is probaly slower than directly populating the mysql data base as this allows to populate Mediawiki without having to know how the internal mysql book keeping works exactly.
Delimiting A Non-delimited File
I have a text file, with addresses of business' that I would like to convert to a more useable format ie CSV. Currently there is no delimiting of the various address components.
"A 1 AUTO SALES 1224 S BROADWAY ST WICHITA, KS 67211-3124 316-263-8748" "ABERLE FORD INC 1025 MAIN ST SABETHA, KS 66534-1893 913-284-3122" "ACTION AUTO RENTAL & SALES 1101 W 4TH AVE HUTCHINSON, KS 67501 316-662-3699"
As you can see from the examples above the only consistent items are the state and the phone number, and the city is always followed by a comma. I am new to regex and the whole range of string handling functions and I am not sure where to start.
Exploding Tab Delimited Line
I'm trying to create an array from a tab delimited line of text. I've tried explode('/t',$line); but doesn't seem to work. What am I doing wrong?
Preg_match And Delimited Strings
I have a string I'd like to have broken into parts using preg_match. I used a regular expression from the Perl FAQ (http://perlfaq.cpan.org/):
push(@new, $+) while $text =~ m{ "([^"]*(?:.[^"]*)*)",? # groups the phrase inside the quotes | ([^,]+),? | , }gx;
The idea is that it splits delimited strings respecting the quotes, for example...
foo, bar, "foo, bar", bar would end up as -foo -bar -"foo, bar" -bar
So obviously an explode wont work.
I cant figure out how to convert that piece of perl above into preg_match. I've copied the string and escaped all the appropriate charecters however it still wont divide the string show above properly...
$str = "foo, bar, "foo, bar", bar"; $re = ""([^"\]*(?:\.[^"\]*)*)",?| ([^,]+),?| ,"; if (preg_match($re, $str, $res)) { print_r($res); }
I have other strings that need parsing too (including ones with a double encapsulator inside the string - eg. 'don''t touch that!'). But I'm saving those for later.
Create A Delimited Text Array
How can I create a delimited text file to work with this script. I would like to put this first part in a text file and load it into an array so the php script can parse it. Code:
Tab Delimited Txt File To Php Html Table
Wouldn't you know that when I finally find a tutorial using Google that does exactly what I want, the code doesn't run when I use it ...
However, when it gets to this line, for ($i=0; $i<td>$line[0]</td>, it chokes on one of the '>'.
Since my php skills are very basic, and in no way include arrays, can someone assist me with this?
If it's easier to do it differently, what I'd like to do is create a table in Excel/Access, export it to the server (to a tab-delimted text file, since I'll be using commas in my table cells), and have it display in an HTML table.
If I can't figure this out, I'm tempted to just export to HTML from one or the other program (not sure quite yet which I would use), so ...
Reading Tab Delimited File Into Database
I have a .tab file that I need to write to the database. I've read it in, but for some reason it's not reading correctly. I'm truncating the complete database and then reloading it with whatever is in the tab file. I keep getting an error when trying to run my current code which is: Code:
Match Input Value With Values In A Delimited File
I'm very very new to php. I need your help. I have a text file which is ~ delimited. Each line has a name and link. I want to check if the link is similar to my input and if it is then return the name.
Importing To DB From Pipe Delimited Text File
I am trying to make a PHP script that will import data from a pipe delimited text file in to a database. The problem I am having is that the fields have long descriptions in them and there are multiple line breaks for paragraphs. They contain HTML codes as well (<B>).
The multiple line breaks are causing it to import the data strange, putting data in the wrong fields and totally missing some data as well. Here is what the text file Code:
Multiple Table Insert From Tab Delimited File
I have a page I'm coding for batch updates from a tab delimited file. Each row has data that has to be checked against and inserted/updated on different tables in my mySQL database.
How would I go about parsing through the tab delimited file and then storing data between the tabs in order to insert individually into separate tables??
Here's what I have so far...
$contents = file('/myfile.txt');
for ($i=0; $i<sizeof($contents); $i++) {
$line = trim($contents[$i]); $arr = explode(" ", $line);
$line[$i] = array('ID' => $arr[0], 'Record_Type' => $arr[1], 'First_Name' => $arr[2], 'MI' => $arr[3], 'Last_Name' => $arr[4], 'Firm' => $arr[5], 'Address' => $arr[6], 'type' => rtrim($arr[13]));
I need to take the different columns.. ID, Record_Type, etc. and update different tables with each value where the IDs match.
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?
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:
Is There A Php Command To Take A Specific Field From A Delimited Line Of Text?
I have a string which is multiple fields delimited by commas.
I would like a php command that says... take the 3rd field for example.
ie. If MYVARIABLE has the data "hello,there,big,world".
I would like to be able to say, pickup the 3rd field "big" without knowing the character positions or lengths.
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??
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?
Convert Number To One With A Comma
How can I convert "2000" to "2,000?"
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?
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.
Strip Comma From Number
i have a number 1,553.00 i need to remove the comma and store the value? any ideas?
Importing A Flat Pipe Delimited File Into A MySQL Data Table
I have done this in perl but eeew I don't want to use perl anymore. I want to be able to take a flat file that looks like this:
mbriones@...|Marian|Briones bobsmith@...|Bob|Smith janedoe@...|Jane|Doe (etc)
The table has more than 3 fields, so I'd want to process the flat file and then do an INSERT into mailinglist SET field=$value for each line.
Does someone have a nice way for me to do this? The flat file will be uploaded to the server via a form (copy) and then be processed.
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 )
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?
|