Replace numbers

In a select I search for names and products.
The products-field in the database is a varchar type, in
which numbers
from 1-7 (comma separated) are stored (not the best design,
yes).
My repeat region is:
<?php do { ?>
<?php echo htmlentities($row_rsClient['name']);
?><br />
<?php echo $row_rsClient['products']; ?>
<?php } while ($row_rsClient =
mysql_fetch_assoc($rsClient)); ?>
That displays these results:
A 1,3,4
B 2 and so on.
I would now like to replace the "1" by "A", the "2" bei "B"
and so on.
An example I tried is:
$output=str_replace("1", "A", $row_rsClient['products']);
How could that be integrated into a repeat region behavior?
And how
could I replace all the numbers (1-7) by the products in one
go?
Thank you.
Leolux

On 08 Feb 2009 in macromedia.dreamweaver.appdev, Leolux
wrote:
> In a select I search for names and products.
> The products-field in the database is a varchar type, in
which numbers
> from 1-7 (comma separated) are stored (not the best
design, yes).
>
> My repeat region is:
>
> <?php do { ?>
> <?php echo htmlentities($row_rsClient['name']);
?><br />
> <?php echo $row_rsClient['products']; ?>
> <?php } while ($row_rsClient =
mysql_fetch_assoc($rsClient)); ?>
>
> That displays these results:
> A 1,3,4
> B 2 and so on.
>
> I would now like to replace the "1" by "A", the "2" bei
"B" and so on.
> An example I tried is:
>
> $output=str_replace("1", "A",
$row_rsClient['products']);
>
> How could that be integrated into a repeat region
behavior? And how
> could I replace all the numbers (1-7) by the products in
one go?
preg_replace() can take arrays as arguments, so you can do
everything
in one pass:
http://www.php.net/preg_replace
In your case, you'd do something like:
<?php
$patterns = array("1", "2", "3");
$replacements = array("A", "B", "C");
?>
<?php do { ?>
<?php echo htmlentities($row_rsClient['name']);
?><br />
<?php
output = preg_replace($patterns, $replacements,
$row_rsClient['products']);
echo $output;
?>
<?php } while ($row_rsClient =
mysql_fetch_assoc($rsClient)); ?>
Joe Makowiec
http://makowiec.net/
Email:
http://makowiec.net/contact.php

Similar Messages

  • How to replace numbers with text in tax return pdf using Adobe Acrobat X Pro

    How do I replace numbers with text in tax return pdf using Adobe Acrobat X Pro? The tax return was created using CCH software. Thanks for your review.

    Thanks Bill for your quick reply. CCH software is one of the major
    suppliers of tax return software. I found an internal source that helped me
    make the changes from numbers to text i.e. "$123,456" to "See Schedule O".
    I am not sure if I am working in form or final text. Thanks again! Kelly

  • Find/Replacing numbers in document problem

    I have a large document that I need to replace the numbers from 1-10 with letters.
    The problem with doing an automatic replace is that it will affect numerals like 1.5 and numbers 11 and over. Is there any way to get around this or am i doomed to go through the entire document?

    First: if I am not mistaken you will need to do a replace for every single number, i.e. you need ten passes. Get yourself acquainted with the "FindChangeByList" script in your script-panel.
    To rephrase: you want to replace any digit that is neither preceded nor followed by either another digit or a dot. Correct?
    Then you can grep for this: (?<![\d.])1(?![\d.]) and change to a

  • GREP search and replace: numbers and commas

    I have a list of numbers 1000, 15000, 250500, etc. and I would like to find only numbers that have 5 or more digitals, and insert a comma, like the following:
    1000 no change
    15000 replace with 15,000
    250500 replace with 250,500
    TIA

    One note, the replace patterns in ID need to use $, so that would be $1,$2 - otherwise I think that will work fine.
    You can also use curly brackets to indicate the number of possible occurrences of a pattern you're looking for.
    (\s\d{1,3})(\d{3}\s)
    Means find a space, 1 to 3 digits followed by 3 more digits and another space.
    One little note, if you were to put a bunch of number separated by single spaces in a string, this would skip alternate ones, because the trailing space of one number would be considered part of the find pattern for that match, and so would not be available as the leading space of the next number. (That may be very badly phrased, sorry.) In that case I think you'd have to break those spaces out to lookaheads/lookbehinds, where you include them in the find logic without making them part of the matched string. (Which may have made this response even less intelligible, but are at least terms to look at in the documentation.)

  • Renaming files. replacing numbers

    I would like to simply remove numbers prefixing file names in a folder. I h ave nor problem doing this if, say, I want to replace all "4"s.
    But what I really want to do is be able to use something like a grep expression, example \d+ in the FIND field of Automator. But that doesn't seem to work.
    I sure want to avoid having to do multiple iterations of the workflow by manually replacing "4" then "5"..."98" etc.
    Is this possible without having to write an apple scrpt to plug into the workflow? Or , if that is necessary, does anyone have a simple one to share?
    Thanks.
    jmh

    NameChanger may do what you're looking for.
    -mj
    [email protected]

  • Replacing numbers with letters in a calculation

    Hi,
    I am trying to set up a Numbers chart with one cell that is formatted as a letter grade for students (i.e., A, B, C, D, F), which is generated by substituting/replacing the numerical mark of another cell that is expressed. How can I do this?
    Thanks!

    Rancher,
    We assume that by Chart you mean a Numbers Table. In Numbers, a Chart is a graphical representation of data. And, in Numbers a Table is a grid of Cells generally containing text or numeric values.
    To assist with a formula to convert numeric grades to letter grades, we would need to know which numerical grades are associated with which letter grades in your school system.
    Jerry

  • Replace numbers and invert time normalizations

    Good morning everyone,
    I am using LabVIEW for CAD/CAM purposes, and the aim of my program is to control a trajectory along several consecutive straight lines defined by its corner points (x and y coordinates).
    My program uses only mathematical equations (parametric equations) and I am using a simulate signal (time normalization) between 0 and 1. To perform the straight lines my idea is to replace the position of the points and, at the same time, invert the time (from 0 to 1 to 1 to 0) - please see the attached image - and so on.
    Because I am a new Labview user, I would like to know it this point replacement is in fact possible, and also how to invert the time normalization.
    Hope to have been the clearest as possible.
    Thanks you very much in advance.
    Attachments:
    2015-04-27 11.09.37.jpg ‏1832 KB

    Cheers,
    The inversion of the variable t (time) is made with the purpose of having a continuous time signal and also to allow us to replace only one of the two points when a segment is finished.
    Thus, I need to know how to invert these variable, and also how to replace the points, "automatically", in the block diagram window. I suppose that some loops will have to be used.
    Although this is a mathematical problem, my inexperience using Labview makes me wonder how to perform such an apprach.
    Perhaps, the attached note can help you understand to understand what I exactly would like to do in Labview.
    Thank you very much,
    Francisco
    Attachments:
    Note.pdf ‏234 KB

  • Replacing numbers in a string

    Is it possible to look through a string find any 0's and replace them with a random Integer generated before?

    Take a look at the methods in the String API and see
    if you can find one that will replace all
    occurrences of something within a string with
    something else.
    ~@OP:
    I was assuming you wanted to replace every zero with a different (pseudo) random number, in which case you can use replaceFirst(...) as I suggested.
    If you want to replace every zero with the same (pseudo) random number, use yawmark's approach.

  • Why do my numbers files not email properly?

    Disclaimer: I'm fairly computer savvy and have a good amount of experience in using Numbers (mostly Numbers'09).
    I've recently encountered a new problem when emailing numbers (.numbers) files.
    They are not coming through correctly.
    This may be a "new" issue with the recent upgrade from Numbers'09 but I'm not sure since I have not had the need to send a numbers doc from one person/computer to another since the update to the new version of Numbers.
    Here's what happens:
    The file sends with no problem. I'm able to receive the file with no problem.
    I CANNOT OPEN the numbers document.
    When i receive the document it is not coming in the full size. For example: A document that is actually 324K in size is only being received as 8K.
         - I am unable to preview the document.
         - It appears to have no data
    In an attempt to self-solve the problem - I saved the file that I'm attempting to send as a "Numbers 09" version. I was able to send and open this successfully.
    The computer that I'm on/sending to/opening in, is running the current version and the SAME version of numbers as the other computer (version 3.2).
    I'm quite confused and have not been able to find a solution on my own.
    If anyone has run into this, has an idea or has a solution it would be HUGELY appreciated!
    Thanks in advance for ANY and ALL feedback and support.

    Hi John,
    I don't really want to switch my method of filing simply for sharing purposes.
    Perhaps a solution for now could be to revert a document to Numbers '09 before emailing?
    When Numbers 3.0 was released in November 2013, many people were stunned that a so-called upgrade had lost so many features. But slowly (through this forum working together) it became clear that Apple had provided several safety-nets.
    - Numbers 3 did not replace Numbers '09 on any computer. Numbers '09 was moved to a folder named iWork '09 inside the Applications folder. It still works on OS X Mavericks just as it always did on previous versions of OS X.
    Numbers 3 did not replace the icon on the Dock. That icon continues to point to Numbers '09.
    Wayne Contello has written a User Tip for working with the old and new versions of iWork:
    https://discussions.apple.com/docs/DOC-6991
    - Documents and templates created in Numbers '09 will carry many of the "lost" features into Numbers 3.
    - A document "stolen" by Numbers 3 can not be opened in Numbers '09. Numbers 3 has Menu > File > Export To > Numbers '09... to revert that document. However, reverting a document created in Numbers 3 will not magically install lost Numbers '09 features. They are gone (for now).
    - Numbers '09 and Numbers 3 run happily together at the same time. Just be sure which version you use when opening a document. Use Menu > File > Open or Menu > File > Open Recent.
    With each update (Numbers 3.0 to 3.01, 3.1 and now 3.2) many features have been restored. They may now live under a different menu, button, or Inspector (Format Panel).
    This forum has helped me and other users to find out where our cheese is now:
    Who Moved My Cheese?
    http://www.spencerjohnson.com/Book-WhoMovedMyCheese.html
    Regards,
    Ian.

  • How to change margins in Numbers 3.0

    How do I change the page margins in Numbers 3.0 MacBook Pro App?

    Hi Themonkeycode,
    unless they moved it from where it use to be...
    It has gone in Numbers 3.0 and Numbers 3.1. Maybe it will return in future versions. Please give feedback to Apple:
    Menu > Numbers > Provide Numbers Feedback.
    Downloading Numbers 3 did not replace Numbers '09. Unless you deleted it, it is in a folder called iWork '09 inside your Applications folder. It works just as well as it used to.
    Regards,
    Ian.

  • I can´t open a numbers document.

    Hello,
    I have a problem. I created a numbers document one month ago. Yesterday I wanted to open it again and the mac says, I need a new version. So I updated the version. But still I can´t open it because anytime I want to open the document it says, that I need a new version.
    Can somebody please help me with this problem?
    Thank you

    Hi Kerstin,
    If you are running Numbers for Mac with OS X Mavericks, the update to Numbers 3 did not replace Numbers 2.3 (Numbers '09)
    Numbers 2.3 has been moved to a folder called iWork '09 inside your Applications folder. It works as well as it always did. The icon on your Dock was not replaced. It continues to point to the older version of Numbers.
    Numbers 3 is in your Applications folder (not in a sub folder). Drag the icon to your Dock. It will become an alias. Right click (or control click) on it and Options > Keep in Dock.
    With icons for both versions on your Dock, you can choose which to open.
    Numbers 2 on the left (3 column chart).
    Numbers 3 on the right (4 column chart).
    Both versions will run happily at the same time if you wish. Just be sure which version is opening your document.
    You can revert a document that Numbers 3 has 'stolen' with Menu > File > Export To > Numbers '09.
    Regards,
    Ian.

  • Search and replace nested style in JS CS3

    I need to find and replace numbers at the beginning of paragraph which is styled as nestedStyle. What is the code? ST Dishon

    Hi dishon,
    I have attached the script to convert the applied nested styles to character style.
    After that you can easily do what you required.
    Regards,
    Ramkumar .P

  • Letters instead of numbers in graph

    Hi OTN,
    In my ADF BC application I have a bar graph. The graph looks like this: http://img846.imageshack.us/img846/1812/graphn.png
    So, my question is: is there any possibility of replacing numbers on the top of bars with letters (1 is A, 2 is B and etc.)?
    Type of graph is dvt:barGraph, ADF BC, Jdeveloper 11.1.1.4

    Done in with custom converter.
    <dvt:markerText id="markerText1" rendered="true">
                    <dvt:y1Format autoPrecision="off">
                      <f:converter converterId="estimationFormatter"/>
                    </dvt:y1Format>
                </dvt:markerText>Even though JDeveloper marks it as error in page source, it works.

  • Hp pavillion dv6 - 3042TX..._​...buy and replace screen.

    hp pavillion dv6 - 3042TX/windows 7 home premium.
    buy and replace screen...
    what sort of screen to buy; where to buy/order it
    I also want to replace fan and battery

    Hi Curious-kitty,
    Thank you for visiting the HP Support Forums and Welcome. I have read your thread on your HP Pavilion dv6-3042tx Notebook and needing to know replacement numbers and process. Here is a link to manuals pages 21, 27 and 30.
    If you would like the exact numbers as per your build, I would need the serial number. Please review the HP Privacy Statement. Then send it to me in a private message and I would be happy to give you the exact part numbers.
    You could also do this at HP Parts Store.
    Thanks.
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos, Thumbs Up" on the bottom to say “Thanks” for helping!

  • I upgraded to 3.2, but now spreadsheets that I create in 3.2 will not reopen. I need a newer version???

    I have faithfully updated my Numbers program. 3.2 is the latest version and it is loaded on my mac. However, when I create a spreadsheet in 3.2 and save it, when I go to reopen the spreadsheet Mac tells me I need a newer version of Numbers? What gives???

    Hi Jim,
    Updating to Numbers 2.3 did not replace Numbers '09, nor did it replace the icon on your Dock. The old icon continues to point to Numbers '09.
    Wayne Contello has written a User Tip for working with the old and new versions of iWork.
    https://discussions.apple.com/docs/DOC-6991
    The trick is to drag icons for both versions to your Dock. Right click or control click on each and Options > Keep in Dock. That puts you in charge of which version you launch.
    Instead of double clicking the document, run whichever version of Numbers suits and use File > Open.
    Here is a screen shot of icons for both versions on my Dock. Both will run together, but be sure which version is trying to open your document.
    Numbers '09 (three columns) on the left.
    Number 3.2 (four columns) on the right.
    Regards,
    Ian.

Maybe you are looking for

  • Page Items displayed in table borders

    Hello, This might be a 'newbie' question, but I need to design a form layout in a 'Grid', so I need to know how to enable borders around each page item (cell). I wish there was a way to create a layout in Dreamweaver and then have Html DB insert each

  • Reset airport  extreme ac not finding old extreme 802.11n

    Have supplanted an Airport Extreme 802.11n with an Airport Extreme 802.11ac. I have performed a hard reset on the .11n. I have configured the .11ac to functionally duplicate the network as managed by the .11n.  Uses the same network ID as before. Wor

  • RTMT shows 9 PRI's, I only have 6

    Recently my RTMT starting showing 9 PRI's on my cluster. I only have 6 active. I determined in RTMT the three additonal devices listed are FXO ports on my gateways. How do I delete these from being reported as MGCP PRI spans in service. Any reply app

  • Pease help error message panic cpu 0 caller 0x563ebd Unable to find driver for this platform

    please help errror message panic cpu 0 caller 0x563ebd Unable to find driver for this platform) i started recieving this message upon booting up with the start up chime after foolishly deleting the Apple USB ethernet host in teh system/extensions fol

  • Default_Appraiser  in appraisal form

    Hi Experts, I have used enhancement default_appraiser in my appraisal form for defaulting manager and same for employee i have used Default_appraisee. Now the problem is its not defaulting manager in form when employee creates new appraisal form. its