Web Hosting Vodahost    

Home Take The Royal Tour! Order Now Features Prices
Go Back   Web Hosting > VodaHost Web Hosting Support > mySQL & PHP

Notices

mySQL & PHP Discussions, information and help with mySQL and PHP.

Reply
 
Thread Tools
  #1  
Old 07-14-2009, 08:36 PM
Rob (SA)'s Avatar
Major
 
Join Date: Nov 2006
Location: Centurion, South Africa
Posts: 483
Question Individulise hyperlinks from MySQL

Hi Folks,

I have managed to change all the names in a table to hyperlinks.

These links need to be individualised that if I pick the name it goes straight to that members page.

I would appreciate any ideas that I can develop the individual pages and a method to test that the links to each member works.

Each members info comes from a datbase in MYSQL and so data should be unique.

I look forward to any replies
__________________
Kind Regards
Rob
www.gnjgf.co.za
www.oryan-projects.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2  
Old 07-18-2009, 12:20 AM
Rob (SA)'s Avatar
Major
 
Join Date: Nov 2006
Location: Centurion, South Africa
Posts: 483
Question Re: Individulise hyperlinks from MySQL

Hi Folks,

Maybe said it incorrectly.

The page as links is done fine at www.gnjgf.co.za/watflip.php

However when I pick on a name it shows that I hav picked all the names and that is not what I am looking for.

I would like to pick an individuals name which will then direct me to the correct page
__________________
Kind Regards
Rob
www.gnjgf.co.za
www.oryan-projects.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old 07-18-2009, 08:57 AM
Rob (SA)'s Avatar
Major
 
Join Date: Nov 2006
Location: Centurion, South Africa
Posts: 483
Question Re: Individulise hyperlinks from MySQL

Hi Folks,

I have inserted the bit of code that might be the cause of my problem:

echo '<a href=<option value="'.$row['surname'].', '.$row['name'].'">'.$row['surname'].', '.$row['name'].'</a></option>';

I look forward to your replies
__________________
Kind Regards
Rob
www.gnjgf.co.za
www.oryan-projects.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old 07-21-2009, 09:24 PM
Watdaflip's Avatar
Major General
 
Join Date: Sep 2005
Location: Cincinnati, Ohio
Posts: 2,151
Default Re: Individulise hyperlinks from MySQL

Your inserting a html tag inside an attribute for another tag.

The option tag is only used inbetween <select></select> tags.

What you need to do is use url variables and php's $_GET superglobal to retrieve the variables.

Your url will look like

href="http://yoursite.com/file.php?surname='.$row['surname'].'&name='.$row['name'].'"

However, you will probably want to use just use the numeric id for that row. Not only is it a cleaner url, it will produce a more efficient query when you are actually loading the row. It is also easier security wise as well.

On the php file to list the data for the specific row, just retrieve the data using $_GET['surname'], or $_GET['name'].

Lastly, if you do choose to use the id as the only passed variable, you can just use a simple function to check if it is numeric before using it in a query

if(is_numeric($_GET['id'])) {
// execute query
} else { die("Hacking attempt"); }

Assuming that your code is logically correct, there should never be a time when anything other then a number is in the url by anything generated by the script. If there is then someone manually added it to the url.

Oh and lastly, don't take an offense by this, but you should probably take some time and go over more html/php tutorials. Without having the basic down first your going to cause alot of headaches in the long run.
__________________

Register/Login Script
Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old 07-22-2009, 07:20 PM
Rob (SA)'s Avatar
Major
 
Join Date: Nov 2006
Location: Centurion, South Africa
Posts: 483
Question Re: Individulise hyperlinks from MySQL

Hi,

Thanks for the reply.

What I am understanding from this is that:

The href. . . . should happen in another section of the html code and not in th eplace I have currently presented it?

The variable as presented at www.gnjgf.co.za/watflip.php presents correctly from MySql however and the hyperlink shows however when clicked all highlight as if all are picked.

What needs to happen though is that each name picked should be redirected to a new page and specifically a page with their name /id that their stats may be veiwed - logins will be the norm for those pages.

Last comment - I am always happy to take advice. If I understand you are asking I do a bit more reading on php / html. No offense taken but I search the internet continously to find resolution to my challenges and as a memebr here welcome the support guys like yourselves and Naval offer.

If I do not understand correctly please advise
__________________
Kind Regards
Rob
www.gnjgf.co.za
www.oryan-projects.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old 07-23-2009, 09:41 AM
navaldesign's Avatar
General & Forum Moderator
 
Join Date: Oct 2005
Location: Italy
Posts: 10,052
Default Re: Individulise hyperlinks from MySQL

There is no issue asking for help. What Watdaflip is actually saying (i believe) , is that you are trying to apply scripts that you search on the internet or we supply, but you actually haven't got the entire vision of how you can perform certain tasks. So you do copy a script and make it work by trial and error, but you don't yet have the necessary html / php knowledge to the extend required to build a complete application.

Building an application requires
1. Setting the goals, as detailed as possible.
2. Schedule future extensions / upgrades, as least as far as possible.
3. Creating the logical diagram
4. Coding

As you understand, you must know a bit more of HTML and PHP (and also MySQL, to correctly build the queries with PHP). Otherwise you will always have issues with your work trying to debug errors.

This is why Watdaflip (And I) suggest that you first get some HTML / PHP theoretical knowledge by reviewing some of the tutorials available on the net. And, i myself, repeat, no offense with this. We have also been through the same steps, and we have had to learn at least the basics before attempting to code an application.

Now, regarding your code: this is what you have in your table rows:


<td bgcolor=#C6DEFF><font style="font-size:10px" color="#00008B" face="Arial"><a href=<option value="ALVES, SERGIO">ALVES, SERGIO</a></option></td>

Which is coming out, i believe, from a piece of php code like:

loop start.......
echo'
............
<td bgcolor=#C6DEFF><font style="font-size:10px" color="#00008B" face="Arial"><a href=<option value="''.$lastname.'", ".$firstname ">'.$lastname.", ".$firstname.'</a></option></td>
............rest of columns
closing loop tag.....

where $firstname and $lastname are retrieved from the DB

The <a href=<option value="''.$lastname.'" ".$firstname ">'.$lastname." ".$firstname.'</a></option> is wrong.

It should be something like:

<td bgcolor=#C6DEFF><font style="font-size:10px" color="#00008B" face="Arial><href="members_page.php?Record_nr='.$R ecord_nr.'">'.$lastname.'" ".$firstname.'</a><font></td>

This will create, for each member, a link like members_page.php?Record_nr=31 . In the members page (members_page.php) you should have first of all a line like

$Record_nr = intval($_GET['Record_nr']);

So you capture the member's ID (the Record_nr since you use ABVFP to store the members info in the table):

Based on this Record_nr you then build your query to retrieve the member's info from the table and display it in your member's page:

$query = "SELECT * from tablename WHERE Record_nr= '$Record_nr'";
.....etc

The <option tag that you have used has no place in there , it is only used within the <select> ...... </select> tags (a selection list) to create the list options.
__________________
Navaldesign
Logger Lite: Low Cost, Customizable, multifeatured Login script
Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old 07-23-2009, 10:27 AM
Rob (SA)'s Avatar
Major
 
Join Date: Nov 2006
Location: Centurion, South Africa
Posts: 483
Thumbs up Re: Individulise hyperlinks from MySQL

Hi George,

Thanks very much for the detailed expliantion, i appreciate it and understand more clearly your stand points.

I am in the process of this exercise trying to learn th evarious aspects of html /php an dyes it has its own challenges.

I will work harder on the logical diagram as I believe this does help and read further on html / php coding. The syntax of thelanguage is a bit of a challenge but I am sure this will evolve as I learn more.

Thanks for the advice on the code.

I only tried to place the tags <A> href in the esisting code na dthis provided the effect I am now seeing. So I got excited to see that I could get that part to work only to the frustration of realising it was not quite correct.

I will dable a bit further with your presentation below and hope that I can get the desired result.

I really appreciate all your assitance
__________________
Kind Regards
Rob
www.gnjgf.co.za
www.oryan-projects.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply


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

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT +1. The time now is 12:08 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC7
2005-2009 VodaHost Web Hosting Your Perfect Web Host - All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203