Jump to content

aztec

Members
  • Posts

    100
  • Joined

  • Last visited

    Never

Everything posted by aztec

  1. Thanks for your input It is not what I want to do but it appears from the input it can be done. I want to pass an id number say id=1 to a standard php page ie index.php and place the id number into pagename. Then I want to use that id number in a mysql query. $a_result = @mysql_query("SELECT id,first_name, fid, mid FROM table_x where id= '$page' Where $page contains the id number. Is this part possible using PHP Regards
  2. Thanks That is more or less what I want to do. In particular I want to pass an ID number that could then be used to trigger a MySQL database search. Regards
  3. Hello Is it possible using PHP to call a new page with the HREF link, then passing a variable via the URL and inserting the variable into 'Page Name' of the new page called. Kind Regards
  4. Thanks fenway Having looked through and tried your code with only the table name changed it does indeed produce the data for the fid link. In it's present format the code lost some data but I am working on recoding to get it back. Am I right in thinking that the inner join produces a "virtual" table that can be searched. If this is correct then what fields would be in the "virtual" table. I know that these are basic questions but it would help me get a better understanding of the workings of joins. Kind Regards
  5. Thanks for your reply fenway. I am now searching for a way to implement your suggestion which is not easy never having used joins before. I have looked at the Manuel for an explanation of joins but at this time in my learning process it is beyond my comprehension. Is there "model code" that I could look at to help me understand what a self_join is and how to code it for my query. Kind Regards
  6. Hello I am using XAMPP 2.5.8 PHP 5.10 MySql 5.1.37 Apache 2.2.12 The following code with no error testing is used to test my database and returns the expected results. The $page for the test is hard coded. What I need to do is to use the "fid" data (which is a number and links to the id field) that is returned on the first row of the query to find another id and the associated data row. If it is possible can anyone please show me an example how this can be done. Kind Regards <?php // connect to database mysql_connect("localhost","USER","PW"); mysql_select_db("DB"); $page =1; $a_result = @mysql_query("SELECT id, first_name, surname, fid FROM TABLE WHERE id='$page' or link_to_spouse='$page' or fid= '$page' "); if ($a_result) { if (mysql_num_rows($a_result) > 0) { // here we loop through each member in the database while ($row = mysql_fetch_assoc($a_result)) { echo $row['id']; echo $row['first_name']; echo $row['surname']; } } } php?>
  7. Sorry Thorpe I must have forgot to engage brain when I got out of bed, but I just couldn't see it at all. I suppose it must be something to do with my age. Kind Regards
  8. Hello Thorpe Not having done this before could you give me a reference to a tutorial or an example I could start to work with. Kind Regards
  9. Hello I have a website that is hard coded and I have decided to make it database driven, the current site works fine but to keep it up-to-date requires a lot of work. I do not use tables in the current website but use div's extensively and all of the styling is with CSS. If you go to http://www.westonheritage.co.uk/john1906.html you may get a better understanding of what I am saying. What I need to do is to create div's depending on the number of rows held in an array from a MySql query, an example of the div is:- <div id="content_bottom_container"> <ul> <div id="content_bottomleft"> <ul> <li><a href="John1884.html">Audrey Weston (1884-1937)+</a></li> </ul> </div> <div id="content_bottomright"> <ul> <li><a href="Sidney1889.html">John Derek Weston (1889-1964)+</a></li> </ul> </div> <div id="content_bottomleft"> <ul> <li><a href="Madeline1891.html">Maurice A Weston (1891-1965)+</a></li> </ul> </div> The code above creates 3 div's, 1 left, 1 right and a second left. You will also notice that the Href data is hard coded, I want to change this and input the data from the database. It is important that they are created in this strict order to maintain the shape of the site. I know this is pretty long winded but it is difficult to explain, a view of the website and a quick look at the source code will help explain it better. Kind Regards
  10. Thanks Thorpe I have reworked the example you offered and it should give the basis of creating a MySql query that will suit my needs. Kind Regards
  11. Hello I have a website that I am trying to upgrade so that all the data can be placed into a MySql database. I know what I need but I do not know if it is possible with PHP and MySql. I need to insert into a Href link a variable so that when the link is clicked it would initiate a MySql search for data. The variable would contain the Key id of the person whose name was clicked. This is very difficult to explain so a visit to the static website may help understand what I am trying to achieve, www.westonheritage.co.uk If you go to the second page by clicking the key then click on any of the surnames listed. I have the database setup on localhost and can get out the data I require. 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.