Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-12-2011, 04:07 PM   PM User | #1
bubbbbbz
New Coder

 
Join Date: Apr 2011
Posts: 24
Thanks: 4
Thanked 0 Times in 0 Posts
bubbbbbz is an unknown quantity at this point
Question i want to set a url to $url2 easy way please?

so my code is

Code:
$sql = "SELECT * FROM my_contacts where id=".$_GET['contact'];
$result = make_query($sql);
while($row = mysql_fetch_assoc($result)) {
$trades .= "<div>";

$trades .= "<table cellspacing=\"0\" border=\"0\">\n";

$trades .= "<tr><td width=\"120\"><b>Name:</b> </td><td width=\"100\">" . $row['Contact'] . "</td></tr>";

$trades .= "<tr ><td><b>more council info</b> </td><td> <a href='".$row['contact']."' target='_blank'>Click Here</a></td></tr>";
that will go to www.myurl.com/councilmaps/['contact'].php

on the next line down i want to use the same $GET ['contact'] but use the url www.myurl.com/council['contact'].php different from the councilmaps/

iv checked by chaning the councilmaps to councils in the url keeping the same ['contact' detaisl and it works fine.. hope you understand


http://www.justaskdino.com/councilsm...rict%20Council

that link will take you to the page if you look at more info and follow that link i want it to go to all the info shown in councils.php

Last edited by bubbbbbz; 05-12-2011 at 04:10 PM..
bubbbbbz is offline   Reply With Quote
Old 05-12-2011, 04:26 PM   PM User | #2
angst
Senior Coder

 
angst's Avatar
 
Join Date: Apr 2004
Location: Toronto, Ontario
Posts: 2,112
Thanks: 15
Thanked 122 Times in 122 Posts
angst is on a distinguished road
so to get this clear,
$row['contact'] holds the entire link? and you want to extract the last portion of this and amend it to "www.myurl.com/council" ?
angst is offline   Reply With Quote
Old 05-12-2011, 04:37 PM   PM User | #3
bubbbbbz
New Coder

 
Join Date: Apr 2011
Posts: 24
Thanks: 4
Thanked 0 Times in 0 Posts
bubbbbbz is an unknown quantity at this point
yes $row['contact'] holds councilmaps

in the list i have a link saying more council info so i want it to keep the councils name and id from the sql but shorten the url to council.php which is another page showing the rest of council info thanks

its so hard to explains something so simple
bubbbbbz is offline   Reply With Quote
Old 05-13-2011, 06:56 AM   PM User | #4
M2D
New to the CF scene

 
Join Date: Jan 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
M2D is an unknown quantity at this point
Like this?
PHP Code:
$contact mysql_real_escape_string($_GET['contact']);
$url "http://www.myurl.com/councilmaps/";
$sql "SELECT * FROM my_contacts WHERE id='$contact'";
$result make_query($sql);
while(
$row mysql_fetch_assoc($result)) {
$trades "<div>";

$trades .= "<table cellspacing=\"0\" border=\"0\">\n";

$trades .= "<tr><td width=\"120\"><b>Name:</b> </td><td width=\"100\">" $row['Contact'] . "</td></tr>";

$trades .= "<tr ><td><b>more council info</b> </td><td> <a href='$url."".$row['contact']."' rel="nofollow" target='_blank>Click Here</a></td></tr>"; 
I don't know why rel='nofollow' is showing twice? check it first.

Last edited by M2D; 05-13-2011 at 06:59 AM..
M2D is offline   Reply With Quote
Old 05-13-2011, 10:03 AM   PM User | #5
bubbbbbz
New Coder

 
Join Date: Apr 2011
Posts: 24
Thanks: 4
Thanked 0 Times in 0 Posts
bubbbbbz is an unknown quantity at this point
i manage to fix what you gave me ( M2D )

$contact is only giving me the id of the contact. t

www.justaskdino.com/councils/296

where i need

http://www.justaskdino.com/councils/...rict%20Council

Code:
<?php
$contactst = mysql_real_escape_string($_GET['contact']);
$urls = "http://www.justaskdino.com/councils/";
$sql = "SELECT * FROM my_contacts WHERE id=" .$_GET['contact'];
$result = make_query($sql);
while($row = mysql_fetch_assoc($result)) {
$trades = "<div>";

$trades .= "<table cellspacing=\"0\" border=\"0\">\n";

$trades .= "<tr><td width=\"120\"><b>Name:</b> </td><td width=\"100\">" . $row['Contact'] . "</td></tr>";

$trades .= "<tr ><td><b>more council info</b> </td><td> <a href='". $urls."".$contactst." '>Click Here</a></td></tr>";
thats what i managed to do with what you gave me iv turned it around a few times cant do it thanks
bubbbbbz is offline   Reply With Quote
Old 05-13-2011, 10:12 AM   PM User | #6
bubbbbbz
New Coder

 
Join Date: Apr 2011
Posts: 24
Thanks: 4
Thanked 0 Times in 0 Posts
bubbbbbz is an unknown quantity at this point
Code:
$trades .= "<tr ><td><b>more council info</b> </td><td> <a href='". $urls."".$_GET['contact'] . $trades ." '>Click Here</a></td></tr>";
i have manage to come up with this with the url

http://www.justaskdino.com/councils/296 div table tr width=120 Name: Selby District Council /td tr

there was alot more table stuff in between the id (296) and the name (selby district council)
bubbbbbz is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 11:24 AM.


Advertisement
Log in to turn off these ads.