This is a discussion on "links update dynamic data" within the PHP Forum section. This forum, and the thread "links update dynamic data are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
links update dynamic data
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
I'm not exactly sure what this is called, so it's hard to do a search on it.
What I'm trying to do is have a webpage that updates the dynamic data from a database based on what links are chosen on the left side of the page. - On one side of the page is a list of links. (ie: potato, carrot, apple...) - On the other side of the page is a bunch of dynamic data that connects to a MySQL database. Depending on what is chosen on the left side of the page, it will show the user that information from the database on the right side. Example: If you click on the apple link, it pulls the apple row out of the database and presents a picture of an apple, gives some information on an apple, etc. I don't think this is very hard but I don't see it in any of the books I have, and have never done it before. Can someone help point me in the right direction or tell me how this is done? BTW.. I'm using Dreamweaver Thanks, Josh |
|
|
|
#2
|
||||
|
||||
|
Re: links update dynamic data
I'm pretty sure this has to be done with ajax.
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
|
#3
|
|||
|
|||
|
Re: links update dynamic data
really? I figured each link would have to pass some information (ie: record number) and then each dynamic data from a recordset would be shown.
see "i think" I have an idea of what needs to be done... I'm just not exactly sure how to do it. so would it really have to done with ajax? |
|
#4
|
||||
|
||||
|
Re: links update dynamic data
hmm, if there is a lot to load,
ajax would probably be better. otherwise you might be able to do something like this: have three divs <div id="potato"> grab mysql data here </div> <div id="carrot"> grab mysql data here </div> <div id="tomato"> grab mysql data here </div> for each of these IDs set the visibility to hidden, then use javascript to show them, the links on the left would have the onclick attribute: onclick="showCarrot()" onclick="showPotato()" onclick="showTomato()" and these functions would be something like: function showCarrot() { document.getElementById('carrot').style.visibility = 'visible'; } Obviously, it's more complicated than that though
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
|
#5
|
|||
|
|||
|
Re: links update dynamic data
You won't need ajax to do this, just php.
Do you know any php at all, how to connect to a database and retrieve data for example? |
|
#6
|
|||
|
|||
|
Re: links update dynamic data
Yeah ... are you talking about link like
domain.com/page.php?something=carrot ? Then ... that's php. On that page.php you would have something like
|
|
#7
|
|||
|
|||
|
Re: links update dynamic data
To answer a one major question, yes I have my website connected to a database. And yes I have pulled from it before. But normally when I do things like that it's been simple things such as a random quote generator type application or a repeat region spanning over a couple pages presenting items.
Maybe I should have nixed my apple\potato\carrots example since I think back and figure that was a stupid example and it's confusing me a little. What I'm doing is working on a small Alumni website, and this one page is a little confusing since I haven't done anything like it before. The idea is that one side of the book lists everyone's name. The other side of the book has the dynamic data links that will show things like persons picture, name, location, email, family, occupation, etc, etc, etc. And this will change depending on the persons name they click on. I think I understand that I need to have a persons name a link with $autonum (where the number corrosponds to that row of their info in the database) But on the other side of the page where the information is to be displayed.... I guess where I'm really getting lost is how to pass that information to the other side. There will be approximately 50 people listed, and I'm afraid of having do a 50 long IF Statement. So on name side I would have people listed like this? [code] domain.com/page.php?person=1 domain.com/page.php?person=2 domain.com/page.php?person=3 domain.com/page.php?person=4 [code] Now on the other side I would have to create a RecordSet to have something similar to this: [code] $person = $_GET['person']; $query_Recordset1 = "SELECT picture, name, email, occupation FROM people_database WHERE person='$person'"); [code] Sorry I'm at work right now and can't test it out, so I'm trying to make sure I get it right before I go home. |
|
#8
|
|||
|
|||
|
Re: links update dynamic data
Your almost there
After you have the data from the database you just need to print it out:
|
|
#9
|
|||
|
|||
|
Thanks Jimz. You've been a big help!!!
ok, so playing around with it tonight I finally have it figured out. Apparently I found after testing it out that you cannot use the same name as the field you are ultimately trying to call. What I mean is if your table column is called auto.... don't call the parameter auto throughout. It just doesn't like you very much if you do. I thought I would post my code for those that are interested. The upper code before the <head> starts
|
|
#10
|
||||
|
||||
|
Re: links update dynamic data
Glad you got it working in the end
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
![]() |
| Tags |
| database, dynamic data, links, php |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Submit Free the best top Web Directories with over 6500 links (update PR and Alexa) | ronaldo30 | Search Engine Optimization (SEO) | 1 | Jul 4th, 2008 12:22 |
| coldfusion: dynamic links for every occurance | lockmac | Other Programming Languages | 1 | Feb 20th, 2008 12:16 |
| Dynamic links not working in Flash? | edd_jedi | Flash & Multimedia Forum | 2 | May 18th, 2007 18:25 |
| dynamic data in a table | gecko | Web Page Design | 3 | May 6th, 2007 11:47 |
| VB: Datagrid Update Query - Data Dissapering | DJ1UK | ASP.NET Forum | 2 | Aug 8th, 2005 12:36 |