Penny_Rollo Posted November 4, 2006 Share Posted November 4, 2006 Currently building an A-Z science db in mysql.Call-ups work fine for existing data being drawn from the db by php, but I need to know how to sequence call-ups for index pages. eg "positivecharge" might appear on lines 40, 41, 42, 43, 44 of the db - so for the positive charge index page I am currently having to amend the template to read (for example):[quote]<?php$SQL="SELECT * FROM azchem0003";$result = mysql_query("Select * from azchem0003 where number='040'");$data = mysql_fetch_array($result);?>(followed by block of echo call ups from a single db line, all of which work fine)[/quote]ie I am having to go through and paste in the correct line no. from the database before each new block of info, on *each* separate index page. (so the next one on the positive charge page would be[quote]<?php$SQL="SELECT * FROM azchem0003";$result = mysql_query("Select * from azchem0003 where number='041");$data = mysql_fetch_array($result);?>[/quote](etc.)It gets more complex because every time I add new stuff to the db and sort it alphabetically, positive charge will start on a differently-numbered line (so I have to go through and re-number every index-page template individually).Logic tells me it must be possible to automate this somehow such that I could have something along the lines of[quote]<?php$SQL="SELECT * FROM azchem0003";$result = mysql_query("Select * from azchem0003 where itemfileref='positivecharge'");$data = mysql_fetch_array($result);?>[/quote]but I need (something) to specify that only the first-appearing-line with positivecharge as the itemfileref is used, until replaced by the next-appearing-line with positivecharge as the itemfileref (until it runs out of lines that meet that criteria).If necessary I could work on the basis of actually stating the first line number as "n" (or whatever) then the next being "n+1" [I haven't the remotest idea how to code this]but ideally I would like to find a way to call up all the lines with that itemfileref in sequence (and only those lines) so that I don't have to go through and manually amend every single call-up-index-page every time the actual line numbers change.Don't want to write screeds here :) but hope I've explained this well enough and would really appreciate some help if anyone can explain what I need to do, in words of one syllable.Regards,Penny. Quote Link to comment Share on other sites More sharing options...
Psycho Posted November 4, 2006 Share Posted November 4, 2006 [i]"It gets more complex because every time I add new stuff to the db and sort it alphabetically,..."[/i]You should NEVER have to put your records in a database in a specific order. I you have to do this, you are using the database incorrectly.[i]"...I need (something) to specify that only the first-appearing-line with positivecharge as the itemfileref is used..."[/i]Ok, I am assuming then that for the 'positivecharge' entries you want them to be displayed in a specific order and that you are currently doing this by arranging the database for them to be in that order.What you need to do is create a new field in the database called 'sortOrder' or something to that effect. The sort order will specify what order records with the same itemfileref will be displayed in. In other words the sort order for each itemfileref is independant of each other - each one will have an entry with a sort order of 1.You can then pull your data - in the correct order - like this:SELECT * FROM azchem0003 WHERE itemfileref='positivecharge' ORDER BY sortOrder ASCNow it will not matter where a record exists in the database. Your first record could be the last one in the database, but you can still display then in the order you want. Quote Link to comment Share on other sites More sharing options...
Penny_Rollo Posted November 4, 2006 Author Share Posted November 4, 2006 [quote author=mjdamato link=topic=113840.msg462935#msg462935 date=1162666363]What you need to do is create a new field in the database called 'sortOrder' or something to that effect. The sort order will specify what order records with the same itemfileref will be displayed in. In other words the sort order for each itemfileref is independant of each other - each one will have an entry with a sort order of 1.You can then pull your data - in the correct order - like this:SELECT * FROM azchem0003 WHERE itemfileref='positivecharge' ORDER BY sortOrder ASCNow it will not matter where a record exists in the database. Your first record could be the last one in the database, but you can still display then in the order you want.[/quote]Thank you mjdamato :D much appreciate the reply.I think I have understood what you said about databases! though it's some way beyond my grasp of things so far (I'm not at all technically-minded).I already have a column that "sorts" (usually I sort the db alphabetically by (a) itemfileref and (b) clusterref, before I work with it, so I have put clusterref in place of sortOrder, and now have[quote]<?php$SQL="SELECT * FROM azchem0003";$result = mysql_query("SELECT * FROM azchem0003 WHERE itemfileref='positivecharge' ORDER BY clusterref ASC;)$data = mysql_fetch_array($result);?>[/quote]in all the places I previously had a line-number call-up as quoted previously.However I am now getting the error message:Parse error: parse error, unexpected T_STRING in /positivecharge.php on line 10(line 10 is<BASE HREF="http://www.happychild.org.uk/gridbuilding/chemistry/<? echo $data["itemfileref"] ?>/index.htm">... the first place I have an echo call-up.Presumably I've stuffed up on precisely how the sort factor should have been input - I've tried several variables but I'm not getting anywhere. Any ideas?Thanks,Penny. Quote Link to comment Share on other sites More sharing options...
Psycho Posted November 4, 2006 Share Posted November 4, 2006 OK, in regards to this code[code]<?php$SQL="SELECT * FROM azchem0003";$result = mysql_query("SELECT * FROM azchem0003 WHERE itemfileref='positivecharge' ORDER BY clusterref ASC;)$data = mysql_fetch_array($result);?>[/code]That first line does absolutely nothing sionce you don't use the variable! You should change the 2nd line to use the variable instead of writing the query directly into the mysql_query command. This also makes debugging easier as you can simply echo a query string to the page. Plus there is no double quote mark at the end. So the code should be:[code]<?php$SQL=""SELECT * FROM azchem0003 WHERE itemfileref='positivecharge' ORDER BY clusterref ASC";$result = mysql_query($SQL)$data = mysql_fetch_array($result);?>[/code]On the error you are getting I think it is because you do not have a semicolon at the end of that echo<? echo $data["itemfileref"]; ?>Note that when you experience an error and a line number is given the error will many times actually be in a previous line number. Quote Link to comment Share on other sites More sharing options...
Penny_Rollo Posted November 4, 2006 Author Share Posted November 4, 2006 [quote author=mjdamato link=topic=113840.msg462975#msg462975 date=1162672507]That first line does absolutely nothing sionce you don't use the variable![/quote] :-[ yes I just discovered that :DHad just discovered the mistake/s in the order of quotes-semi-colon-bracket and changed that to[quote]<?php$SQL="SELECT * FROM azchem0003";$result = mysql_query("SELECT * FROM azchem0003 WHERE itemfileref='positivecharge' ORDER BY clusterref ASC");$data = mysql_fetch_array($result);?>[/quote]and got a fully-working page with all 10 outputs the same, at the same time as you posted (see http://ccgi.rollobks.force9.co.uk/positivecharge10same.php ).At least the page is visible, so am now going to try pasting in what you've added (just didn't want not to reply initially as all this usually takes quite some time). Thank you for bearing with me :)Regards,Penny. Quote Link to comment Share on other sites More sharing options...
Psycho Posted November 4, 2006 Share Posted November 4, 2006 FYI: My sample code had two doubble quotes at the beginning of $SQL=, change that to one double quotePost the code that displays the results.Also, if you are using your actual server to test code, that is kind of inefficient. You could download an all-in-one package like XAMPP. It is a web server, php, & MySQL server in one package. All you have to do is copy the files to a directory and run the console and you can easily develope on your desktop. Quote Link to comment Share on other sites More sharing options...
Penny_Rollo Posted November 4, 2006 Author Share Posted November 4, 2006 [quote author=mjdamato link=topic=113840.msg462975#msg462975 date=1162672507]So the code should be:[code]<?php$SQL=""SELECT * FROM azchem0003 WHERE itemfileref='positivecharge' ORDER BY clusterref ASC";$result = mysql_query($SQL)$data = mysql_fetch_array($result);?>[/code][/quote]I have tried that (for all 12 occurrences) but just get Parse error: parse error, unexpected T_STRING in ... on line 4 [which at the start of the document is the one with ""SELECT on it].Tried replacing the double-double near the beginning of the $SQL line with just-one-double, and got the page to output (but again with all 10 entries the same). At some stage I also added a ; to the end of the $result line which stopped a parse query (though again I don't know if I've done the right thing).Anyway,[quote]<?php$SQL="SELECT * FROM azchem0003 WHERE itemfileref='positivecharge' ORDER BY clusterref ASC";$result = mysql_query($SQL);$data = mysql_fetch_array($result);?>[/quote]will generate the page, but the entries are all the same. clusterref has all sorts in it (eg nucleus, protons, etc.) but how does the php know to call up those entries alphabetically within the positivecharge itemfileref?You probably think by this stage that I'm exceptionally dense but I truthfully don't understand how this "sort" aspect works (unless it's alphabetical somehow) - and if it's alphabetical, why does it keep calling the first one? As you'll see from http://ccgi.rollobks.force9.co.uk/positivecharge10same.php , it is correctly calling the first item, but the page at http://www.happychild.org.uk/gridbuilding/chemistry/positivecharge/index.htm shows the correct order [pls ignore the meta-tags, I've changed the call-ups since then but unable to update the generated .htm page till I can get the php output correct again].Regards,Penny. Quote Link to comment Share on other sites More sharing options...
Penny_Rollo Posted November 4, 2006 Author Share Posted November 4, 2006 [quote author=mjdamato link=topic=113840.msg462992#msg462992 date=1162675690]Also, if you are using your actual server to test code, that is kind of inefficient. You could download an all-in-one package like XAMPP. It is a web server, php, & MySQL server in one package. All you have to do is copy the files to a directory and run the console and you can easily develope on your desktop.[/quote]Sorry, I was writing my post as yours went up, so as you'll see I'd done the quotes thing. Don't think I can use the XAMPP package as I have to work in conjunction with my ISP's MySQL server. It's probably not an ideal way of doing things but it works, most of the time :)Regards,Penny. Quote Link to comment Share on other sites More sharing options...
Psycho Posted November 4, 2006 Share Posted November 4, 2006 You're doing fine. The changes you made were all correct - I didn't catch the missing semi-colon. Anyway, please post the code that you are using to display the results, I'm pretty sure the reason why you see the same 10 entries is in there.As for using XAMPP or some other package you could export the database from the database on your ISPs server to your local one.Anyway please post the code following the query and I can help further. But, I may not be able to get back to this until later. Quote Link to comment Share on other sites More sharing options...
Penny_Rollo Posted November 4, 2006 Author Share Posted November 4, 2006 [quote author=mjdamato link=topic=113840.msg463000#msg463000 date=1162677049]Anyway please post the code following the query and I can help further. But, I may not be able to get back to this until later.[/quote]code is[quote][code]<?php$SQL="SELECT * FROM azchem0003 WHERE itemfileref='positivecharge' ORDER BY clusterref ASC";$result = mysql_query($SQL);$data = mysql_fetch_array($result);?>[/code][/quote]which is the same in all 12 instances except the first one which actually includes the opening of the database (db is closed at the end of the php page). Pages are set in html and then output from the php page through a separate call-up page which generates a static html page (one page at a time but I haven't found any other way of converting automatically that definitely always works).Do hope the code above will give you some clue as to why the entries are all the same. If it does prove possible to fix, it will save *so* much work in putting together the science resource.I'm going away now to replicate all the db lines for each item they contain (changing the item refs as appropriate) so as to get a full set of references for everything, for the index pages in due course. Somewhat longwinded process, but you'll have gathered by now I tend to take the long way round, most of the time, whilst I'm not very sure what I'm doing :) I'll check back here every now and again, appreciate you too have other things to do. Just grateful for your help.Regards,Penny. Quote Link to comment Share on other sites More sharing options...
Psycho Posted November 4, 2006 Share Posted November 4, 2006 That's not what I was looking for. Somewhere you have a loop that is actually creating the HTML to "print" that data to the page. Try this. Replace this line[code]$data = mysql_fetch_array($result);[/code]with this[code]<?phpecho "<table border=1>";while ($data = mysql_fetch_array($result)) { echo "<tr>"; foreach ($data as $value) { echo "<td>$value</td>"; } echo "</tr>"; }echo "</table>";?>[/code]and comment everything else out after that. This should print out the entire records returned in the query to a table on the page. Do all the records show up?I think the problem is that the code is not extracting all the records from the query and is insteaed going through a loop and just printing the first data set. Quote Link to comment Share on other sites More sharing options...
Penny_Rollo Posted November 4, 2006 Author Share Posted November 4, 2006 [quote author=mjdamato link=topic=113840.msg463031#msg463031 date=1162682799]That's not what I was looking for. Somewhere you have a loop that is actually creating the HTML to "print" that data to the page. Try this. [/quote]Totally lost now :)) but I've done as requested (I think!) and replaced[quote]<?php$SQL="SELECT * FROM azchem0003 WHERE itemfileref='positivecharge' ORDER BY clusterref ASC";$result = mysql_query($SQL);$data = mysql_fetch_array($result);?>[/quote]with[quote]<?php$SQL="SELECT * FROM azchem0003 WHERE itemfileref='positivecharge' ORDER BY clusterref ASC";$result = mysql_query($SQL);echo "<table border=1>";while ($data = mysql_fetch_array($result)) { echo "<tr>"; foreach ($data as $value) { echo "<td>$value</td>"; } echo "</tr>"; }echo "</table>";?>[/quote]which has produced the output shown at http://ccgi.rollobks.force9.co.uk/positivechargetabletest01.php [which has called up the same four results shown at http://www.happychild.org.uk/gridbuilding/chemistry/positivecharge/index.htm (see cluster links bottom right of each on page) , same set of 4 results for all 12 requests on the positivecharge index page]. I hope this clarifies something.The call-up at the beginning of the page (above the html <HEAD> etc.) is to generate the data for the meta-tags etc.; the call-ups further down are to produce data as required (just set for 10 possible entries until it all gets somewhat more comprehensively filled out).The only php code I've got on the page is (a) at the top to open the db, with the mysql stuff already quoted, (b) 10 blocks of the quoted thing each followed by numerous echo commands, and one lot at the foot to generate the page address etc. (this I think will need to have a line ref as it needs the same data as one of the first ones before lines with positivecharge in them run out).I hope this all makes sense. The table lines have 104 fields by the way, though most lines don't use that many.Regards,Penny.Afterthought: sample echo command is <? echo $data["itemlc"] ?>all the existing ones have worked fine for the pages provided that I have specified the relevant db line immediately before them. Quote Link to comment Share on other sites More sharing options...
Penny_Rollo Posted November 5, 2006 Author Share Posted November 5, 2006 Just as an afterthought, I will already have had to have pre-sorted the db to enable the generation of the page at http://www.happychild.org.uk/gridbuilding/chemistry/AZ/index.htm . I actually create the db in MS Works 2000 [haven't fathomed out how to get "form" view in Excel], do the sort by (a) itemfileref and (b) clusterref, *then* add sequential numbers down the first column [so the numbers match the result order of the double alphabetical sort], export as a .txt file and then upload into mysql via telnet.So the A-Z page php template calls up all the content by sequential line numbers.Given that the http://ccgi.rollobks.force9.co.uk/positivechargetabletest01.php page already shows the line numbers, is there any way of getting the code to call up the line arrays in sequence for the positivecharge index page, without specifying specific line numbers, if it proves impossible to call them up individually just using clusterref?Just struggling here with the technicalities. Thank you for your charitable comments earlier :) keenly aware of how little I understand compared with most of you.Regards,Penny. Quote Link to comment Share on other sites More sharing options...
Penny_Rollo Posted November 6, 2006 Author Share Posted November 6, 2006 mjdamato, do you have any further ideas on this? I've just input the next massive block of definitions and I will need to generate a new block of index pages, shortly.Appreciate your time (EST?) is probably different from that here (GMT) but I really need to process the index pages today if at all possible. Even if a solution isn't possible for this block, wd still appreciate your views as it might make generating the next block easier :)Regards,Penny. Quote Link to comment Share on other sites More sharing options...
Psycho Posted November 6, 2006 Share Posted November 6, 2006 The only reason why the pages would have the same data repeated multiple times is if the code is within a loop. The code example I gave you was a perfect example. It should simply write the entire dataset to the page - one time only. The fact that it was displayed multiple times suggests that it is inside another loop on that page that you haven't provided code for. Quote Link to comment Share on other sites More sharing options...
Penny_Rollo Posted November 6, 2006 Author Share Posted November 6, 2006 [quote author=mjdamato link=topic=113840.msg463660#msg463660 date=1162827786]The only reason why the pages would have the same data repeated multiple times is if the code is within a loop. The code example I gave you was a perfect example. It should simply write the entire dataset to the page - one time only. The fact that it was displayed multiple times suggests that it is inside another loop on that page that you haven't provided code for.[/quote]Sort of understand where you're coming from :)The way I had the page set originally up (to work with the line numbers as previously referenced within each block) is as follows:[quote](this is just a quote of the first block; the sequential blocks would have had sequential line numbers)[quote]<?php$SQL="SELECT * FROM azchem0003";$result = mysql_query("Select * from azchem0003 where number='112'");$data = mysql_fetch_array($result);?><A NAME="<? echo $data["clusterref"] ?>"></A><CENTER><TABLE BGCOLOR="#e2e2e2" ALIGN="CENTER" BORDER="5" WIDTH="100%" CELLPADDING="2" CELLSPACING="4"><TR><TD WIDTH="20%" ALIGN="CENTER" BGCOLOR="#ffffff"><A HREF="http://www.happychild.org.uk/gridbuilding/science/AZ/index.htm#<? echo $data["itemfileref"] ?>"><FONT FACE="Arial" SIZE="-2" COLOR="#000000"><STRONG>SCIENCE A-Z<BR><? echo $data["itemlc"] ?></STRONG></FONT></A></TD><TD ROWSPAN="2" WIDTH="60%" ALIGN="CENTER" BGCOLOR="#ffffff"><blockquote><P ALIGN="JUSTIFY"><FONT FACE="Comic Sans MS" SIZE="-1" COLOR="#000000"><STRONG><BR><? echo $data["BFG001"] ?> <? echo $data["BFG002"] ?> <? echo $data["BFG003"] ?> <? echo $data["BFG004"] ?> <? echo $data["BFG005"] ?> <? echo $data["BFG006"] ?> <? echo $data["BFG007"] ?> <? echo $data["BFG008"] ?> <? echo $data["BFG009"] ?> <? echo $data["BFG010"] ?> <? echo $data["BFG011"] ?> <? echo $data["BFG012"] ?> <? echo $data["BFG013"] ?> <? echo $data["BFG014"] ?> <? echo $data["BFG015"] ?> <? echo $data["BFG016"] ?> <? echo $data["BFG017"] ?> <? echo $data["BFG018"] ?> <? echo $data["BFG019"] ?> <? echo $data["BFG020"] ?> <? echo $data["BFG021"] ?> <? echo $data["BFG022"] ?> <? echo $data["BFG023"] ?> <? echo $data["BFG024"] ?> <? echo $data["BFG025"] ?> <? echo $data["BFG026"] ?> <? echo $data["BFG027"] ?> <? echo $data["BFG028"] ?> <? echo $data["BFG029"] ?> <? echo $data["BFG030"] ?> <? echo $data["BFG031"] ?> <? echo $data["BFG032"] ?> <? echo $data["BFG033"] ?> <? echo $data["BFG034"] ?> <? echo $data["BFG035"] ?> <? echo $data["BFG036"] ?> <? echo $data["BFG037"] ?> <? echo $data["BFG038"] ?> <? echo $data["BFG039"] ?> <? echo $data["BFG040"] ?> <? echo $data["BFG041"] ?> <? echo $data["BFG042"] ?> <? echo $data["BFG043"] ?> <? echo $data["BFG044"] ?> <? echo $data["BFG045"] ?> <? echo $data["BFG046"] ?> <? echo $data["BFG047"] ?> <? echo $data["BFG048"] ?> <? echo $data["BFG049"] ?> <? echo $data["BFG050"] ?> <? echo $data["BFG051"] ?> <? echo $data["BFG052"] ?> <? echo $data["BFG053"] ?> <? echo $data["BFG054"] ?> <? echo $data["BFG055"] ?> <? echo $data["BFG056"] ?> <? echo $data["BFG057"] ?> <? echo $data["BFG058"] ?> <? echo $data["BFG059"] ?> <? echo $data["BFG060"] ?> <? echo $data["BFG061"] ?> <? echo $data["BFG062"] ?> <? echo $data["BFG063"] ?> <? echo $data["BFG064"] ?> <? echo $data["BFG065"] ?> <? echo $data["BFG066"] ?> <? echo $data["BFG067"] ?> <? echo $data["BFG068"] ?> <? echo $data["BFG069"] ?> <? echo $data["BFG070"] ?> <? echo $data["BFG071"] ?> <? echo $data["BFG072"] ?> <? echo $data["BFG073"] ?> <? echo $data["BFG074"] ?> <? echo $data["BFG075"] ?> <? echo $data["BFG076"] ?> <? echo $data["BFG077"] ?> <? echo $data["BFG078"] ?> <? echo $data["BFG079"] ?> <? echo $data["BFG080"] ?> <? echo $data["BFG081"] ?> <? echo $data["BFG082"] ?> <? echo $data["BFG083"] ?> <? echo $data["BFG084"] ?> <? echo $data["BFG085"] ?> <? echo $data["BFG086"] ?> <? echo $data["BFG087"] ?> <? echo $data["BFG088"] ?> <? echo $data["BFG089"] ?> <? echo $data["BFG090"] ?> <? echo $data["BFG091"] ?> <? echo $data["BFG092"] ?> <? echo $data["BFG093"] ?> <? echo $data["BFG094"] ?> <? echo $data["BFG095"] ?> <? echo $data["BFG096"] ?> <? echo $data["BFG097"] ?> <? echo $data["BFG098"] ?> <? echo $data["BFG099"] ?> <? echo $data["BFG100"] ?> <? echo $data["BFG101"] ?> <? echo $data["BFG102"] ?> <? echo $data["BFG103"] ?> <? echo $data["BFG104"] ?></STRONG></FONT></P></blockquote></TD><TD WIDTH="20%" ALIGN="CENTER" BGCOLOR="#ffffff"><A HREF="http://www.happychild.org.uk/gridbuilding/chemistry/AZ/index.htm#<? echo $data["itemfileref"] ?>"><FONT FACE="Arial" SIZE="-2" COLOR="#000000"><STRONG>CHEMISTRY A-Z<BR><? echo $data["itemlc"] ?></STRONG></FONT></A></TD><TR><TD WIDTH="20%" ALIGN="CENTER" BGCOLOR="#ffffff"><A HREF="http://www.happychild.org.uk/gridbuilding/science/AZ/index.htm#<? echo $data["clusterref"] ?>"><FONT FACE="Arial" SIZE="-2" COLOR="#000000"><STRONG>SCIENCE A-Z<BR>cluster: <? echo $data["clusterlc"] ?></STRONG></FONT></A></TD></TD><TD WIDTH="20%" ALIGN="CENTER" BGCOLOR="#ffffff"><A HREF="http://www.happychild.org.uk/gridbuilding/chemistry/AZ/index.htm#<? echo $data["clusterref"] ?>"><FONT FACE="Arial" SIZE="-2" COLOR="#000000"><STRONG>CHEMISTRY A-Z<BR>cluster: <? echo $data["clusterlc"] ?></STRONG></FONT></A></TD></TD></TABLE></CENTER><BR>[/quote](so the next block would have had where number='113', etc.)[/quote]The code you've provided already[quote]<?php$SQL="SELECT * FROM azchem0003 WHERE itemfileref='positivecharge' ORDER BY clusterref ASC";$result = mysql_query($SQL);$data = mysql_fetch_array($result);?>[/quote]will call up all-four-together of the positivecharge db lines but presumably I need to be able to make the php to only call up one of the lines at a time so it extracts the correct data from a specified single line out of the already-identified block of four lines.Does this help? Sorry but I didn't previously understand quite what it was you were asking me for.Regards,Penny. Quote Link to comment Share on other sites More sharing options...
Psycho Posted November 6, 2006 Share Posted November 6, 2006 The fact that data is showing up multiple times (especially with the sample code i provided) leads me to believe that there is another loop inside which the code we are working on exists. Can you post the code for the page in question in it's entirety? Hopefully it is not too massive. Quote Link to comment Share on other sites More sharing options...
Penny_Rollo Posted November 6, 2006 Author Share Posted November 6, 2006 [quote author=mjdamato link=topic=113840.msg463730#msg463730 date=1162832823]The fact that data is showing up multiple times (especially with the sample code i provided) leads me to believe that there is another loop inside which the code we are working on exists. Can you post the code for the page in question in it's entirety? Hopefully it is not too massive.[/quote]Okay, I've quoted it below. And yes it's fairly long :)Slightly embarrassed at displaying how very rudimentary my knowledge of php/mysql is :-[ The index pages (eg positivecharge) all have to be created individually on the basis of (a) making a template (b) creating a positivecharge.php file (and each of all the other itemfileref catagories) and then doing a "find" on "zzz" and pasting in line numbers for that specific category (hence the zzz entries further down the page when I had run out of positivecharge lines).[note - afterwards - five of the zzz entries and following blocks have been removed as the post got rejected as over-length, but I've left the one in after the four positivecharge blocks, so you can see what I was referring to - have also had to remove other extraneous bits of the page because of the "length" factor, but nothing that contained any php coding]The db opening bit is at the start, and the close db bit at the end, but it had already struck me that I was asking the db to look at a line and then telling it to look at another, without first telling it to stop looking at the first line. I recognise that I could have closed the db each time and then re-opened it again before the next instruction but I didn't want to place too much load on the server (it's shared with up to 200,000 other people all customers of the same ISP).Anyway FWIW the page source code is below [I've blanked out the specific db access details, password etc., obviously][quote]<?php$db = mysql_connect("XXXXXXXX","XXXXXXX","XXXXXXX");mysql_select_db('XXXXXX', $db);$SQL="SELECT * FROM azchem0003";$result = mysql_query("Select * from azchem0003 where number='112'");$data = mysql_fetch_array($result);?><HTML><HEAD><META NAME="Generator" CONTENT="Corel WordPerfect 8"><BASE HREF="http://www.happychild.org.uk/gridbuilding/chemistry/<? echo $data["itemfileref"] ?>/index.htm"><META NAME="DATE" CONTENT="10/10/2006"><META NAME="Author" CONTENT="Penny"><meta name="description" content="3D GridBuilding - Chemistry - <? echo $data["itemmc"] ?> - at FREEWAY and Project HappyChild"><meta name="distribution" content="global"><meta name="keywords" content="3D gridbuilding, <? echo $data["biol-chem-phys"] ?>, <? echo $data["itemfileref"] ?>, science, freeway, project happychild, educate, education, learn, learning, home, child, children, travel, overseas, help"><TITLE>3D GridBuilding - Chemistry - <? echo $data["itemmc"] ?> - at Project HappyChild</TITLE></HEAD><BODY TEXT="#000000" LINK="#000000" VLINK="#000050" ALINK="#c0c0c0" BGCOLOR="#baac9a"><CENTER><TABLE ALIGN="CENTER" BORDER="7" WIDTH="100%" CELLPADDING="0" CELLSPACING="0"><TR><TD ALIGN="CENTER" BGCOLOR="#fffeff"><CENTER><TABLE ALIGN="CENTER" BORDER="0" WIDTH="100%" CELLPADDING="0" CELLSPACING="0"><TR><TD ALIGN="CENTER" WIDTH="20%"><A HREF="http://www.happychild.org.uk/gridbuilding/index.htm"><img src="http://www.happychild.org.uk/Webimage/gridworld.png" border=0 alt="3D gridbuilding - science"></A></TD><TD ALIGN="CENTER" WIDTH="60%" BGCOLOR="#c7c7c7"><FONT FACE="Arial" SIZE="-2"><BR></FONT><FONT FACE="Verdana" SIZE="+3" COLOR="#ffffff"><STRONG><? echo $data["itemmc"] ?></STRONG></FONT></TD><TD ALIGN="CENTER" WIDTH="20%"><A HREF="http://www.happychild.org.uk/gridbuilding/chemistry/index.htm"><img src="http://www.happychild.org.uk/Webimage/gridworld.png" border=0 alt="3D gridbuilding - <? echo $data["biol-chem-phys"] ?>"></A></TD></TR></TABLE></CENTER></TD></TR></TABLE></CENTER><BR><FONT FACE="Arial" SIZE="-2"><BR></FONT><FONT FACE="Arial" SIZE="-2"><BR></FONT><?php$SQL="SELECT * FROM azchem0003";$result = mysql_query("Select * from azchem0003 where number='112'");$data = mysql_fetch_array($result);?><A NAME="<? echo $data["clusterref"] ?>"></A><CENTER><TABLE BGCOLOR="#e2e2e2" ALIGN="CENTER" BORDER="5" WIDTH="100%" CELLPADDING="2" CELLSPACING="4"><TR><TD WIDTH="20%" ALIGN="CENTER" BGCOLOR="#ffffff"><A HREF="http://www.happychild.org.uk/gridbuilding/science/AZ/index.htm#<? echo $data["itemfileref"] ?>"><FONT FACE="Arial" SIZE="-2" COLOR="#000000"><STRONG>SCIENCE A-Z<BR><? echo $data["itemlc"] ?></STRONG></FONT></A></TD><TD ROWSPAN="2" WIDTH="60%" ALIGN="CENTER" BGCOLOR="#ffffff"><blockquote><P ALIGN="JUSTIFY"><FONT FACE="Comic Sans MS" SIZE="-1" COLOR="#000000"><STRONG><BR><? echo $data["BFG001"] ?> <? echo $data["BFG002"] ?> <? echo $data["BFG003"] ?> <? echo $data["BFG004"] ?> <? echo $data["BFG005"] ?> <? echo $data["BFG006"] ?> <? echo $data["BFG007"] ?> <? echo $data["BFG008"] ?> <? echo $data["BFG009"] ?> <? echo $data["BFG010"] ?> <? echo $data["BFG011"] ?> <? echo $data["BFG012"] ?> <? echo $data["BFG013"] ?> <? echo $data["BFG014"] ?> <? echo $data["BFG015"] ?> <? echo $data["BFG016"] ?> <? echo $data["BFG017"] ?> <? echo $data["BFG018"] ?> <? echo $data["BFG019"] ?> <? echo $data["BFG020"] ?> <? echo $data["BFG021"] ?> <? echo $data["BFG022"] ?> <? echo $data["BFG023"] ?> <? echo $data["BFG024"] ?> <? echo $data["BFG025"] ?> <? echo $data["BFG026"] ?> <? echo $data["BFG027"] ?> <? echo $data["BFG028"] ?> <? echo $data["BFG029"] ?> <? echo $data["BFG030"] ?> <? echo $data["BFG031"] ?> <? echo $data["BFG032"] ?> <? echo $data["BFG033"] ?> <? echo $data["BFG034"] ?> <? echo $data["BFG035"] ?> <? echo $data["BFG036"] ?> <? echo $data["BFG037"] ?> <? echo $data["BFG038"] ?> <? echo $data["BFG039"] ?> <? echo $data["BFG040"] ?> <? echo $data["BFG041"] ?> <? echo $data["BFG042"] ?> <? echo $data["BFG043"] ?> <? echo $data["BFG044"] ?> <? echo $data["BFG045"] ?> <? echo $data["BFG046"] ?> <? echo $data["BFG047"] ?> <? echo $data["BFG048"] ?> <? echo $data["BFG049"] ?> <? echo $data["BFG050"] ?> <? echo $data["BFG051"] ?> <? echo $data["BFG052"] ?> <? echo $data["BFG053"] ?> <? echo $data["BFG054"] ?> <? echo $data["BFG055"] ?> <? echo $data["BFG056"] ?> <? echo $data["BFG057"] ?> <? echo $data["BFG058"] ?> <? echo $data["BFG059"] ?> <? echo $data["BFG060"] ?> <? echo $data["BFG061"] ?> <? echo $data["BFG062"] ?> <? echo $data["BFG063"] ?> <? echo $data["BFG064"] ?> <? echo $data["BFG065"] ?> <? echo $data["BFG066"] ?> <? echo $data["BFG067"] ?> <? echo $data["BFG068"] ?> <? echo $data["BFG069"] ?> <? echo $data["BFG070"] ?> <? echo $data["BFG071"] ?> <? echo $data["BFG072"] ?> <? echo $data["BFG073"] ?> <? echo $data["BFG074"] ?> <? echo $data["BFG075"] ?> <? echo $data["BFG076"] ?> <? echo $data["BFG077"] ?> <? echo $data["BFG078"] ?> <? echo $data["BFG079"] ?> <? echo $data["BFG080"] ?> <? echo $data["BFG081"] ?> <? echo $data["BFG082"] ?> <? echo $data["BFG083"] ?> <? echo $data["BFG084"] ?> <? echo $data["BFG085"] ?> <? echo $data["BFG086"] ?> <? echo $data["BFG087"] ?> <? echo $data["BFG088"] ?> <? echo $data["BFG089"] ?> <? echo $data["BFG090"] ?> <? echo $data["BFG091"] ?> <? echo $data["BFG092"] ?> <? echo $data["BFG093"] ?> <? echo $data["BFG094"] ?> <? echo $data["BFG095"] ?> <? echo $data["BFG096"] ?> <? echo $data["BFG097"] ?> <? echo $data["BFG098"] ?> <? echo $data["BFG099"] ?> <? echo $data["BFG100"] ?> <? echo $data["BFG101"] ?> <? echo $data["BFG102"] ?> <? echo $data["BFG103"] ?> <? echo $data["BFG104"] ?></STRONG></FONT></P></blockquote></TD><TD WIDTH="20%" ALIGN="CENTER" BGCOLOR="#ffffff"><A HREF="http://www.happychild.org.uk/gridbuilding/chemistry/AZ/index.htm#<? echo $data["itemfileref"] ?>"><FONT FACE="Arial" SIZE="-2" COLOR="#000000"><STRONG>CHEMISTRY A-Z<BR><? echo $data["itemlc"] ?></STRONG></FONT></A></TD><TR><TD WIDTH="20%" ALIGN="CENTER" BGCOLOR="#ffffff"><A HREF="http://www.happychild.org.uk/gridbuilding/science/AZ/index.htm#<? echo $data["clusterref"] ?>"><FONT FACE="Arial" SIZE="-2" COLOR="#000000"><STRONG>SCIENCE A-Z<BR>cluster: <? echo $data["clusterlc"] ?></STRONG></FONT></A></TD></TD><TD WIDTH="20%" ALIGN="CENTER" BGCOLOR="#ffffff"><A HREF="http://www.happychild.org.uk/gridbuilding/chemistry/AZ/index.htm#<? echo $data["clusterref"] ?>"><FONT FACE="Arial" SIZE="-2" COLOR="#000000"><STRONG>CHEMISTRY A-Z<BR>cluster: <? echo $data["clusterlc"] ?></STRONG></FONT></A></TD></TD></TABLE></CENTER><BR><?php$SQL="SELECT * FROM azchem0003";$result = mysql_query("Select * from azchem0003 where number='113'");$data = mysql_fetch_array($result);?><A NAME="<? echo $data["clusterref"] ?>"></A><CENTER><TABLE BGCOLOR="#e2e2e2" ALIGN="CENTER" BORDER="5" WIDTH="100%" CELLPADDING="2" CELLSPACING="4"><TR><TD WIDTH="20%" ALIGN="CENTER" BGCOLOR="#ffffff"><A HREF="http://www.happychild.org.uk/gridbuilding/science/AZ/index.htm#<? echo $data["itemfileref"] ?>"><FONT FACE="Arial" SIZE="-2" COLOR="#000000"><STRONG>SCIENCE A-Z<BR><? echo $data["itemlc"] ?></STRONG></FONT></A></TD><TD ROWSPAN="2" WIDTH="60%" ALIGN="CENTER" BGCOLOR="#ffffff"><blockquote><P ALIGN="JUSTIFY"><FONT FACE="Comic Sans MS" SIZE="-1" COLOR="#000000"><STRONG><BR><? echo $data["BFG001"] ?> <? echo $data["BFG002"] ?> <? echo $data["BFG003"] ?> <? echo $data["BFG004"] ?> <? echo $data["BFG005"] ?> <? echo $data["BFG006"] ?> <? echo $data["BFG007"] ?> <? echo $data["BFG008"] ?> <? echo $data["BFG009"] ?> <? echo $data["BFG010"] ?> <? echo $data["BFG011"] ?> <? echo $data["BFG012"] ?> <? echo $data["BFG013"] ?> <? echo $data["BFG014"] ?> <? echo $data["BFG015"] ?> <? echo $data["BFG016"] ?> <? echo $data["BFG017"] ?> <? echo $data["BFG018"] ?> <? echo $data["BFG019"] ?> <? echo $data["BFG020"] ?> <? echo $data["BFG021"] ?> <? echo $data["BFG022"] ?> <? echo $data["BFG023"] ?> <? echo $data["BFG024"] ?> <? echo $data["BFG025"] ?> <? echo $data["BFG026"] ?> <? echo $data["BFG027"] ?> <? echo $data["BFG028"] ?> <? echo $data["BFG029"] ?> <? echo $data["BFG030"] ?> <? echo $data["BFG031"] ?> <? echo $data["BFG032"] ?> <? echo $data["BFG033"] ?> <? echo $data["BFG034"] ?> <? echo $data["BFG035"] ?> <? echo $data["BFG036"] ?> <? echo $data["BFG037"] ?> <? echo $data["BFG038"] ?> <? echo $data["BFG039"] ?> <? echo $data["BFG040"] ?> <? echo $data["BFG041"] ?> <? echo $data["BFG042"] ?> <? echo $data["BFG043"] ?> <? echo $data["BFG044"] ?> <? echo $data["BFG045"] ?> <? echo $data["BFG046"] ?> <? echo $data["BFG047"] ?> <? echo $data["BFG048"] ?> <? echo $data["BFG049"] ?> <? echo $data["BFG050"] ?> <? echo $data["BFG051"] ?> <? echo $data["BFG052"] ?> <? echo $data["BFG053"] ?> <? echo $data["BFG054"] ?> <? echo $data["BFG055"] ?> <? echo $data["BFG056"] ?> <? echo $data["BFG057"] ?> <? echo $data["BFG058"] ?> <? echo $data["BFG059"] ?> <? echo $data["BFG060"] ?> <? echo $data["BFG061"] ?> <? echo $data["BFG062"] ?> <? echo $data["BFG063"] ?> <? echo $data["BFG064"] ?> <? echo $data["BFG065"] ?> <? echo $data["BFG066"] ?> <? echo $data["BFG067"] ?> <? echo $data["BFG068"] ?> <? echo $data["BFG069"] ?> <? echo $data["BFG070"] ?> <? echo $data["BFG071"] ?> <? echo $data["BFG072"] ?> <? echo $data["BFG073"] ?> <? echo $data["BFG074"] ?> <? echo $data["BFG075"] ?> <? echo $data["BFG076"] ?> <? echo $data["BFG077"] ?> <? echo $data["BFG078"] ?> <? echo $data["BFG079"] ?> <? echo $data["BFG080"] ?> <? echo $data["BFG081"] ?> <? echo $data["BFG082"] ?> <? echo $data["BFG083"] ?> <? echo $data["BFG084"] ?> <? echo $data["BFG085"] ?> <? echo $data["BFG086"] ?> <? echo $data["BFG087"] ?> <? echo $data["BFG088"] ?> <? echo $data["BFG089"] ?> <? echo $data["BFG090"] ?> <? echo $data["BFG091"] ?> <? echo $data["BFG092"] ?> <? echo $data["BFG093"] ?> <? echo $data["BFG094"] ?> <? echo $data["BFG095"] ?> <? echo $data["BFG096"] ?> <? echo $data["BFG097"] ?> <? echo $data["BFG098"] ?> <? echo $data["BFG099"] ?> <? echo $data["BFG100"] ?> <? echo $data["BFG101"] ?> <? echo $data["BFG102"] ?> <? echo $data["BFG103"] ?> <? echo $data["BFG104"] ?></STRONG></FONT></P></blockquote></TD><TD WIDTH="20%" ALIGN="CENTER" BGCOLOR="#ffffff"><A HREF="http://www.happychild.org.uk/gridbuilding/chemistry/AZ/index.htm#<? echo $data["itemfileref"] ?>"><FONT FACE="Arial" SIZE="-2" COLOR="#000000"><STRONG>CHEMISTRY A-Z<BR><? echo $data["itemlc"] ?></STRONG></FONT></A></TD><TR><TD WIDTH="20%" ALIGN="CENTER" BGCOLOR="#ffffff"><A HREF="http://www.happychild.org.uk/gridbuilding/science/AZ/index.htm#<? echo $data["clusterref"] ?>"><FONT FACE="Arial" SIZE="-2" COLOR="#000000"><STRONG>SCIENCE A-Z<BR>cluster: <? echo $data["clusterlc"] ?></STRONG></FONT></A></TD></TD><TD WIDTH="20%" ALIGN="CENTER" BGCOLOR="#ffffff"><A HREF="http://www.happychild.org.uk/gridbuilding/chemistry/AZ/index.htm#<? echo $data["clusterref"] ?>"><FONT FACE="Arial" SIZE="-2" COLOR="#000000"><STRONG>CHEMISTRY A-Z<BR>cluster: <? echo $data["clusterlc"] ?></STRONG></FONT></A></TD></TD></TABLE></CENTER><BR><?php$SQL="SELECT * FROM azchem0003";$result = mysql_query("Select * from azchem0003 where number='114'");$data = mysql_fetch_array($result);?><A NAME="<? echo $data["clusterref"] ?>"></A><CENTER><TABLE BGCOLOR="#e2e2e2" ALIGN="CENTER" BORDER="5" WIDTH="100%" CELLPADDING="2" CELLSPACING="4"><TR><TD WIDTH="20%" ALIGN="CENTER" BGCOLOR="#ffffff"><A HREF="http://www.happychild.org.uk/gridbuilding/science/AZ/index.htm#<? echo $data["itemfileref"] ?>"><FONT FACE="Arial" SIZE="-2" COLOR="#000000"><STRONG>SCIENCE A-Z<BR><? echo $data["itemlc"] ?></STRONG></FONT></A></TD><TD ROWSPAN="2" WIDTH="60%" ALIGN="CENTER" BGCOLOR="#ffffff"><blockquote><P ALIGN="JUSTIFY"><FONT FACE="Comic Sans MS" SIZE="-1" COLOR="#000000"><STRONG><BR><? echo $data["BFG001"] ?> <? echo $data["BFG002"] ?> <? echo $data["BFG003"] ?> <? echo $data["BFG004"] ?> <? echo $data["BFG005"] ?> <? echo $data["BFG006"] ?> <? echo $data["BFG007"] ?> <? echo $data["BFG008"] ?> <? echo $data["BFG009"] ?> <? echo $data["BFG010"] ?> <? echo $data["BFG011"] ?> <? echo $data["BFG012"] ?> <? echo $data["BFG013"] ?> <? echo $data["BFG014"] ?> <? echo $data["BFG015"] ?> <? echo $data["BFG016"] ?> <? echo $data["BFG017"] ?> <? echo $data["BFG018"] ?> <? echo $data["BFG019"] ?> <? echo $data["BFG020"] ?> <? echo $data["BFG021"] ?> <? echo $data["BFG022"] ?> <? echo $data["BFG023"] ?> <? echo $data["BFG024"] ?> <? echo $data["BFG025"] ?> <? echo $data["BFG026"] ?> <? echo $data["BFG027"] ?> <? echo $data["BFG028"] ?> <? echo $data["BFG029"] ?> <? echo $data["BFG030"] ?> <? echo $data["BFG031"] ?> <? echo $data["BFG032"] ?> <? echo $data["BFG033"] ?> <? echo $data["BFG034"] ?> <? echo $data["BFG035"] ?> <? echo $data["BFG036"] ?> <? echo $data["BFG037"] ?> <? echo $data["BFG038"] ?> <? echo $data["BFG039"] ?> <? echo $data["BFG040"] ?> <? echo $data["BFG041"] ?> <? echo $data["BFG042"] ?> <? echo $data["BFG043"] ?> <? echo $data["BFG044"] ?> <? echo $data["BFG045"] ?> <? echo $data["BFG046"] ?> <? echo $data["BFG047"] ?> <? echo $data["BFG048"] ?> <? echo $data["BFG049"] ?> <? echo $data["BFG050"] ?> <? echo $data["BFG051"] ?> <? echo $data["BFG052"] ?> <? echo $data["BFG053"] ?> <? echo $data["BFG054"] ?> <? echo $data["BFG055"] ?> <? echo $data["BFG056"] ?> <? echo $data["BFG057"] ?> <? echo $data["BFG058"] ?> <? echo $data["BFG059"] ?> <? echo $data["BFG060"] ?> <? echo $data["BFG061"] ?> <? echo $data["BFG062"] ?> <? echo $data["BFG063"] ?> <? echo $data["BFG064"] ?> <? echo $data["BFG065"] ?> <? echo $data["BFG066"] ?> <? echo $data["BFG067"] ?> <? echo $data["BFG068"] ?> <? echo $data["BFG069"] ?> <? echo $data["BFG070"] ?> <? echo $data["BFG071"] ?> <? echo $data["BFG072"] ?> <? echo $data["BFG073"] ?> <? echo $data["BFG074"] ?> <? echo $data["BFG075"] ?> <? echo $data["BFG076"] ?> <? echo $data["BFG077"] ?> <? echo $data["BFG078"] ?> <? echo $data["BFG079"] ?> <? echo $data["BFG080"] ?> <? echo $data["BFG081"] ?> <? echo $data["BFG082"] ?> <? echo $data["BFG083"] ?> <? echo $data["BFG084"] ?> <? echo $data["BFG085"] ?> <? echo $data["BFG086"] ?> <? echo $data["BFG087"] ?> <? echo $data["BFG088"] ?> <? echo $data["BFG089"] ?> <? echo $data["BFG090"] ?> <? echo $data["BFG091"] ?> <? echo $data["BFG092"] ?> <? echo $data["BFG093"] ?> <? echo $data["BFG094"] ?> <? echo $data["BFG095"] ?> <? echo $data["BFG096"] ?> <? echo $data["BFG097"] ?> <? echo $data["BFG098"] ?> <? echo $data["BFG099"] ?> <? echo $data["BFG100"] ?> <? echo $data["BFG101"] ?> <? echo $data["BFG102"] ?> <? echo $data["BFG103"] ?> <? echo $data["BFG104"] ?></STRONG></FONT></P></blockquote></TD><TD WIDTH="20%" ALIGN="CENTER" BGCOLOR="#ffffff"><A HREF="http://www.happychild.org.uk/gridbuilding/chemistry/AZ/index.htm#<? echo $data["itemfileref"] ?>"><FONT FACE="Arial" SIZE="-2" COLOR="#000000"><STRONG>CHEMISTRY A-Z<BR><? echo $data["itemlc"] ?></STRONG></FONT></A></TD><TR><TD WIDTH="20%" ALIGN="CENTER" BGCOLOR="#ffffff"><A HREF="http://www.happychild.org.uk/gridbuilding/science/AZ/index.htm#<? echo $data["clusterref"] ?>"><FONT FACE="Arial" SIZE="-2" COLOR="#000000"><STRONG>SCIENCE A-Z<BR>cluster: <? echo $data["clusterlc"] ?></STRONG></FONT></A></TD></TD><TD WIDTH="20%" ALIGN="CENTER" BGCOLOR="#ffffff"><A HREF="http://www.happychild.org.uk/gridbuilding/chemistry/AZ/index.htm#<? echo $data["clusterref"] ?>"><FONT FACE="Arial" SIZE="-2" COLOR="#000000"><STRONG>CHEMISTRY A-Z<BR>cluster: <? echo $data["clusterlc"] ?></STRONG></FONT></A></TD></TD></TABLE></CENTER><BR><?php$SQL="SELECT * FROM azchem0003";$result = mysql_query("Select * from azchem0003 where number='115'");$data = mysql_fetch_array($result);?><A NAME="<? echo $data["clusterref"] ?>"></A><CENTER><TABLE BGCOLOR="#e2e2e2" ALIGN="CENTER" BORDER="5" WIDTH="100%" CELLPADDING="2" CELLSPACING="4"><TR><TD WIDTH="20%" ALIGN="CENTER" BGCOLOR="#ffffff"><A HREF="http://www.happychild.org.uk/gridbuilding/science/AZ/index.htm#<? echo $data["itemfileref"] ?>"><FONT FACE="Arial" SIZE="-2" COLOR="#000000"><STRONG>SCIENCE A-Z<BR><? echo $data["itemlc"] ?></STRONG></FONT></A></TD><TD ROWSPAN="2" WIDTH="60%" ALIGN="CENTER" BGCOLOR="#ffffff"><blockquote><P ALIGN="JUSTIFY"><FONT FACE="Comic Sans MS" SIZE="-1" COLOR="#000000"><STRONG><BR><? echo $data["BFG001"] ?> <? echo $data["BFG002"] ?> <? echo $data["BFG003"] ?> <? echo $data["BFG004"] ?> <? echo $data["BFG005"] ?> <? echo $data["BFG006"] ?> <? echo $data["BFG007"] ?> <? echo $data["BFG008"] ?> <? echo $data["BFG009"] ?> <? echo $data["BFG010"] ?> <? echo $data["BFG011"] ?> <? echo $data["BFG012"] ?> <? echo $data["BFG013"] ?> <? echo $data["BFG014"] ?> <? echo $data["BFG015"] ?> <? echo $data["BFG016"] ?> <? echo $data["BFG017"] ?> <? echo $data["BFG018"] ?> <? echo $data["BFG019"] ?> <? echo $data["BFG020"] ?> <? echo $data["BFG021"] ?> <? echo $data["BFG022"] ?> <? echo $data["BFG023"] ?> <? echo $data["BFG024"] ?> <? echo $data["BFG025"] ?> <? echo $data["BFG026"] ?> <? echo $data["BFG027"] ?> <? echo $data["BFG028"] ?> <? echo $data["BFG029"] ?> <? echo $data["BFG030"] ?> <? echo $data["BFG031"] ?> <? echo $data["BFG032"] ?> <? echo $data["BFG033"] ?> <? echo $data["BFG034"] ?> <? echo $data["BFG035"] ?> <? echo $data["BFG036"] ?> <? echo $data["BFG037"] ?> <? echo $data["BFG038"] ?> <? echo $data["BFG039"] ?> <? echo $data["BFG040"] ?> <? echo $data["BFG041"] ?> <? echo $data["BFG042"] ?> <? echo $data["BFG043"] ?> <? echo $data["BFG044"] ?> <? echo $data["BFG045"] ?> <? echo $data["BFG046"] ?> <? echo $data["BFG047"] ?> <? echo $data["BFG048"] ?> <? echo $data["BFG049"] ?> <? echo $data["BFG050"] ?> <? echo $data["BFG051"] ?> <? echo $data["BFG052"] ?> <? echo $data["BFG053"] ?> <? echo $data["BFG054"] ?> <? echo $data["BFG055"] ?> <? echo $data["BFG056"] ?> <? echo $data["BFG057"] ?> <? echo $data["BFG058"] ?> <? echo $data["BFG059"] ?> <? echo $data["BFG060"] ?> <? echo $data["BFG061"] ?> <? echo $data["BFG062"] ?> <? echo $data["BFG063"] ?> <? echo $data["BFG064"] ?> <? echo $data["BFG065"] ?> <? echo $data["BFG066"] ?> <? echo $data["BFG067"] ?> <? echo $data["BFG068"] ?> <? echo $data["BFG069"] ?> <? echo $data["BFG070"] ?> <? echo $data["BFG071"] ?> <? echo $data["BFG072"] ?> <? echo $data["BFG073"] ?> <? echo $data["BFG074"] ?> <? echo $data["BFG075"] ?> <? echo $data["BFG076"] ?> <? echo $data["BFG077"] ?> <? echo $data["BFG078"] ?> <? echo $data["BFG079"] ?> <? echo $data["BFG080"] ?> <? echo $data["BFG081"] ?> <? echo $data["BFG082"] ?> <? echo $data["BFG083"] ?> <? echo $data["BFG084"] ?> <? echo $data["BFG085"] ?> <? echo $data["BFG086"] ?> <? echo $data["BFG087"] ?> <? echo $data["BFG088"] ?> <? echo $data["BFG089"] ?> <? echo $data["BFG090"] ?> <? echo $data["BFG091"] ?> <? echo $data["BFG092"] ?> <? echo $data["BFG093"] ?> <? echo $data["BFG094"] ?> <? echo $data["BFG095"] ?> <? echo $data["BFG096"] ?> <? echo $data["BFG097"] ?> <? echo $data["BFG098"] ?> <? echo $data["BFG099"] ?> <? echo $data["BFG100"] ?> <? echo $data["BFG101"] ?> <? echo $data["BFG102"] ?> <? echo $data["BFG103"] ?> <? echo $data["BFG104"] ?></STRONG></FONT></P></blockquote></TD><TD WIDTH="20%" ALIGN="CENTER" BGCOLOR="#ffffff"><A HREF="http://www.happychild.org.uk/gridbuilding/chemistry/AZ/index.htm#<? echo $data["itemfileref"] ?>"><FONT FACE="Arial" SIZE="-2" COLOR="#000000"><STRONG>CHEMISTRY A-Z<BR><? echo $data["itemlc"] ?></STRONG></FONT></A></TD><TR><TD WIDTH="20%" ALIGN="CENTER" BGCOLOR="#ffffff"><A HREF="http://www.happychild.org.uk/gridbuilding/science/AZ/index.htm#<? echo $data["clusterref"] ?>"><FONT FACE="Arial" SIZE="-2" COLOR="#000000"><STRONG>SCIENCE A-Z<BR>cluster: <? echo $data["clusterlc"] ?></STRONG></FONT></A></TD></TD><TD WIDTH="20%" ALIGN="CENTER" BGCOLOR="#ffffff"><A HREF="http://www.happychild.org.uk/gridbuilding/chemistry/AZ/index.htm#<? echo $data["clusterref"] ?>"><FONT FACE="Arial" SIZE="-2" COLOR="#000000"><STRONG>CHEMISTRY A-Z<BR>cluster: <? echo $data["clusterlc"] ?></STRONG></FONT></A></TD></TD></TABLE></CENTER><BR><?php$SQL="SELECT * FROM azchem0003";$result = mysql_query("Select * from azchem0003 where number='zzz'");$data = mysql_fetch_array($result);?><A NAME="<? echo $data["clusterref"] ?>"></A><CENTER><TABLE BGCOLOR="#e2e2e2" ALIGN="CENTER" BORDER="5" WIDTH="100%" CELLPADDING="2" CELLSPACING="4"><TR><TD WIDTH="20%" ALIGN="CENTER" BGCOLOR="#ffffff"><A HREF="http://www.happychild.org.uk/gridbuilding/science/AZ/index.htm#<? echo $data["itemfileref"] ?>"><FONT FACE="Arial" SIZE="-2" COLOR="#000000"><STRONG>SCIENCE A-Z<BR><? echo $data["itemlc"] ?></STRONG></FONT></A></TD><TD ROWSPAN="2" WIDTH="60%" ALIGN="CENTER" BGCOLOR="#ffffff"><blockquote><P ALIGN="JUSTIFY"><FONT FACE="Comic Sans MS" SIZE="-1" COLOR="#000000"><STRONG><BR><? echo $data["BFG001"] ?> <? echo $data["BFG002"] ?> <? echo $data["BFG003"] ?> <? echo $data["BFG004"] ?> <? echo $data["BFG005"] ?> <? echo $data["BFG006"] ?> <? echo $data["BFG007"] ?> <? echo $data["BFG008"] ?> <? echo $data["BFG009"] ?> <? echo $data["BFG010"] ?> <? echo $data["BFG011"] ?> <? echo $data["BFG012"] ?> <? echo $data["BFG013"] ?> <? echo $data["BFG014"] ?> <? echo $data["BFG015"] ?> <? echo $data["BFG016"] ?> <? echo $data["BFG017"] ?> <? echo $data["BFG018"] ?> <? echo $data["BFG019"] ?> <? echo $data["BFG020"] ?> <? echo $data["BFG021"] ?> <? echo $data["BFG022"] ?> <? echo $data["BFG023"] ?> <? echo $data["BFG024"] ?> <? echo $data["BFG025"] ?> <? echo $data["BFG026"] ?> <? echo $data["BFG027"] ?> <? echo $data["BFG028"] ?> <? echo $data["BFG029"] ?> <? echo $data["BFG030"] ?> <? echo $data["BFG031"] ?> <? echo $data["BFG032"] ?> <? echo $data["BFG033"] ?> <? echo $data["BFG034"] ?> <? echo $data["BFG035"] ?> <? echo $data["BFG036"] ?> <? echo $data["BFG037"] ?> <? echo $data["BFG038"] ?> <? echo $data["BFG039"] ?> <? echo $data["BFG040"] ?> <? echo $data["BFG041"] ?> <? echo $data["BFG042"] ?> <? echo $data["BFG043"] ?> <? echo $data["BFG044"] ?> <? echo $data["BFG045"] ?> <? echo $data["BFG046"] ?> <? echo $data["BFG047"] ?> <? echo $data["BFG048"] ?> <? echo $data["BFG049"] ?> <? echo $data["BFG050"] ?> <? echo $data["BFG051"] ?> <? echo $data["BFG052"] ?> <? echo $data["BFG053"] ?> <? echo $data["BFG054"] ?> <? echo $data["BFG055"] ?> <? echo $data["BFG056"] ?> <? echo $data["BFG057"] ?> <? echo $data["BFG058"] ?> <? echo $data["BFG059"] ?> <? echo $data["BFG060"] ?> <? echo $data["BFG061"] ?> <? echo $data["BFG062"] ?> <? echo $data["BFG063"] ?> <? echo $data["BFG064"] ?> <? echo $data["BFG065"] ?> <? echo $data["BFG066"] ?> <? echo $data["BFG067"] ?> <? echo $data["BFG068"] ?> <? echo $data["BFG069"] ?> <? echo $data["BFG070"] ?> <? echo $data["BFG071"] ?> <? echo $data["BFG072"] ?> <? echo $data["BFG073"] ?> <? echo $data["BFG074"] ?> <? echo $data["BFG075"] ?> <? echo $data["BFG076"] ?> <? echo $data["BFG077"] ?> <? echo $data["BFG078"] ?> <? echo $data["BFG079"] ?> <? echo $data["BFG080"] ?> <? echo $data["BFG081"] ?> <? echo $data["BFG082"] ?> <? echo $data["BFG083"] ?> <? echo $data["BFG084"] ?> <? echo $data["BFG085"] ?> <? echo $data["BFG086"] ?> <? echo $data["BFG087"] ?> <? echo $data["BFG088"] ?> <? echo $data["BFG089"] ?> <? echo $data["BFG090"] ?> <? echo $data["BFG091"] ?> <? echo $data["BFG092"] ?> <? echo $data["BFG093"] ?> <? echo $data["BFG094"] ?> <? echo $data["BFG095"] ?> <? echo $data["BFG096"] ?> <? echo $data["BFG097"] ?> <? echo $data["BFG098"] ?> <? echo $data["BFG099"] ?> <? echo $data["BFG100"] ?> <? echo $data["BFG101"] ?> <? echo $data["BFG102"] ?> <? echo $data["BFG103"] ?> <? echo $data["BFG104"] ?></STRONG></FONT></P></blockquote></TD><TD WIDTH="20%" ALIGN="CENTER" BGCOLOR="#ffffff"><A HREF="http://www.happychild.org.uk/gridbuilding/chemistry/AZ/index.htm#<? echo $data["itemfileref"] ?>"><FONT FACE="Arial" SIZE="-2" COLOR="#000000"><STRONG>CHEMISTRY A-Z<BR><? echo $data["itemlc"] ?></STRONG></FONT></A></TD><TR><TD WIDTH="20%" ALIGN="CENTER" BGCOLOR="#ffffff"><A HREF="http://www.happychild.org.uk/gridbuilding/science/AZ/index.htm#<? echo $data["clusterref"] ?>"><FONT FACE="Arial" SIZE="-2" COLOR="#000000"><STRONG>SCIENCE A-Z<BR>cluster: <? echo $data["clusterlc"] ?></STRONG></FONT></A></TD></TD><TD WIDTH="20%" ALIGN="CENTER" BGCOLOR="#ffffff"><A HREF="http://www.happychild.org.uk/gridbuilding/chemistry/AZ/index.htm#<? echo $data["clusterref"] ?>"><FONT FACE="Arial" SIZE="-2" COLOR="#000000"><STRONG>CHEMISTRY A-Z<BR>cluster: <? echo $data["clusterlc"] ?></STRONG></FONT></A></TD></TD></TABLE></CENTER><BR><FONT FACE="Arial" SIZE="-2"><BR></FONT><FONT FACE="Arial" SIZE="-2"><BR></FONT><CENTER><TABLE BGCOLOR="#e2e2e2" ALIGN="CENTER" BORDER="2" WIDTH="100%" CELLPADDING="2" CELLSPACING="2"><TR><TD WIDTH="10%" ALIGN="CENTER" BGCOLOR="#d3ccd6"><FONT FACE="Arial" SIZE="-2" COLOR="#808080"><STRONG><A HREF="http://www.happychild.org.uk/gridbuilding/biology/index.htm">biology</A></STRONG></FONT></TD><TD WIDTH="10%" ALIGN="CENTER" BGCOLOR="#ffffff"><FONT FACE="Arial" SIZE="-2" COLOR="#808080"><STRONG><A HREF="http://www.happychild.org.uk/gridbuilding/physics/index.htm">physics</A></STRONG></FONT></TD><TD WIDTH="10%" ALIGN="CENTER" BGCOLOR="#d3ccd6"><FONT FACE="Arial" SIZE="-2" COLOR="#808080"><STRONG><A HREF="http://www.happychild.org.uk/gridbuilding/chemistry/index.htm">chemistry</A></STRONG></FONT></TD><TD WIDTH="17%" ALIGN="CENTER" BGCOLOR="#ffffff"><FONT FACE="Arial" SIZE="-2" COLOR="#808080"><STRONG><A HREF="http://www.happychild.org.uk/gridbuilding/chemistry/AZ/index.htm">A-Z Chemistry</A></STRONG></FONT></TD><TD WIDTH="17%" ALIGN="CENTER" BGCOLOR="#d3ccd6"><FONT FACE="Arial" SIZE="-2" COLOR="#808080"><STRONG><A HREF="http://www.happychild.org.uk/gridbuilding/chemistry/elements/AZ/index.htm">A-Z Elements</A></STRONG></FONT></TD><TD WIDTH="17%" ALIGN="CENTER" BGCOLOR="#ffffff"><FONT FACE="Arial" SIZE="-2" COLOR="#808080"><STRONG><A HREF="http://www.happychild.org.uk/gridbuilding/chemistry/periodictable/index.htm">periodic table</A></STRONG></FONT></TD><TD WIDTH="17%" ALIGN="CENTER" BGCOLOR="#d3ccd6"><FONT FACE="Arial" SIZE="-2" COLOR="#808080"><STRONG><A HREF="http://www.happychild.org.uk/gridbuilding/AZ/index.htm">A-Z Science</A></STRONG></FONT></TD></TR></TABLE></CENTER><BR><CENTER><TABLE BGCOLOR="#e2e2e2" ALIGN="CENTER" BORDER="2" WIDTH="100%" CELLPADDING="2" CELLSPACING="2"><TR><TD WIDTH="60%" ALIGN="CENTER" BGCOLOR="#ffffff"><FONT FACE="Arial" SIZE="-2" COLOR="#808080"><STRONG>Validation of content by Anne Evans B.Sc. - all pages under construction - see <A HREF="http://www.happychild.org.uk/gridbuilding/chemistry/index.htm">index</A>.</STRONG></FONT></TD><TD WIDTH="40%" ALIGN="CENTER" BGCOLOR="#ffffff"><FONT FACE="Arial" SIZE="-2" COLOR="#808080"><STRONG>Offers of free graphics appreciated - see <A HREF="http://www.happychild.org.uk/gridbuilding/chemistry/index.htm">index</A>.</STRONG></FONT></TD></TR></TABLE></CENTER><BR><?php$SQL="SELECT * FROM azchem0003";$result = mysql_query("Select * from azchem0003 where number='112'");$data = mysql_fetch_array($result);?><CENTER><TABLE BGCOLOR="#e2e2e2" ALIGN="CENTER" BORDER="3" WIDTH="100%" CELLPADDING="3" CELLSPACING="3"><TR><TD ALIGN="CENTER" BGCOLOR="#d3ccd8"><FONT FACE="Comic Sans MS" SIZE="-1"><STRONG>The Web address for this page is<A HREF="http://www.happychild.org.uk/gridbuilding/chemistry/<? echo $data["itemfileref"] ?>/index.htm">http://www.happychild.org.uk/gridbuilding/chemistry/<? echo $data["itemfileref"] ?>/index.htm</A></STRONG></FONT></TD></TR></TABLE></CENTER><BR><CENTER><TABLE BGCOLOR="#e2e2e2" ALIGN="CENTER" BORDER="3" WIDTH="100%" CELLPADDING="3" CELLSPACING="3"><TR><TD ALIGN="CENTER" BGCOLOR="#ffffff" WIDTH="20%"><A HREF="http://www.happychild.org.uk/pnrefer02.htm"><img src="http://www.happychild.org.uk/Webimage/f9plusnet01.jpg" align="bottom" border=0 alt="Force 9 webhosting - excellent deals on webspace"></A></TD><TD ALIGN="CENTER" BGCOLOR="#ffffff" WIDTH="20%"><A HREF="http://www.happychild.org.uk/disclaim.htm"><FONT FACE="Comic Sans MS" SIZE="-1" COLOR="#687a95"><STRONG>copyright</STRONG></FONT></A></TD><TD ALIGN="CENTER" BGCOLOR="#ffffff" WIDTH="20%"><FONT FACE="Comic Sans MS" SIZE="-2" COLOR="#000050"><STRONG><img src="http://ccgi.rollobks.force9.co.uk/cgi-bin/counter/count.pl?did=gridbuilding.<? echo $data["biol-chem-phys"] ?>.<? echo $data["itemfileref"] ?>" width="1" height="1" align="bottom" alt=""><A HREF="http://www.happychild.org.uk/pnrefer02.htm"><!-- begin: LiveCounter Classic CGI backup counter --><img src="http://ccgi.rollobks.force9.co.uk/cgi-bin/livecntr.pl?0+8" width="15" height="20" align="bottom" border=0 alt=""><img src="http://ccgi.rollobks.force9.co.uk/cgi-bin/livecntr.pl?1+8" width="15" height="20" align="bottom" border=0 alt=""><img src="http://ccgi.rollobks.force9.co.uk/cgi-bin/livecntr.pl?2+8" width="15" height="20" align="bottom" border=0 alt=""><img src="http://ccgi.rollobks.force9.co.uk/cgi-bin/livecntr.pl?3+8" width="15" height="20" align="bottom" border=0 alt=""><img src="http://ccgi.rollobks.force9.co.uk/cgi-bin/livecntr.pl?4+8" width="15" height="20" align="bottom" border=0 alt=""><img src="http://ccgi.rollobks.force9.co.uk/cgi-bin/livecntr.pl?5+8" width="15" height="20" align="bottom" border=0 alt=""><img src="http://ccgi.rollobks.force9.co.uk/cgi-bin/livecntr.pl?6+8" width="15" height="20" align="bottom" border=0 alt=""><img src="http://ccgi.rollobks.force9.co.uk/cgi-bin/livecntr.pl?7+8" width="15" height="20" align="bottom" border=0 alt=""><!-- end: LiveCounter Classic CGI backup counter --><img src="http://ccgi.rollobks.force9.co.uk/cgi-bin/freeway/livecntr.pl?h+9" border=0 width="2" height="2" alt=""><img src="http://ccgi.rollobks.force9.co.uk/cgi-bin/gridbuilding/livecntr.pl?h+9" border=0 width="2" height="2" alt=""><img src="http://ccgi.rollobks.force9.co.uk/cgi-bin/gridbuilding/chemistry/livecntr.pl?h+9" border=0 width="2" height="2" alt=""><img src="http://ccgi.rollobks.force9.co.uk/cgi-bin/gridbuilding/chemistry/<? echo $data["itemfileref"] ?>/livecntr.pl?h+9" border=0 width="2" height="2" alt=""></A></STRONG></FONT></TD><TD ALIGN="CENTER" BGCOLOR="#ffffff" WIDTH="20%"><A HREF="http://www.happychild.org.uk/pnrefer02.htm"><FONT FACE="Comic Sans MS" SIZE="-1" COLOR="#8f9db1"><STRONG>webmaster</STRONG></FONT></A></TD><TD ALIGN="CENTER" BGCOLOR="#ffffff" WIDTH="20%"><A HREF="http://www.happychild.org.uk/pnrefer02.htm"><img src="http://www.happychild.org.uk/Webimage/f9plusnet01.jpg" align="bottom" border=0 alt="Force 9 webhosting - excellent deals on webspace"></A></TD></TR></TABLE></CENTER><BR><CENTER><TABLE BGCOLOR="#e2e2e2" ALIGN="CENTER" BORDER="2" WIDTH="100%" CELLPADDING="2" CELLSPACING="2"><TR><TD ALIGN="CENTER" BGCOLOR="#d3ccd7"><FONT FACE="Arial" SIZE="-2"><STRONG>Design and layout of all pages at <A HREF="http://www.freeway.plus.com">FREEWAY</A> © Penny Midas Rollo 2000-2006 [<A HREF="http://www.freeway.plus.com/disclaim.htm">disclaimer</A>]. World rights reserved.</STRONG></FONT></TD></TR></TABLE></CENTER></BODY></HTML><?mysql_close($db);?>[/quote]Regards,Penny. Quote Link to comment Share on other sites More sharing options...
Penny_Rollo Posted November 9, 2006 Author Share Posted November 9, 2006 [quote author=mjdamato link=topic=113840.msg463730#msg463730 date=1162832823]The fact that data is showing up multiple times (especially with the sample code i provided) leads me to believe that there is another loop inside which the code we are working on exists. Can you post the code for the page in question in it's entirety? Hopefully it is not too massive.[/quote]Hi mjdamoto, did the code help you to figure out what the problem was?Regards,Penny. Quote Link to comment Share on other sites More sharing options...
Solution Psycho Posted November 9, 2006 Solution Share Posted November 9, 2006 No. It is a lot to go through. But, I can tell that there is a lot of unneeded code. For example the big sections where you are echoing out "<? echo $data["BFG002"] ?>" should be put in a function and called, when needed. And it makes no sense to go in and out of PHP code between those values.For example, you can reduce all of this:[quote]<? echo $data["BFG001"] ?> <? echo $data["BFG002"] ?> <? echo $data["BFG003"] ?> <? echo $data["BFG004"] ?> <? echo $data["BFG005"] ?> <? echo $data["BFG006"] ?> <? echo $data["BFG007"] ?> <? echo $data["BFG008"] ?> <? echo $data["BFG009"] ?> <? echo $data["BFG010"] ?> <? echo $data["BFG011"] ?> <? echo $data["BFG012"] ?> <? echo $data["BFG013"] ?> <? echo $data["BFG014"] ?> <? echo $data["BFG015"] ?> <? echo $data["BFG016"] ?> <? echo $data["BFG017"] ?> <? echo $data["BFG018"] ?> <? echo $data["BFG019"] ?> <? echo $data["BFG020"] ?> <? echo $data["BFG021"] ?> <? echo $data["BFG022"] ?> <? echo $data["BFG023"] ?> <? echo $data["BFG024"] ?> <? echo $data["BFG025"] ?> <? echo $data["BFG026"] ?> <? echo $data["BFG027"] ?> <? echo $data["BFG028"] ?> <? echo $data["BFG029"] ?> <? echo $data["BFG030"] ?> <? echo $data["BFG031"] ?> <? echo $data["BFG032"] ?> <? echo $data["BFG033"] ?> <? echo $data["BFG034"] ?> <? echo $data["BFG035"] ?> <? echo $data["BFG036"] ?> <? echo $data["BFG037"] ?> <? echo $data["BFG038"] ?> <? echo $data["BFG039"] ?> <? echo $data["BFG040"] ?> <? echo $data["BFG041"] ?> <? echo $data["BFG042"] ?> <? echo $data["BFG043"] ?> <? echo $data["BFG044"] ?> <? echo $data["BFG045"] ?> <? echo $data["BFG046"] ?> <? echo $data["BFG047"] ?> <? echo $data["BFG048"] ?> <? echo $data["BFG049"] ?> <? echo $data["BFG050"] ?> <? echo $data["BFG051"] ?> <? echo $data["BFG052"] ?> <? echo $data["BFG053"] ?> <? echo $data["BFG054"] ?> <? echo $data["BFG055"] ?> <? echo $data["BFG056"] ?> <? echo $data["BFG057"] ?> <? echo $data["BFG058"] ?> <? echo $data["BFG059"] ?> <? echo $data["BFG060"] ?> <? echo $data["BFG061"] ?> <? echo $data["BFG062"] ?> <? echo $data["BFG063"] ?> <? echo $data["BFG064"] ?> <? echo $data["BFG065"] ?> <? echo $data["BFG066"] ?> <? echo $data["BFG067"] ?> <? echo $data["BFG068"] ?> <? echo $data["BFG069"] ?> <? echo $data["BFG070"] ?> <? echo $data["BFG071"] ?> <? echo $data["BFG072"] ?> <? echo $data["BFG073"] ?> <? echo $data["BFG074"] ?> <? echo $data["BFG075"] ?> <? echo $data["BFG076"] ?> <? echo $data["BFG077"] ?> <? echo $data["BFG078"] ?> <? echo $data["BFG079"] ?> <? echo $data["BFG080"] ?> <? echo $data["BFG081"] ?> <? echo $data["BFG082"] ?> <? echo $data["BFG083"] ?> <? echo $data["BFG084"] ?> <? echo $data["BFG085"] ?> <? echo $data["BFG086"] ?> <? echo $data["BFG087"] ?> <? echo $data["BFG088"] ?> <? echo $data["BFG089"] ?> <? echo $data["BFG090"] ?> <? echo $data["BFG091"] ?> <? echo $data["BFG092"] ?> <? echo $data["BFG093"] ?> <? echo $data["BFG094"] ?> <? echo $data["BFG095"] ?> <? echo $data["BFG096"] ?> <? echo $data["BFG097"] ?> <? echo $data["BFG098"] ?> <? echo $data["BFG099"] ?> <? echo $data["BFG100"] ?> <? echo $data["BFG101"] ?> <? echo $data["BFG102"] ?> <? echo $data["BFG103"] ?> <? echo $data["BFG104"] ?>[/quote]To this:[code]<?phpfor ($i=1; $i<103; $i++) { $aryIdx = "BFG" . str_pad($i, 3, '0', STR_PAD_LEFT); echo " " . $data[$aryIdx];}?>[/code] Quote Link to comment Share on other sites More sharing options...
Penny_Rollo Posted November 10, 2006 Author Share Posted November 10, 2006 [quote author=mjdamato link=topic=113840.msg465533#msg465533 date=1163097297]No. It is a lot to go through. But, I can tell that there is a lot of unneeded code. For example the big sections where you are echoing out "<? echo $data["BFG002"] ?>" should be put in a function and called, when needed. And it makes no sense to go in and out of PHP code between those values.For example, you can reduce all of this:.... To this:[code]<?phpfor ($i=1; $i<103; $i++) { $aryIdx = "BFG" . str_pad($i, 3, '0', STR_PAD_LEFT); echo " " . $data[$aryIdx];}?>[/code][/quote]Thank you :D I have *no* idea how you wrote that [though maybe I'll figure it out the logic of it in due course, when I understand more about how all this works].I tried replacing the previous code (on a page which used all 104 boxes for one of the definitions) and it works fine - see http://ccgi.rollobks.force9.co.uk/shellsTESTnew01.php . For comparison there is the finished page (from the new run I did yesterday) at http://www.happychild.org.uk/gridbuilding/chemistry/shells/index.htm#electrons .I'm keenly aware that the code I write goes very much the-long-way-round but it takes (usually) so very long to discover the ways of doing things at all. For example I spent four hours the other night trying to fathom out how to get php pages with specific content to be created, for all the new itemfileref themes. Just couldn't find what I needed and ended up creating them manually, then the individual folders for each on my hard drive to contain the received html page after the individual conversion to static-html was done, then the change-of-name on each file (eg positivechargeindex.htm to an index.htm file within the positivecharge folder, positivechargeindex.htm having been called up singly from positivecharge.php by an individual call-up script). It's all very laborious! but I just have to work with whatever I'm capable of doing, at each stage, and trust that somehow I will discover ways to streamline the processes, along the way.Regarding the original question, and your answer, I was able to slightly adapt the code you gave me, that called up the positivecharge itemfileref rows, so as to call up the lines singly for each block. To achieve this I had to (a) have presorted the database by (a) itemfileref and (b) clusterref, and then go through and put 0001 to however many, in the first column (number) against each individual itemfileref block (eg there were five lines for positivecharge, so it would have had 0001 to 0005, as per the page at http://ccgi.rollobks.force9.co.uk/positivechargeTESTnew01.php ).The code I used was:[quote]<?php$SQL="SELECT * FROM azchem0008 WHERE itemfileref='positivecharge' AND number='0001'";$result = mysql_query($SQL);$data = mysql_fetch_array($result);?>[/quote](ie I was able to create all itemfileref pages with potential lines from 0001 - 0040, to cover present and future eventualities). It's still "a long way round"! and having to separately number the lines on the sorted db each time I run it takes a fair while, but *so* much quicker than having to put individual line numbers on each call-up page, each time, which I was having to do initially and the reason why I asked on these boards in the first place. So I really appreciate you having helped :)Regards,Penny. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.