Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Apr 2011
    Posts
    24
    Thanks
    4
    Thanked 0 Times in 0 Posts

    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.

  • #2
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    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" ?

  • #3
    New Coder
    Join Date
    Apr 2011
    Posts
    24
    Thanks
    4
    Thanked 0 Times in 0 Posts
    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

  • #4
    M2D
    M2D is offline
    New to the CF scene
    Join Date
    Jan 2006
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #5
    New Coder
    Join Date
    Apr 2011
    Posts
    24
    Thanks
    4
    Thanked 0 Times in 0 Posts
    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

  • #6
    New Coder
    Join Date
    Apr 2011
    Posts
    24
    Thanks
    4
    Thanked 0 Times in 0 Posts
    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)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •