Turning Data into URLs?


Posted on 16th Feb 2014 07:03 pm by admin

This may seem very basic to you, but I'm having a hard time figuring out how to do this since I don't even know what the proper term for it is:

Background info:
Animals Table - animalid, name, photo, achievementname, price, resale, levelid, description
Achievement Table - achievementid, achievementname, photo, xprequired, rewardname, description
Levels Table - levelsid, name, xprequired, description
Rewards Table - rewardid, rewardname, desciption

What I want to do is have my animals.php page pull up the MySQL Animals Table (already done) and have all the animal's achievementsid values link to a new page detailing that specific achievement (achievement.php). In turn, that achievement page would show the rewardid value that would link to a page detailing that specific reward (reward.php)

Example:
Animals.php shows a table with:
1-Horse--horse.png-Yee Haw!-1,000$-250$-1-A horse is a horse of course!

I want Yee Haw! to display as a link that would open up a php page that would show information relating to that specific achievement, ignoring all other achievements.

This would work in the same vein as this website: http://farmville.aweblog.net/almanac/animals/all-animals

I assume in being correct that I would have to call the result of that value into a variable that would be passed on as a cookie to another php file but I have not idea where or how to start on that.

My loop looks like this (shortened due to repetition):
while($row = mysql_fetch_array($result)){
echo "<tr>";
echo "<td>" .$row['idAnimal']. "</td>";
echo "<td><img src='".$url.$row['photoAnimal']."' height='50px' width='50px'></td>";
echo "<td>" .$row['nameAnimal']. "</td>";
echo "<td>" .$row['nameCategory']. "</td>";
echo "</tr>";
}


Assuming I wanted each animal name to link to a detailed animal page, what would I do? Can anyone give me some pointers or point me to a good resource for this kind of information? Googling is pointless as I don't know what terms I should be using...
Thanks

No comments posted yet

Your Answer:

Login to answer
54 Like 6 Dislike
Previous forums Next forums
Other forums

Select Lists into MYSQL
Hello All, I am new to PHP @ 1 week. So borrowing code anywhere I can. I am making progress, but h

puting for loop in 1 value
hi ,

how do i put this code in 1 value:
Code: <?php
for ($i=1; $i<=5; $i

Writing to the middle of a file
Hi I have a bit of a problem. Is there any way i can write some text to a middle of a text file. For

Calling variables
I want to call this to my website but it doesn't display what I want it to,

Code: <h5&

PHP Session Issue
I'm having an issue with one section on my website dealing with sessions. Now I know that myself and

C - Reading a file into a byte array
Hi,

I'm trying to read a file into a byte array in C. I have to use C as this is for a loadru

my sql select id and then update problem.
I need to select some auto incremented ids out of a database and then use those id in a where statem

Something Non-Traditional. Can we solve?
I have an idea for an application here. It's mostly flash, but it couldn't work without a somewhat n

Change image filetype on upload?
Hi,
I've got a form which uploads an image to the server.
Is it possible to change the image t

need help with date function
i have following form for date

Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash