Jump to content

barneyf

Members
  • Posts

    11
  • Joined

  • Last visited

    Never

Everything posted by barneyf

  1. After much research, I determined that the only way to display the image is with the HTML <img src="...."> tag. This can either call a separate PHP script, or you can embed a small image (ie icon sized) as a URL embedded image. So I use the $_SESSION global to hold the data while waiting for the user's browser to call the PHP page defined in the <img src="....." > tag.
  2. I have an intranet application where I want to embed database driven XY graphs in a web page. I have a PHP script ("master.php") that generates the HTML output consisting of a mixture of HTML tables and graphs. Currently master.php writes out an IMG tag that uses graph.php as the data source. graph.php generates the PNG image via the GD library. This XY graph will have 1000 points per line and could have 20 or 30 lines so lots of data. This works OK if graph.php pulls the data from the database. But... I don't want to have graph pull the database info, I want master.php to pull the data, massage it, and pass it on to graph.php as a 2D array. This keeps all of my database queries & data massaging in master.php. All graph.php should do is take the array and generate a PNG image for the graph. I am looking for suggestions on how master.php can pass the data on to graph.php and prefer not to use GET (too much data) or a file (too slow). Using SESSION would work, but seems like overkill as I don't need to keep the data once it is passed on to graph.php. Any elegant solutions to this situation? If I could make graph.php an object and have the IMG tag call one of it's methods, that would be elegant. But so far I haven't found a way to make that work.
  3. In my .PHP file, I have some inline Javascript hard coded in. The inline Javascript references functions that are contained in an external .js file which is loaded by the browser. Eclipse-PDT is flagging these with a red underline & red bar on the right side of the editor window with the notation that the function is undefined. Is there any way to tell Eclipse-PDT about the external file so the red marks go away?
  4. I am building an application where PHP will refresh the web page on user command. I have references to a CSS and JavaScript file in the head section of the document: <head> <script type="text/javascript" src="myscript.js"></script> <link rel="stylesheet" type="text/css" href="main.css" /> </head> Does the browser (FireFox or IE) re-load the CSS & JavaScript source files every time the page is re-sent? Or is it smart enough to know it already has it loaded? I am using CSS frames, not HTML frames and I am not ready to go to Web 2.0 with Ajax & etc just yet. So if the browser blindly loads the files each time, is there a simple workaround? Thanks
  5. Eclipse PDT. I use Eclipse for Java, so it is convenient to have the same IDE for PHP as well.
  6. Yep, it is the semicolon. &nbsp gives the warnings, but does not.
  7. When I use HTML entities like &nbsp Eclipse-PDT (Eclipse Ver 3.4.1, PDT Ver 2.0.0) gives me a warning. Any way of letting it know this is a legal HMTL character?
  8. I want to backup my MySQL database so I tried the phpMyAdmin Export feature to save it as SQL commands in a text file. When I looked at the SQL file the table structure was there along with inserts to restore the data. But my INNODB table key constraints were missing. I found an old forum entry that mentioned unchecking "Data" to save the constraint info. I tried it and it worked. This seems odd, having to save two files. Is this how one really backs up a database? I presume that to restore the database, I would have to import the two files as well?
  9. All of the normalization info I can find shows only 2 levels of tables. I have three levels (Summary, Stage, Tests) for a test results database. The top layer is the "Summary" and defines overall test information such as DUT serial number etc. Each Summary can have multiple test Stages (1 Summary->many Stages). Each stage can have one of several different test results (1 Stage->1 Performance OR 1 Stage-> 1 Timeout, etc). I am using InnoDB and linking the sub-tables back to the higher level via a foreign key. The structure is: Summary (Level 1) SummaryID Auto Int (PK) SerialNum VARCHAR(20) others.... Stage (Level 2) StageID Auto Int (PK) SummaryID Int (FK -> Summary.SummaryID) StageNum TINYINT others..... Performance (Level 3a) PerformanceID Auto Int (PK) StageID Int (FK -> Stage.StageID) RandomWrite DECIMAL(7,2) SIGNED others.... TimeOut (Level 3b) TimeOutID Auto Int (PK) StageID Int (FK -> Stage.StageID) TimeoutLimit others... I want to display the information from specific Performance rows along with the corresponding information from the Stage and Summary table rows. For example: SerialNum StageNum RandomWrite ABC123 1 100.1 ABC123 2 89.6 ABC123 3 75.2 ZYX321 1 99.2 ZYX321 2 45.6 My PHP code joins the Performance and Stage, but I am having trouble getting to the Summary level. In trying different JOIN approaches, I am not sure my design is a good one. For example, should I include the SummaryID in the Performance table? That way I can skip over the Stage level to get to the Summary level. But then I am not sure if that is properly normalized. In a similar situation in the past I had a pre-defined database and used multiple queries to get the row info from the database. Then I used a lot of PHP code to mash the data together to get what I wanted. Not elegant or efficient. Since I am defining the database, I want to make the database definition support elegance and efficiency. Any discussion?
  10. Looks good. Since I want to base the new work order number on the last one stored in the table, I guess the basic process (excluding error handling) is: Table: WorkOrders Fields: id AutoIncrement integer & primary key wo User defined work order UUID SET AUTOCOMMIT = 0 BEGIN SELECT * FROM WorkOrders ORDER BY id DESC LIMIT 1 FOR UPDATE /* extract wo value from data set, increment, and assign to a variable $next_wo */ INSERT INTO WorkOrders (wo) VALUES ('$next_wo') COMMIT
  11. I am looking for suggestions on implementing a thread safe way to insert a new row into a WorkOrder table. The table will be InnoDB with an AutoIncrement UID primary key. But the WorkOrder field is based on 4 alpha-numeric characters (format specified by the user) and will be unique for each row. The field is alpha-numeric, so I can’t use a simple AutoIncrement integer value. The rate of inserts will be very low, about 20 per day. Queries to the table will be several thousand per day. Since I must read the latest WorkOrder field in order to create the next one, I have to prevent concurrent threads from reading the same last WorkOrder value at the same time and generating duplicate WorkOrder values. Can I use the InnoDB row locking to prevent duplicates, do I lock the whole table, or is there a better way (ie a PHP analog to JSP synchronized) to ensure thread safety? Thanks, Barney
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.