![]() |
|
|
#1 |
|
Junior Member
Join Date: Feb 2005
Posts: 1
|
Help
Ok, I am completly new to all of tis, so forgive me but I am very green.
Here is what I am trying to do: I have created a table in MYSQL that looks like the following: id, pagename, link 0, home, http://www.home.com 1, contactus, http://www.contactus.com 2, register, http://www.register.com Ok i have inserted variables in my page named $home, $contactus, & $register I need a php/mysql script to connect to my data base and get the link information from the database. I then need the php script to make the $home variable print http://www.home.com $contactus variable print http://www.contactus.com $register variable print http://www.register.com I am doing this so I can create links in my html pages that will pull the address from the mysql database allowing me to update all the links in the site with just one change to the my sql database. I do not expect anyone to write this code for me, but if you could at least tell me what kind of commands I should research/use I can probably work it out on my own. Or if you could show me a sample code with just 1 variable/result, I could probably add the rest. I am just having trouble with how results are returned and how to equate those results to a variable. Thanks |
|
|
|
|
|
#2 |
|
Senior Member
Join Date: Jul 2004
Posts: 167
|
Re: Help
You need to query the db on that table, then fetch_mysql_array which will put the values in an array. (I think that's the right function but a visit to http://php.net will give you the exact one).
Let's say the array is $links. Test for your various variables like so if($links['pagename']=="homepage"){ $home=$links['pagename']; }else if($links['pagename']=="contactus"){ $contactus=$links['pagename']; }else if($links['pagename']=="register"){ $register=$links['pagename']; } |
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
|
|