Best Website-BuildersBest Website-Builders
    What's Hot

    What we learned backstage at the Oscars

    March 13, 2023

    Silicon Valley Bank’s UK Unit Has Been Sold to HSBC for $1.21

    March 13, 2023

    Ray Wood: How dad’s goal to create ‘two of greatest female tennis players ever’ changed

    March 13, 2023
    Facebook Twitter Instagram
    Facebook Twitter Instagram
    Best Website-BuildersBest Website-Builders
    • Home
    • CSS

      Almost Bare Bone WebR Starter App

      March 12, 2023

      Best AI Tools for Web Designers (2023)

      March 12, 2023

      PSPad 5.0.7.770 | Neowin

      March 11, 2023

      Battle of Memphis

      March 11, 2023

      How to create a recipe book using HTML, CSS and JavaScript

      March 11, 2023
    • Joomla

      Pros, Cons, & Pricing Compared

      March 11, 2023

      Give your website a place to call home for a lifetime of web hosting for just $100

      March 11, 2023

      Give your website a place to call home for a lifetime of web hosting for just $100

      March 11, 2023

      12 Best Free Web Hosting Sites to Choose From

      March 10, 2023

      cPanel vs SPanel: Which is the Better Web Hosting Control Panel?

      March 10, 2023
    • PHP

      Lawsuit says teacher pushed student for not saying pledge of allegiance

      March 12, 2023

      Paul Flores sentenced to 25 years for murder of Christine Smart

      March 12, 2023

      Most Effective Skin Serum, According to Reviewers and Dermatologists

      March 12, 2023

      Man sues ex-wife’s friend for helping ex-wife get abortion

      March 11, 2023

      Perfect indoor and outdoor slippers to wear around the house or on errands

      March 11, 2023
    • UX

      Which Product Designer Specialization is the most expensive?

      March 13, 2023

      The user experience of the vivo X90 camera

      March 13, 2023

      New York City worker saw company hiring for her job but paid $90,000 more

      March 11, 2023

      Best March Madness Apps of 2023: NCAA, ESPN, CBS

      March 11, 2023

      Best March Madness Apps of 2023: NCAA, ESPN, CBS

      March 11, 2023
    • Web Builders
      1. Web Design
      2. View All

      What Comes First in Website Development — Design or Copy?

      February 2, 2023

      Modern Campus Honors Best Higher Education Websites of 2022

      February 2, 2023

      Premier SEO Consultant in Las Vegas, Nevada with Unparalleled Customer Service

      February 2, 2023

      Can Religious Freedom Be Saved? This group is racing the clock to teach America’s first freedom

      February 2, 2023

      How i Create New Google Account

      February 7, 2023

      CWT powers tools for meeting and event planners

      January 31, 2023

      Best Website Builder – Website Builders

      January 24, 2023

      Is There A Market For Rap-Themed Slot Games? – Rap Review

      January 19, 2023
    • WordPress

      Quordle today – Tips and Answers for Monday March 13th (Game #413)

      March 13, 2023

      A big Samsung Galaxy S23 camera update is rumored to be in the works

      March 12, 2023

      Not impressed with the Oculus Quest 2? Here’s how the VR headset of the future beats it.

      March 12, 2023

      Sleep Week 2023 – 7 days tips for better sleep

      March 12, 2023

      These mobile games are just trying to steal your crypto assets, warns FBI

      March 12, 2023
    • Realtoz
      • Our Other Sites
    • More News
    Best Website-BuildersBest Website-Builders
    Home » Dynamic linking from mysql – JavaScript – SitePoint Forums
    JavaScript

    Dynamic linking from mysql – JavaScript – SitePoint Forums

    websitebuildersnowBy websitebuildersnowFebruary 15, 2023No Comments2 Mins Read
    Facebook Twitter LinkedIn Telegram Pinterest Tumblr Reddit WhatsApp Email
    Share
    Facebook Twitter LinkedIn Pinterest Email



    web148


    February 15, 2023, 9:01 PM


    1

    I want to get a link to my php web page from a mysql (bibliographic) database. This is so that all books can have valid links on both local and remote web pages.
    I think the only way is to use javascript. In fact the following code works for a single static page (of course the $intellectualia php variable is already defined and is different for local and remote).

    <script>
         var intellectualia = "<?php echo "$intellectualia"; ?>";
    </script>
    <p>Link to <a href="" onclick="location.href=intellectualia+'/mypath/myfilephp';return false;">go to myfile</a></p>
    

    But using mysql with php I couldn’t get the expected result.
    This code doesn’t work:
    Omit the whole mysql query (and some useless lines).

    $result = mysqli_query($db, $query);
    echo "<table>";
    while ($row = mysqli_fetch_array($result))
    { $href = "https://www.sitepoint.com/community/t/dynamic-link-from-mysql/$row[href]";
      $link = "onclick="https://www.sitepoint.com/community/t/dynamic-link-from-mysql/$row[href]"";
        if($href != '') {echo "<td><a href="" $link>read</a></td>";}
        echo "</tr>"; }
    echo "</table>";    
    

    In my mysql data I set a row with this content ( href digit):

    location.href=intellectualia+'/mypath/myfile.php';return false;
    

    The resulting html source code (which of course doesn’t work) is:

    <a href="" onclick='location.href=intellectualia+'/mypath/myfile.php';return false;'>read</a>

    what should i change?
    thank you!



    web148


    February 15, 2023 at 9:27 PM


    2

    Presumably this (pure php, no js) code could work remotely, such as it works locally.

    $link = "$intellectualia/$href";
        if($href != '') {echo "<td><a href="https://www.sitepoint.com/community/t/dynamic-link-from-mysql/$link">leggi</a></td>";}
    

    And in mysql I put just the path after $intellectualia.


    web148


    February 16, 2023 5:11 AM


    3

    Sure it works.sorry to bother you :blush:



    1 like



    Source link

    Share this:

    • Tweet
    • Email
    • Pocket
    • Mastodon
    • WhatsApp
    • Telegram
    • Share on Tumblr
    • Print
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Telegram Email
    Previous ArticleElon Musk’s New Twitter Superpower Is Dangerous
    Next Article Raquel Welch: US actress and model dead at 82
    websitebuildersnow
    • Website

    Related Posts

    JavaScript-free web app development with Microsoft Blazor

    March 11, 2023

    How to create JavaScript WebSockets subscriptions to Ethereum and Binance Smart Chain via ethers.js?

    March 11, 2023

    Need for Speed: Why Eleventy Leaves Bundler Behind

    March 10, 2023
    Add A Comment

    Leave a Reply Cancel reply

    Top Posts

    Subscribe to Updates

    Get the latest sports news from SportsSite about soccer, football and tennis.

    Advertisement
    Demo

    This website provides information about CSS and other things. Keep Supporting Us With the Latest News and we Will Provide the Best Of Our To Makes You Updated All Around The World News. Keep Sporting US.

    Facebook Twitter Instagram Pinterest YouTube
    Top Insights

    What we learned backstage at the Oscars

    March 13, 2023

    Silicon Valley Bank’s UK Unit Has Been Sold to HSBC for $1.21

    March 13, 2023

    Ray Wood: How dad’s goal to create ‘two of greatest female tennis players ever’ changed

    March 13, 2023
    Get Informed

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

    © 2023 bestwebsite-builders. Designed by bestwebsite-builders.
    • Home
    • About us
    • Contact us
    • DMCA
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.