Jump to content

aztec

Members
  • Posts

    100
  • Joined

  • Last visited

    Never

Everything posted by aztec

  1. I am testing out a new database and PhP to get information out of the 6 tables that make up the database. At the moment each table consists of 3 columns for testing purposes, id (auto inc), name and spouce_id (int). The names of the tables are gen_8, gen_8s, gen_9, gen_9s, gen_10 and gen_10s. The following code works but to me it looks very "messy" with 6 select calls for each page of information. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Weston 1 Test 1</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> </head> <body> <?php // Connect to the database server $dbcnx = @mysql_connect('localhost', 'root', ''); if (!$dbcnx) { exit('<p>Unable to connect to the ' . 'database server at this time.</p>'); } // Select the weston_1 database if (!@mysql_select_db('weston_1')) { exit('<p>Unable to locate the weston_1 ' . 'database at this time.</p>'); } ?> <p>Here are all the names requested from the database:</p> <blockquote> <?php // Request the names of the people requested $result = @mysql_query("SELECT name FROM gen_8 WHERE id = '1'"); $result2 = @mysql_query("SELECT name FROM gen_8s WHERE spouce_id = '1'"); $result3 = @mysql_query("SELECT name FROM gen_9 WHERE id = '1'"); $result4 = @mysql_query("SELECT name FROM gen_9s WHERE spouce_id = '1'"); $result5 = @mysql_query("SELECT name FROM gen_10 WHERE id = '1'"); $result6 = @mysql_query("SELECT name FROM gen_10s WHERE spouce_id = '1'"); if (!$result) { exit('<p>Error performing query: ' . mysql_error() . '</p>'); } // Display the text of each joke in a paragraph while ($row = mysql_fetch_array($result)) {echo '<p>' . $row['name'] . '</p>';} while ($row = mysql_fetch_array($result2)) {echo '<p>' . $row['name'] . '</p>';} while ($row = mysql_fetch_array($result3)) {echo '<p>' . $row['name'] . '</p>';} while ($row = mysql_fetch_array($result4)) {echo '<p>' . $row['name'] . '</p>';} while ($row = mysql_fetch_array($result5)) {echo '<p>' . $row['name'] . '</p>';} ?> </blockquote> </body> </html> Is it possible to reduce the number of calls to the database? I am sure that it is better to try to get the code correct at this stage rather than later with 20+ columns in each table. Any help or direction would be gladly taken on board Kind Regards
  2. Thanks mpc sorry to be late replying but I have just got online again Basically I want to be able to activate a search box which will allow users to enter a reference. The reference will be within the matdesc field. I then want it to go and find all records where the reference is within matdesc and return the rows (ie, showing matno, storedate and storageref) I hope this makes sense to you but because I do not use access it is cetainly a problem for me any help would be appreciated. Kind regards
  3. Hello I have been advised to move this post here by artacus, a forum helper. I need the equivalent of a stored proceedure in Access 97 and I do not use that programme but from research I do not think Access uses stored procedures at all, it creating a problem for me. In MySql I would write it as follows: [code] CREATE PROCEDURE dbo.ParagonArchiveRefs ( @matdesc nvarchar(20) ) AS select mastdesc, matno, storedate, storageref from paragon...matter where matdesc like @matdesc  [/code] Any help or direction appeciated Kind Regards
  4. Hello I do not know if this is the correct forum but because it is MySql and that is half the problem then here goes. Normally I use MySQL but I need a stored proceedure in Access 97 and I do not use that programme at all it creating a problem for me. In MySql I would write it as follows: [code] CREATE PROCEDURE dbo.ParagonArchiveRefs ( @matdesc nvarchar(20) ) AS select mastdesc, matno, storedate, storageref from paragon...matter where matdesc like @matdesc  [/code] Any help or direction appeciated Kind Regards
  5. No it as not been suggested, could I ask you to elaborate a little on what it can do etc, Regards
  6. The benifits I see to the user are that they will have a static page on the screen and I assume a faster refresh of data than if they loaded a static page. To crayonviolet each page will have 28 placeholders for data. I have thought through what I consider to be a reasonable page design for the template. Is there something other that I should be considering? Regards
  7. No Data will only change when the viewer clips on a link. I agree that you can change the data with PHP but I was of the opinion the it would also refresh the page. Because so many pages are the same except for the data I am trying to avoid this happening. Regards
  8. Certainly. It is a family history website and involves my own family plus the family history of 8 more families who married into my family. The site would be based on for example a family treemaker type presentation so that by clicking on one family member name his/her  datails would be updated together with their children and parents. There are about 6000 names to go into the database which I am inputing. Is there another way that I have not thought about to create the site? Regards
  9. Regarding page refresh. With some 950 pages out of about a 1000 being idendtical except for the data I considered that to just udate the data would be the best way. Plus then I would for example only have say 51 pages to the site.  Is there a better way? Regards
  10. Thanks for your input. Ober, from your reply I take that you would bite the bullet and use Ajax. Would you consider making any provision for non javascript users? (given the number of pages using js) other than telling people to turn on js, Regards
  11. Hello I posted yesterday in the Ajax forum and "tomfmason" provided me with some good advice and direction, but json is still javascript and can be turned off. I am creating a site with some 1000 pages and maybe 950 will be created from one template. Basically I need to update the data only and not the page for most of the time. I thought Ajax may be the answer untill it was pointed out to me that between 10% and 15% of people turn off Javascript. Is there another language that cannot be turned off that can update the webpage without reloading? or is there a technique that can be used with say, PHP or other language that can do the same thing, update the data without a refresh. I am doing as much research as possible between breaks from the boring stuff of inputting data into a MySQL database. Kind Regards
  12. Thank you for your input "tomfmason". I have had a look at json as you suggested and it would appear that it would/may be easier for a newbie, but the problem would be the same i.e. clients turning off javascript. I think what you said made a lot of sense in not relying too heavily on a technique that can be scuppered by the client. I take that when you impliment a little javascript you accommodate for those clients that have it turned off. I think on the basis of what you said I will try to find an alternative method that is basically client proof, if that is possible. Kind Regards
  13. I am creating a website that would have about 1000 pages of information. At the moment I have created a Relational Database in MySQL and am inputing the data. I have created a test page and tested out the database on my computer using Apache, PHP and MySQL installed via XAMPP. Of the 1000 pages about 950 would be created from one template because only the data displayed would change. Now I have found Ajax. So my questions are should I in the opinion of the programming experts: learn Ajax from scratch (I do not have any knowledge of Javascipts or Ajax) would the time lag be justified by increased functionality Any constructive comments or sugestions please of the route to follow. Kind Regards
  14. I use a little bit of Javascript on one of my sites as follows: <p><center> <a href="#" onClick="history.go(-1)"></a> <input type=button value="Return" onClick="history.go(-1)"> </center><p> While you can use the back arrow as jesiroe says on occasions this little script tidies things up and places a button on the page named Return.
  15. I started by using the tutorials I could find on the Web then came across this forum together with the tutorials which in my opinion are among the best available. I then installed XAMPP and startted to practise my "programming skills", I found that I needed something else to guide me and that is when I found the book that Thorpe suggested. I am still very much a learner but putting it all together and asking of this forum only questions that are specific to a problem you encounter certainly worked for me, however you must put in the time programming and making mistakes so that you can learn from them. Best of luck
  16. Thanks for your input, now I know it can be done I will get to work on it and see how far I can get. I may need your offer of help later Kind Regards
  17. Hello I have seached all of the forums on PHP Freaks to try to find the answer to the following question. Is it possible to turn a name returned from MySQL into a link so the veiwer can click the link to go to another page, or do I need to find a different way to insert the links I need. From what I have read it maybe a combinination of PHP, CSS and HTML may be needed if this can be achieved, I am not even sure if this post is in the correct section or not. Any help or guidance would be gratefully received even if it says it cannot be done. Kind Regards
  18. I needed to install Apache, PHP and MySQL on my Laptop and used XAMPP, to date it works fine
  19. Hello I am still learning PHP but I have found a way to transfer Access database info into MySQL. Use MySQL tools which include a utility to transfer info from one database to another. Best of luck
  20. Thanks to you all, your input certainly helps. I'll get to work on this and see what I can do then I may need to get back to you again. Regards
  21. Thanks for your input I can get my head around most of it.  All of the records have a ID and all the names info is linked in the database.  What I cannot see is when I display the info ie "John Doe" would that become clickable automatically, if it does I am afaid I cannot see how, but I am still learning. Regards
  22. Hello to the masters My dev setup is Apache,MySql and PHP.  I can get names from my database and display on my php page in a table, (that is what you say tables are for).  I then need to make each name displayed into a link to a page about that person. For example one of the 20 names returned and displyed is John Doe. I would like to be able to click on John Doe and it dislays all the info about him plus 19 more links.  I am sure it can be done but at this moment it is beyond my knowledge of PHP. My thanks in advance for any help given Thanks to taith for getting me stated
  23. Thank you very much taith for your quick responce, I can't say that I understand it completely but I am assuming that it means I can send queries without reloading the complete page. Regards
  24. Hello I have a static page website that I am converting to a dynamic site. There are 560 pages and over 500 use the same template.  All the information is included in each page, I can hear the groans from here but that was the only way I knew and it worked. Please forgive me I have now seen the light. I have a small test site running on the developement computer with Apache server, MySql and PHP5, the queries work. Being new to dynamic sites my question is. Do I have to create 560 pages each containing the style sheet and the query for each link on the page. It seems a waste to have a page loaded then having to reload the same page when all that is changing is 20 names from 3 tables in a database. Each of the names is a link to a different page at the moment. Is it possible to reset the containers on the display page and just make the link send a query or not. Gaining new knowledge also seems to create new problems to solve, but I will carry on. Kind Regards
×
×
  • 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.