Have an account? / Register

Forgot your password?

Forgot your username?

Results 1 to 4 of 4

Thread: creating link on dynamic text

  1. #1
    Registered User
    Join Date
    Jun 2004
    Location
    United Kingdom
    Posts
    81
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question creating link on dynamic text



    I have created a simple dynamic page using Dreamweaver, php, and MySQL. The works it does is simple - user key in search keyword in the "search.php" file and the result will be shown in the "result.php" file. Data is GET from the remote server database.

    Question is: there is one dynamic text (say recordset.XXX) need to be linked to another site (external site). How could I do that?

    In simple, what my aim is want to build a result.php page the user will only see (a clickable) "XXX" and when they click on it, it would link them to another site - best would be open in new window. You got it, merchants (XXX) & deeplinks. As they come together in a csv file though in different column, how can I get use of this?

    Cheers and thanks a lot for all help.
    Cheers
    YJ

  2. #2
    mxp
    mxp is offline
    Registered User
    Join Date
    Dec 2004
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts
    if you mean how do you create dynamic links then you could do something similar to this.

    echo '<a href="'.$url.'" target="_blank">'.$url.'</a>';

    where $url is result of of your db query.

  3. #3
    Registered User
    Join Date
    Jun 2004
    Location
    United Kingdom
    Posts
    81
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Cheers mxp but I am not quite with you. What I want indeed is a "recordset in another recordset" - like when you search something from Google, the result page shows list of related results (one recordset), but as a link (another recordset).

    Example: in the CSV file from all merchants, there would have two fields, one as "product name" and the other is "deep link to product". What I want is to create a result page which show all product (have done that no problem), and shows as a link (deep link to product), i.e. something like:

    Result:
    recordset1.productname

    but how could I make it as a link as well using the deep link given?

    Hope this clarify my question. Thanks a lot. BIG CHEERS
    Cheers
    YJ

  4. #4
    mxp
    mxp is offline
    Registered User
    Join Date
    Dec 2004
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts
    if you want something like google ie search returns to be displayed like this

    product1 - deep_link_to_product1
    product2 - deep_link_to_product2

    and so on then you need to use some kind of loop to return your results. i usually use a for loop, but you can use a while loop.

    either way you need something like this

    YOUR QUERY HERE
    $result=mysql_query($query);
    $num_results=mysql_num_rows($result);

    for($i=1; $i <= $num_results; $i++){
    $row=mysql_fetch_array($result)
    $product_name=$row['product_name'];
    $deep_link=$row['deep_link'];

    echo $product_name.'-'.$deep_link;
    }

    the above assumes that the deep_links are given as scripts. (i havent used deep links myself so dont know what form they take)

    if they are urls then you could replace the last line with something like

    echo '<a href="'.$deep_link.'" target="_blank">'.$product_name.'</a>';

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

SEO by vBSEO 3.6.1