Simple PHP arrays not displaying after filling... newb question

Hey guys,.

If I have this simple text file, menu2.txt, which looks like this:

1
Test pizza One
Loaded with all that test pizza goodness! Lots and lots of ones 1111!
11.99
3
Test Threeza!
Do you see what I did there? I added a three to pizza, hahaha, I am so punny.
33.33
2
Test Pizza Two
The same as one with an extra one, yum!
22.99

and a little bit of simple php that needs to fill a few tables with this information that looks like this:

<?php
$menu2=fopen("pizzaMenu2.txt","r") or exit("System Error! Unable to collect the test menu");
$title2=array();
$descreption2=array();
$price2=array();
$arraypos2=0;
$tempstring2;


//This loop does all of the READING and populating of variables
while(!feof($menu2))
  {
            //First get the array possition
                              $arraypos2 = fgets($menu2);
  
          //Then Put in Title in title2 array
                              //populate the temparary string
                              $title2[$arraypos2] = fgets($menu2);
  
          //Then Put in Description in descreption2 array
                              //populate the temparary string
                              $descreotion2[$arraypos2] = fgets($menu2);
  
          //Finaly Put in Price in price2 array
                              //populate the temparary string
                              $price2[$arraypos2] = fgets($menu2);


  }
  //End of reading loop
  
 $arraypos2=1;
 while($arraypos2 <=3){
                              echo $title2[$arraypos2];
                              echo "<br />";
                              echo $descreotion2[$arraypos2];
                              echo "<br />";
                              echo $price2[$arraypos2];
                              echo "<br />";
                              $arraypos2++; 
 }
   
fclose($menu2);
?>

My problem is that the while loop bottem does not display anything but empty lines on my Web page (I.E. that line breaks work) and no text to their respective tables. However, if I coppy and past the same code from inside the low while loop at the bottem to top while loop then everything displays correctly. I understand something about how variables contain values in PHP, am I missing somehting? What's wrong with this code?

(P.S. I know that using a matrix (or array of arrays) is better than using two tables, but I am simply play to understand here).

Thank you guys. P.S. you can see the code does not not on my server of text here. It's at the top of the page. Thank you!

The only thing I can imagine there was a difference in the data type of the needle of the table. When filling you read in a file.  As an integer is valid, it should be the case as such, but perhaps it is interpreted as a char type. You use a counter in your second loop.  GetType() allows to see if it is is mixed up.

Tags: Dreamweaver

Similar Questions

  • Virtual disk don't is not displayed after creation

    Host - XP SP3-running VMWorkstation 6.5 system

    The use of VMWorkstation with the Virtual Machine, a virtual disk is created (IDE) to be used with the virtual machine. When creating of success of the virtual disk in a new folder called "Virtual disk" on the host drive, the VM is launched (XP SP2). Virtual Windows starts without a problem, however the newly created virtual disk is not displayed. How can I get the VM to see?

    Thanks, newbie TM

    Which means that your issue is resolved?

    If you have additional questions, feel free to ask them.

    If your problem is resolved, could you please mark it as answered? It helps other people who search the Forum because it is always easier to just check the question correctly answered not all after a search.

    While you're there, you are invited to also mark messages as useful/correct, this also affects virtual points to the person who helped you. Not nearly as important as the marking which is OK, but for sure appreciated

    --

    Wil

  • Element that does not display after the upgrade to to 12.1.3 12.0.6

    Items not displayed in the pages of front-end iStore after upgrade the instance of 12.0.6 to 12.1.3.

    We get the error messages below when checking out at the source of pages to display.

    oracle.apps.jtf.base.resources.FrameworkException: error in the Cache of the IAS: null

    at oracle.apps.jtf.cache.IASCacheProvider.get(IASCacheProvider.java:1347)

    at oracle.apps.jtf.cache.CacheManager.get(CacheManager.java:3075)

    at oracle.apps.jtf.cache.CacheManager.get(CacheManager.java:3012)

    at oracle.apps.ibe.catalog.Item.getItemPrices(Item.java:2798)

    at oracle.apps.ibe.catalog.Item.getItemPrices(Item.java:2490)

    at oracle.apps.ibe.catalog.Item.getItemPrices(Item.java:2421)

    at _ibeCCtdLfStMsI._jspService(_AEPLibeCCtdLfStMsI.java:376)

    at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)

    at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:390)

    at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)

    at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:734)

    at com.evermind.server.http.ServletRequestDispatcher.unprivileged_include(ServletRequestDispatcher.java:177)

    to com.evermind.server.http.ServletRequestDispatcher.access$ 000 (ServletRequestDispatcher.java:68)

    to com.evermind.server.http.ServletRequestDispatcher$ 1.oc4jRun(ServletRequestDispatcher.java:114)

    at oracle.oc4j.security.OC4JSecurity.doPrivileged(OC4JSecurity.java:284)

    at com.evermind.server.http.ServletRequestDispatcher.include(ServletRequestDispatcher.java:119)

    at com.evermind.server.http.EvermindPageContext.include(EvermindPageContext.java:456)

    at _ibeCCtdCmnSctLayout._jspService(_ibeCCtdCmnSctLayout.java:2071)

    at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)

    at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:390)

    at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)

    at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:734)

    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:391)

    at com.evermind.server.http.ServletRequestDispatcher.unprivileged_forward(ServletRequestDispatcher.java:280)

    in com.evermind.server.http.ServletRequestDispatcher.access$ 100 (ServletRequestDispatcher.java:68)

    to com.evermind.server.http.ServletRequestDispatcher$ 2.oc4jRun(ServletRequestDispatcher.java:214)

    at oracle.oc4j.security.OC4JSecurity.doPrivileged(OC4JSecurity.java:284)

    at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:219)

    at com.evermind.server.http.EvermindPageContext.forward(EvermindPageContext.java:395)

    at _ibeCCtpSctDspRte._jspService(_ibeCCtpSctDspRte.java:1238)

    at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)

    at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:390)

    at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)

    at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

    at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)

    at oracle.apps.ibe.util.IBEReleaseResFilter.doFilter(IBEReleaseResFilter.java:42)

    at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)

    at oracle.apps.jtf.base.session.ReleaseResFilter.doFilter(ReleaseResFilter.java:26)

    at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:17)

    at oracle.apps.fnd.security.AppsServletFilter.doFilter(AppsServletFilter.java:318)

    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:642)

    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:391)

    at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:908)

    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:458)

    at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:313)

    at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:199)

    to oracle.oc4j.network.ServerSocketReadHandler$ SafeRunnable.run (ServerSocketReadHandler.java:260)

    at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:234)

    to oracle.oc4j.network.ServerSocketAcceptHandler.access$ 700 (ServerSocketAcceptHandler.java:29)

    to oracle.oc4j.network.ServerSocketAcceptHandler$ AcceptHandlerHorse.run (ServerSocketAcceptHandler.java:879)

    to com.evermind.util.ReleasableResourcePooledExecutor$ MyWorker.run (ReleasableResourcePooledExecutor.java:303)

    at java.lang.Thread.run(Thread.java:662)

    Caused by: oracle.apps.jtf.base.resources.FrameworkException:

    An exception occurred in the CacheAccess.loadList method

    The object is null

    at oracle.apps.jtf.base.resources.FrameworkException.convertException(FrameworkException.java:607)

    at oracle.apps.jtf.base.resources.FrameworkException.addException(FrameworkException.java:585)

    to oracle.apps.jtf.base.resources.FrameworkException. < init > (FrameworkException.java:66)

    to oracle.apps.jtf.base.resources.FrameworkException. < init > (FrameworkException.java:88)

    to oracle.apps.jtf.base.resources.FrameworkException. < init > (FrameworkException.java:202)

    to oracle.apps.jtf.base.resources.FrameworkException. < init > (FrameworkException.java:218)

    to oracle.apps.jtf.base.resources.FrameworkException. < init > (FrameworkException.java:249)

    ... more than 57

    We have recompiled the key flex fields (KFF) point, once the problem is resolved.

  • Photos not displaying after W7 upgrade

    I use Lightroom 2.7. I just updated my OS from Vista to W7. Lightroom was working fine under Vista.

    After upgrading and from Lightroom, there is no error message but the photos are not displayed. Everything else seems to work ok - LR is not to say that the image is missing - it the correct file next to him in the library display name and there is no query against the files, so he knows that the photo is here and think it has load it, but where it should be is blank.  (see screenshot)

    LRmissingimage.PNG

    This is true for all the photos in the albums.

    I fixed installation of LR, driveway to a backup of the album (still no display) checked for improved display drivers, checked through forums FAQ etc and I'm stuck now, any help would be appreciated.

    Thank you

    Phil

    link should be

    http://forums.Adobe.com/thread/778839?TSTART=0

  • The contents of the folder are not displayed after upgrade

    When you click to open more folders of bookmarks toolbar to not display all bookmarks. Instead, they display a small square under the left side of the folder name. On one that opens subfolders under him displayed the same square. Its as if they tried to open but could not draw the menu. Bookmarks are available and display pages if I choose to open in a tab when right-clicking, but they cannot be seen otherwise. I have the following extensions that are not currently enabled: Adblock Plus, Adblock more pop - up, download status bar, download helper, Leet Key, IP Norton, Norton Toolbar, password exporter, personas. All have been updated to the latest version. I have Image zoom which is activated. IO have several additional plugins that are not enabled. Please let me know if they are needed.

    Do you use a character (Tools > Modules > themes)?

    See also http://kb.mozillazine.org/Locked_or_damaged_places.sqlite

  • Battery and Wifi info not displayed after updating IOS 10

    After upgrading to IOS 10 I have more information at the top of my home screen line. He comes to the line with WiFi, battery, and other info. I see it if I open an application, only some however. This status being lost, it is difficult to look at the life of the battery.

    How do I turn it back on?

    If it cannot be enabled by the user, then Apple needs to bring him back.

    David

    Hello! You can activate the in your settings. Go to battery and select on the percentage. The other options that are displayed on this bar, you can also turn on in general settings. Make sure that the WIFI is enabled in the settings. I had this happen before. After trying your settings, if you still do not see the bar with all the status restart the device. If it still does not work, you can try to recover the device on iTunes. The last resort would be to call the Apple support. I'll try to fix it in the settings that the lines may be busy.

  • Result does not display after comma

    Hi all

    I will be grateful if someone can help me with the attached VI. The weight value is read into a digital scale via RS232, the weight is read and displayed correctly but when I try and write the value to a file csv or txt digits after the decimal point is not connected. for example, 108.5 g is connected as 108.

    Best regards

    Maiz

    Given that you send a string to the writing of the worksheet function, do not use a % .10f format specifier.  Delete it so that it uses the default %s which is string.

    If you send it a digital painting, using the %.10f would have been appropriate.

  • VI only is not displayed after construction

    Hello

    I had the feeling that it is something simple, but I can't seem to make it work.  I'm not at my computer to work right now, so I'll follow up tomorrow with a more detailed update.  The systemic problem is that the project running since the project manager I can click a button and a vi will appear, but after I build and run the process even it shows loading and then nothing, the vi never pops up.  I think I might be missing something in the build options but do not know where.  I have included all the necessary elements in the section always include.  If someone has an idea made me know.  Tomorrow, I can give more details.

    Thank you


  • Data only is not displayed after you refresh the page

    Hi all.

    Connect with a user who has a certain responsibility associated with an org_id (82), but there is also an org_id (81) set as default at the site level.
    We have a page with an AttachmentTable that is used for the contracts.
    In this page, we have a function that updates some attachments (because a contract template has been changed) using a simultaneous process associated with BI Publisher.

    After this function has updated on attachments, to display the results in the AttachmentTable, I do the following in CO:
    pageContext.setForwardURLToCurrentPage (URLparam, false,
    OAWebBeanConstants.ADD_BREAD_CRUMB_NO,
    OAWebBeanConstants.IGNORE_MESSAGES);

    I read somewhere, refreshing the page that the retainAM must be set to false.
    When I refresh the current page to see the accessory updated in the layout of the AttachmentTable, I see the layout without any data, because I noticed the retainAM = false in the method cleans up any context and value org_id is lost (I have my VO profile the org_id value to filter my query).

    Note that this medication works very well when I connect with the same org_id (by the responsibility) of the value of the default site.
    Data loss occurs when I use an org_id which is not the same thing to the value of the default site.

    If I use retainAM = true, I don't see the attachment of the update.

    Do you have advice to help me to refresh the page (and AttachmentTable)?

    Thank you
    Concerning
    Vincenzo

    Published by: Vincenzo on 14.18 5 - it is a-2010

    Published by: Vincenzo on 14.19 5 - it is a-2010

    Published by: Vincenzo on 14.20 5 - it is a-2010

    Hi Vincenzo

    If I'm gettting it correct then you want to run the query based on the current ORG ID... IF this is the case then instead of use the VO query with this where clause

    WHERE XxfwContractEO.ORG_ID = fnd_profile.value ('ORG_ID')

    Please use

    WHERE XxfwContractEO.ORG_ID = :1
    

    & then when running the original Version, you can setWhereClauseParam to set the binding parameter.
    Please note: you can get the id of the help org pageContext.getOrgId ();

    Thank you
    AJ

  • Words don't is not displayed after the update to iOS10

    Many songs in my library have incorporated the lyrics (that I added using the 'Words' of iTunes tab). I'm used to be able to see everything while listening to the songs on my iPod Touch by tapping the image "sleeve" of the song.

    After the iOS10, this method does no more work. The other method, new to iOS10 (a special menu item "Words") does not either, as I don't see this anywhere menu item for all of my songs containing words. (Someone said that this function only works for the songs in Apple's music.)

    What should I do to restore this feature? Return to 9.3.5 or wait until Apple condescending to people like me who want to be able to read the lyrics while listening to the songs and who do not want to subscribe to the Apple's music?

    Form the iOS 10 manual

    See the lyrics. Drag until you see words, and then press Show to see. Press Hide to hide.

  • Why can I not get a video downloader? They disappear and or not displayed after selecting them in the area add to the page?

    I had a simple easy Downloader on my page of fox, he left a green arrow in the download bar, all I had to do was click on it and choose the type I wanted (mp3 or flv etc) but youtube gave me adifficiles time when I tried to download the most video, I'd get all those as the first , so I tried a downloader different he showed a video reel as it's symbol and it seems to work but then I clicked on accedently on something and he disappeared. Now, when I go to the Add-ons to get one it says I did succsessfully but does not appear when I return to my home page? Can you help with this problem please!

    I have a good video software download I recommend and use, is the Freemake Video Downloader. It of free and comes with a Firefox Add-on.

    I use it to download my friends YouTube videos.

    NOTE: This program is NOT to be used for piracy or any other unlawful activity.

    WARNING: Always be careful when downloading content on the internet. I will take no responsibility for any damage caused by a download. Download at your own risk!

  • Message notification is not displayed after you read the message and minimizing Skype for the next 5 minutes

    Hello

    We are a company of about 30 employees. We all use Skype. We are experiencing a problem where after reading the first message and minimize Skype, we do not receive the message notification until 5 minutes. This becomes painfully irritating that we will have to go check manually on all our messages to see if the other user has responded or not.

    Any help or guide in the right direction would be much appreciated

    Found the problem. Server a five minutes late, having first message "5 minutes" customers of time machine. Thus causing a space of 5 minutes of no message.

    Set the time on the server and re - sync all customers. 100% working now

  • Mac Pro is not displayed after the passage of the screens

    OK, so this is a strange problem but it's very annoying (at least for me). I just bought a LG Ultrawide 29 "display and connected via a HDMI cable to my Mac Pro (Home machine) and a second HDMI cable to my Macbook Pro (desktop computer). The Mac pro / Macbook pro good work with the big screen, HOWEVER, when I use my Mac pro and select the tilt of the screen to switch to the HDMI 2 connection, it works and rocking on my Macbook pro. But when I try to switch it back to HDMI 1 (Mac Pro), it comes back with a black screen and says no signal. Even if I plug the HDMI cable it does not work. I set the timer to 3 hours sleep, doesn't always help. I know he's not missing sleep because itunes can be played when I spend and still playing music throughout and continued when I try to switch back. The only way I could get is long, press the button on my Mac Pro and restart.

    The only reasonable difference that I know is that the Macbook pro is running Yosemites, while my Mac Pro running Beta El Capitan. I have a feeling, this is probably the cause, but I just wanted to know if someone has solved this problem somehow.

    Thank you

    Hello Hemlock70,

    Thank you for using communities of Apple Support.

    I understand that your external screen remains completely black, with a message no signal, during the passage of the views.  For assistance with this problem, please go through the steps in the link provided below.

    Get help with graphical problems on external displays connected to your Mac.

    Take care.

  • Decimal value not displayed after the decimal point in my excerpt

    The decimal value is not get rounded to the nearest integer in my voltage pack display box not switched. I changed his property in decimal, the problem continues. When I put a probe between the separator and the display area, I have correct values. How to get the correct value in the display area.

    See the color (color if you are UK) wire where you hang a probe... his orange (representing a number to floating point)... but the color of the indicator (another name for no dial-up power pack rack) is blue (U32, means is the representation of unsigned 32-bit integer)...!

    If that is the question... then try something... right click on the indicator (another name for no dial-up power pack rack) and select "representation > DBL", as shown below..! ' "

    It should work...!

  • Security tab is not displayed after the file right click and properties

    I'm trying reclim owner of my hardrive WD backup.  I click with the button straight on the file and left click on properties.  No Security tab shows.  Can you help me?

    If you do not have a Security tab, and then you use XP Home or you did not disable Simple file sharing in XP Pro.

    See http://support.microsoft.com/kb/308421 under "Preconditions."

Maybe you are looking for

  • Firefox opens each page like a HTTPS. How can I change to HTTP?

    I'm trying to reset my browser to moms.It opens as a secure page.the same thing happens with IE 8 He trust all pages as certificates have errors on them. or he says they do. I am running win XP and I reinstalled firefox just in case. my internet conn

  • Firefox continues to show that I need high-grade firefox but I have the most recent, how to stop it

    Popup message that I need to high-grade, fire fox, already have the most recent in a (No 26). Have uninstalled and reinstalled and still get the message that I need to up grade, have windows 7.

  • HTC Inspire is currently recognized as a desire

    I have a HTC inspired by att. Lately, I've seen firefox had it app because the phone and I liked the computer version, so I wanted to do. When I tried it said it was not compatible and that my phone was a desire which I know for a fact that it is not

  • New disk recovery is required for my Qosmio G20

    Dear Sirs, I lost my suitcase which included my recovery disc and cables...Can I have another pack of accessories delivered to me on my costs? I am facing serious questions about Qosmio G20 with Media Center 2005 and think I'm ready for a clean forma

  • Second HDD on Equium P200-139

    Hello world Anyone know if I am able to put a new HARD drive as a second drive in my laptop, it has a spare drive bay HDD2.My model # PSPBNE - 004003KS. Model. EQUIUM P200-139. Thank you very much.Steve