How Do You Convert A TCL List Into A String That PHP Can Read?
I have a TCL proc that needs to convert what might be a list into a
string to read
consider this:
[set string [PROPER_CASE {hello world}]]; # OUTPUTS Hello World which
is fine for PHP
[set string [PROPER_CASE {-hello world}]]; # OUTPUT {{-Hello}}
World, which PHP will print literally as {{-Hello}} World, instead of
-Hello World
Is there an easy way for TCL to brute-force a list into a
strictly-string-only format to prevent this potentially ugly display
from being displayed by PHP/etc.?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Can You Read A Value Into A List Menu?
a system i am developing has both a user and an admin side. The user can add a record and then the status of this is initially set to a fixed value. What I am wondering is, if i stick with a list of say 4 possible status', how can i get whatever status the admin changes the record to to be "sticky" on the menu the next time he looks at the call, as opposed to the menu showing the default value set in dreamweaver?
Ereg, Read The Dir And Print List Of Files.
I have a dir of html files that link to websites, i would like to read the dir and print a list of those files as a link. Which the script i have does. I would like to take this one step further and replace the ".html" extension with ".com" so it winds up being:
Convert String To An Int
how can i convert a string into an integer? say i have a form that submited 10. i want that converted to integer.
Convert String To Date
I'am trying to manipulate csv file using PHP, but my problem is that, one field there is date DD/DD/YYYY. My question is, how can I convert that text to date? So that I can insert it to the mysql database correctly.
Convert A Variable Name To A String
How do I convert a variable name posted from a form element into a string?I.E: -------------------------------------------------------------------------- From: $1011 = "10"; // Product ID and the value of the Quantity to: $product_id = "1011"; $quantity = "10"; -------------------------------------------------------------------------- Unfortunately my client has already had the site built entirely in Flash, so there is not much I can do about getting the form changed.
Convert URL String To Numbers
I dónt know what keyword to search for this on the forum, but I am asking anywạy Say I have a url like http://www.mydomain.com/index.php?id=15 Now how do I make this URL to be appreared to my viewer like http://www.mydomain.com/index.php?id=726183182768 Which is the same with id=15 The reason I want to do this is for security purpose, I don't want to expose the real record id to my viewer.
Convert GMT String To EST Output
I have a string and time conversion question: How can I go about converting a string in the GMT format: Fri, 04 May 2007 19:57:14 GMT to an EST format such as Fri, 04 May 2007 2:57pm EST So is there a way I can always extract the portion 19:57:14 GMT ---> x:xxam EST
Convert STRING Charset
I have a MySQL database, which stores data in UTF-8 Unicode format. I have a webpage which has a form where I enter data to store the information and the CHARSET for that page is ISO-8859-1 (latin1). When I fetch data from my database on a page that has the CHARSET ISO-8859-1 the output is great! But when I now from another page has UTF-8 Unicode CHARSET set and fetch data from the database, some of the characters are messed up (like the Swedish Å Ä Ö characters). My question follows: Can I with PHP, fetch text from my database into a STRING and then "convert" from ISO-8859-1 to UTF-8 Unicode before outputting it to the page which has CHARSET UTF-8 Unicode? OR Do I have to "loop" through and replace "bad/wrong" characters into UTF-8 Unicode, and if so, HOW?
Convert String To Integer
array_multisort($mobile, SORT_ASC, $text_array); How to convert the string value to integer value . The sort is the order as string value.. 4563423 45435462434 623765457657 4568678643557 But I want the numbers from ascending order of integer value.
Convert From Array To String
i am having a small problem with my code i want to convert from array to String. i tried using the (string) casting but it doesnot work?
Trying To Convert String To Decimal Equivalent
I am trying to convert a string of any given length (can include special characters such as :,/,-,.,etc...) into its decimal equivalent. I've tried all of the php functions I can find, but they all seem to deal with hex or binary. For example: h == 104 (it is ok if the function adds the html enties on h) (here is a table of the decimal equivalents http://www.neurophys.wisc.edu/www/comp/docs/ascii.html) I've tried: HexDec() bin2hex() BinDex() etc.... Can anyone tell me how to convert this value?
Convert To Integer From String Format!!!
i have here a function that gets the # of linkdomain in yahoo using CURL then use a preg_match pattern to get the actual value ok the problem is the return value is a string format that i cant convert to in, i have tried using the (int) and intval($string) thing but they only make the value become zero whats the problem? Code:
Convert Two-Dimensional Array To String
I'm trying to convert a two-dimensional array to a string that I can put in a database. It needs to be searchable so the serialize() function will not work. I found a script at php.net that will implode a multi-dimensional array and it works fine. The script is: Code:
String Functionality - Convert (.com, Net, And .org.) Into Href Link
I want to have a function in string when a portion of it sees .com, net, and .org. Convert that word contain (.com, net, and .org.) into href link.For example this:FeedPHP.com is going to be the largest repository of feeds from PHP.net and related news sources. This one stop news source parses feeds from thousands other php website and displays the titles. As we know, MySQL.com, PostgreSQL.org, AJAX are also relevant to PHP.net, so FeedPHP.com collects feeds from those sources as well.will convert to:FeedPHP.com is going to be the largest repository of feeds from PHP.net and related news sources. This one stop news source parses feeds fromthousands other php website and displays the titles. As we know, MySQL.com , PostgreSQL.org , AJAX are also relevant to PHP.net , so FeedPHP.com collects feeds from those sources as well.
Convert String To Integer - Not Starting With A Number
I can't get PHP to convert a string to an integer (or pull the numbers OUT of a string) if it doesn't start with a number, which is an issue. Basically, i'm trying to pull the integers only out of various model numbers for pieces of equipment our store is selling - examples would be something like S820D or MS1798. I only need the 820 or the 1798 from these strings, but PHP doesn't want to play nice with either: $product_model = "S820D"; $var = intval($product_model); or $var = (int) $product_model;
How To Convert Array To String, And Vice Versa
I have some items, numbered from 0 upwards. Some of them may have a string attached. All these items need to be represented in a single already existing database record. So, I thought of taking an array, as it might be looking thus (the values are all strings):
Read A File Of String Into What?
Pardon the simple question, but I have just begun to learn PHP. So far so good - all the examples in my books actually work. One thing that none of them address is how to read a file of strings (like names or URLs or whatever) into something so that they can be deleted, modified or a new one added. In a language like Perl/TK or Delphi a listbox is used if you want to edit line by line or a memo box if you want to edit like you are in Kwrite. All the examples assume that I want to enter data into a Text area or Listbox by keyboard, then read it back in. Never the other way around. I can use a Fget routine and read the file to the screen, but not to anything in which I can edit yet. So far I have learned a ton of stuff trying, but haven't made it work yet. Should I be reading the data into a Textarea, a Listbox or something else?
Read All {{var}} Within A String To Be Shown To User
I'm stumped with this little task of obtaining {{var}} object/variables from within a message (or string), where a string may contain 5-10 different instances of a {{var2}} or {{var3}} etc. I am looking to take all instances it can find, to be displayed dynamically for what a user can use for variable/objects within an online email application. If the string contained: $string = "Welcome {{user}}, thanks for joining {{site_name}}." I would want the php code to read $string and for all the {{vars}} and then to be displayed dynamically like: {{user}} - {{site_name}} - etc So they know exactly what {{var}}'s are available to them while modifying content on that specific template.
While Loop To Read Txt File Into A String?
I need to create a string from a .txt file so it can be displayed in the <textarea> of an html form. This is what I had: $body = fopen("example.txt","r+"); $text = ""; while (!feof($body)) { $text += fgetc($body); } echo $text; All it prints out is 0. Also, if there's a better way to get the text from the txt file please let me know.
String List To Array
I'm trying to convert a slash-delimited string to an array, but I'm wary of null elements that I want to eliminate. I'm frustrated with explode(), array_unique(), and array_pop(), and I'm wondering if there's a better way. I'm only interested in unique array elements. Here's what I've got $a = "10/20/30" should become an array where $b[0] = 10, $b[1] = 20, and $b[2] = 30. Now here's the fun part. Often my arrays will have $a = "10//" I'd like that to become $b[0] = 10 and that's all. So I tried applying array_unique() to explode("/", $a) but you have to be careful about how many elements are returned. Then I tried to use array_pop() to drop the last element if it's empty, but array_pop returns a scalar string when there's only one element left. So when you use $b = array_pop($q), sometimes there is no $b[0].
String Variable Read From Mysql DB + Echo = Newline Problem
Hi. I have this simple code: =========================================== ->Database query here (.. some code) $row=mysql_fetch_array($res); (...) $formatting2 = $row['formatting2"]; (..) //Echo variable from DB echo "$formatting2"; $formatting2 = "USERNAME: %1$s SERIAL: %2$s"; //Echo same string - this time from an "inline" variable echo "$formatting2"; =========================================== Ok, maybe that was overly complicated. I hope you follow anyway. Whats happening here is that I am getting a formatted string from a database which I throw in a variable. What you see here is my test case to visualize the problem. Now, when I echo this variable or pass it to printf/sprintf then I get a different result than if I "manually" create the variable inline in my php script. So, the first echo $formatting2 there will output: USERNAME: %1$s SERIAL: %2$s whilst the second shows the newlines correctly. Also printf/sprintf barfs if I pass the string I got from the DB. What the heck is going on here? Database returning some strange string format?
Make Text String Read From Right To Left In Imagettftext() Function
I want to write a text string from right to left instead of from left to right with the imagettftext (); function I read in teh manual that the angle variable controls this, it says that 0 angle means left to right, so I tried 180, 360 but nothing happens What angle do I need to put it to get it to write it right to left I am writing a hebrew text string with a font.ttf that supports hebrew characters <?php $white = imagecolorallocate($background, 255, 255, 255); $fontfile = "davidtr.ttf"; $string = "מחלדגכ"; imagettftext($background, 12, 360, 3, 17, $white, $fontfile, $string); ?>
Convert 16-byte Hex "string" To Dec In Php
I have a string, 16 bytes long, representing a hex number. I need to convert it to a number and put it into pgsql database; it complicates the matters further cause pgsql doesn't support unsigned; thus I have to subtract "magic" number (half the bigint range) from the conversion result to put it into pgsql. Is there any way to achieve this?
Fgetcsv Returns False In Dynamic Read Vs. Hard-coded Read ??
I am working with directories in PHP for the first time. I have code that I've changed multiple times to try different things. I would think this is pretty standard fare so I'm not sure why I can't seem to get it right. What I would like to see happen: The code opens the directory and loops through the files, opening them and processing them. What is happening: If I hard code the name of one particular file (it is always the same file) in my test setting, fgetcsv does not return false and the code runs fine. The file is parsed and all is well. However, if I let the code open a directory and then loop through the files, this one particular txt file does not work. For debug purposes, I have it displaying each file name and it can display the name, it just won't process it. I've even tried setting a for loop and hard coding each file name (since right now I know the names - I won't in the future) and the file is processed. It is only when it is set to my $file var dynamically rather than being hard coded. Here is the code: $handle_dir = opendir('../directory_name'); /* loop over the directory. */ $countfile=0; while (false !== ($file = readdir($handle_dir))) { $countfile++; $filevalues = ""; //Skip the first two files that where found because they are "." and ".." if ($countfile 2) { //echo $file; //begin loop through each file name $handle = fopen($file, "r"); echo "Filename is: $file<BR>";//at this point the code can print the file name if (false == ($filevalues = fgetcsv($handle,6021,','))){ echo 'problems<br>'//for one particular file, this always displays }
List Contents Of A Folder, Make List Of Links
Does anyone know how I can write a script that: - reads in all the files in a particular directory - displays the file names in a html list and makes a link of them: <ul> <li><a href="filelocation1">filename 1</li> <li><a href="filelocation2">filename 1</li> <li><a href="filelocation3">filename 1</li> </ul> etc.? So basically it creates a list of links with the contents in that directory, so you can download them from there.
Get List Of Messages From One Table, Message List Indicator From
I have two tables. One has a list of messages left by users using fields named mbxno for the mailbox and msgno for the message number. I have another table that has mailbox settings for each user that contains a field named "messagelist" to indicate if they want to be included on the message list or not. What I'm trying to create is a list of the most-recent messages with a lookup on the users table to indicate whether a message in the list should be included in the message list based on the user's mailbox settings. SELECT messages.msgno, messages.mbxno, users.messagelist FROM messages, users WHERE (users.messagelist = Ƈ') ORDER BY msgno DESC LIMIT 100 What I'm getting, though is a list that looks like this: mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 1114 msgno: 0412141623 msglist: 1 I think what's happening is that I'm using the wrong type of join and more rows are being created than necessary. If I add "DISTINCT" to the query, I get a list of the most-recent messages as I expect, but the "messsagelist" value is sometimes wrong (again, probably because the data is getting jumbled). For example, the messagelist value for the second row (2214) should be 0, not 1. mbxno: 1114 msgno: 0412141623 msglist: 1 mbxno: 2214 msgno: 0412141622 msglist: 1 mbxno: 2189 msgno: 0412141408 msglist: 1 mbxno: 0000 msgno: 0412141213 msglist: 1 mbxno: 0003 msgno: 0412141213 msglist: 1 mbxno: 2265 msgno: 0412132029 msglist: 1 mbxno: 0000 msgno: 0412131950 msglist: 1 How should I be doing this? If nothing else, what kind of join will work with a long list compared to a value from a short list?
Mailing List Manager, Send To List
I'm looking for a mailing list script (php) that has a function to let users to reach out to all recipient on the list by simple send the email to a specific maillist- address. Mailman has this functionn but as a just got a webserver account I can't use mailman nor install it.
Attaching A String To A Normal Word Without Loosing The String
In my database I have content rows that are either called <contentname>_title or <contentname>_fulltext. now when someone clicks a link on the site it goes to index.php?action=<contentname> so I guess you see where im going.. when someone goes to such a section index.php sees $action is used and attaches it to _title and _fulltext, so u get: $action_fulltext.. basicly of cuz php now sees it as one string '$action_fulltext' and not '$action'_fulltext.
Help - Regexp For Extracting A String From A Larger String
I am developing a very basic CMS for a website I'm working on. One of the requirements is for the client to be able to post an image in their news posts, as well as links. I've got the links working (sort of, because I fear the way I have set it up may break images). Ideally I would like something like BBcode but can't wrap my head around regular expressions.
Parse Part Of String (mid String Function ?)
Can someone tell me how to parse part of a string? I can use the following: <?php $text = $_SERVER['PHP_SELF']; //$PHP_SELF //(document.url); echo $text; ?> to get this result: "Your currently at /test.php " I just want to get "test.php " without the dash. I also need to parse out parts of other strings. I know how to use Mid(), Left(), and Right() in VB, but no clue for PHP.
Search A String And Return String Between Char?
I have a string like this; Full Name (Department) How can I split that string into seperate strings for Full Name and Department, so that everything before the () is the full name and everything between the () is the department?
Partially Replace A String With Data From The Same String...
I'm trying to write a script to help import some old HTML files as blog post for my website, these HTML files are 300-2000 lines long. I am currently using fgets() to read the files one line at a time, clean them and write them to the database in the appropriate format once the entire article is completed. My issue is many of the links included on these post no longer exist (some date into the '90s) and I want as part of my importing function to "fix" these links as so. Code:
How To Convert Asp To Php
I have a database system coded in asp using dreamweaver mx. Can I convert the code to php by using dreamweaver mx ? If can, please tell me how. Currently I'm using PWS on Windows ME with MySQL as a database.
How To Convert BMP To Jpg?
I need help for convert bmp image to jpg file. So anyone can help me to convert bmp image to jpg image by php's GD library or any ways by php. Please help me as soon as possible. Or you can help me how to resized bmp file in different dimession other then its actual. I need image resize functionality for resize it on the while someone upload image. So Please help me as soon as possible. Coz I am stuck over here in my last stage project.
|