• Resolved as_spartans

    (@as_spartans)


    I been trying to figure this out for the past week and about to go crazy lol. I have two custom php files I created using custom templates. The first file called player_stats.php selects a simple table from mysql with hyperlinks to the name column in a table.

    echo “<table border=’1′>
    while($row = mysql_fetch_array($results)){
    $strName = $row[‘name’];
    echo “<tr>”;
    $strLink = “” . $strName . ““;
    echo “<td>” . $row[‘team’] . “</td>”;
    echo “<td>” . $strLink . “</td>”;
    …..
    When a name of the player is clicked it will open up the file player_details.php since the hyperlink above is set to player_details.php?name=” . $row[‘name’]

    but in this case wordpress doesn’t know player_details.php file because wordpress doesn’t show or use .php extensions when it saves a file name.

    How can I get the first file to look at the second file?
    I appreciate the help in advance!

Viewing 11 replies - 1 through 11 (of 11 total)
  • luckdragon

    (@luckdragon)

    why can’t you just hard link it?

    echo "<td><a href='player_details.php?name=".$row['name']."'>".$strName."</a></td>";
    Thread Starter as_spartans

    (@as_spartans)

    I get a 404. It looks like it hyperlinks it to this:
    http://localhost/familybowlingnyc/stats5/player_details.php?name=Billy

    “stats5′ is the menu I created to get to player_stats.php

    Thread Starter as_spartans

    (@as_spartans)

    when I set the hyperlink to:
    $strLink = “” . $strName . ““;

    echo “<td>” . $strLink . “</td>”;

    The page is found but nothing is query from the database. It shows a blank table.

    The query is fine if I use it outside of wordpress.

    luckdragon

    (@luckdragon)

    if you are just saying <a> it’s not linking to anything, it could just be an anchor, or something similar.

    is your player_details script in /familybowlingnyc/ or is it in a sub folder, if it’s in the “base” folder you just have to tweak the link

    echo "<td><a href='".get_option("siteurl")."/player_details.php?name=".$row['name']."'>".$strName."</a></td>";
    Thread Starter as_spartans

    (@as_spartans)

    Yes its in /familybowlingnyc/ now I am getting the following:

    Fatal error: Call to undefined function get_header()

    luckdragon

    (@luckdragon)

    what’s the full error, what file?

    Thread Starter as_spartans

    (@as_spartans)

    Fatal error: Call to undefined function get_header() in C:\wamp\www\familybowlingnyc\stats_pagess.php on line 8

    Thread Starter as_spartans

    (@as_spartans)

    it works if I create a new menu tab that’s custom link to the file.

    But the player_stats.php file’s css styles sheets, header, logo, footer is missing obviously. I tried to include the functions and headers directories. But I keep getting errors.

    What’s the best way of doing this?

    Thread Starter as_spartans

    (@as_spartans)

    I got it to work!!!!! I used this and now all the wordpress functions became available:

    require_once(“/path/to/wordpress/wp-load.php”);

    luckdragon

    (@luckdragon)

    yep, that’d do it πŸ™‚

    Thread Starter as_spartans

    (@as_spartans)

    luckdragon Thanks for your help πŸ™‚

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Page hyperlinking using custom php files’ is closed to new replies.