MySqlTalk.com  

Go Back   MySqlTalk.com > MySQL > SQL syntax
User Name
Password
FAQ Members List Calendar Search Today's Posts Mark Forums Read


Reply
 
Thread Tools Search this Thread
Old 02-17-2005, 04:20 PM   #1
jbh5000
Junior Member
 
Join Date: Feb 2005
Posts: 1 jbh5000 is on a distinguished road
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
jbh5000 is offline   Fork this post Reply With Quote
Old 02-17-2005, 04:57 PM   #2
Azkaban
Senior Member
 
Join Date: Jul 2004
Posts: 167 Azkaban is on a distinguished road
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'];
}
Azkaban is offline   Fork this post Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump



All times are GMT -4. The time now is 12:26 PM.



Powered by: vBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Limited.
Google
  Web http://www.mysqltalk.com
DISCLAIMERS:
1. We have no commercial interest in this site.
Banner Ads and Subscriptions will only be used to help pay for hosting and maintenance costs.
2. MySQLTalk.com is NOT affiliated with MySQL AB in any way.
3. MySQLTalk.com is NOT endorsed by MySQL AB in any way.
4. Please do not post any content that is harmful to MySQL or MySQL AB, meaning no misleading or obsolete information will be tolerated.
Well-founded constructive criticism meant to help the community is permitted.
5. This website is founded with the goal of improving the MySQL community.
We not only tolerate newbies, we encourage them.
Please do not ask newbies to "read the manual".