Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End LOCATE(‘something’) output ID(other field) on corresponding row?

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #33821
    stevendeeds
    Member

    Okay, I have a DB table, with several fields, the two fields I want to work with are ‘path’ and ‘id’.

    First, I needed to know what ‘path’ the user was currently on… so I used PHP_SELF.. Now I have that ‘path’ in a variable called $current_path, now I need to search the table for the value of $current_path , and display ‘id’ from the corresponding row.

    How can I do this?

    EDIT: Something Like:

    LOCATE($current_path) and then output  corresponding 'id'
    #84593
    stevendeeds
    Member

    Got it working using:

    
    $current_page = $_SERVER["PHP_SELF"];

    $index = mysql_query("SELECT * FROM places_links WHERE link = '$current_page'");
    if (!$index)
    {
    die("broken" . mysql_error());
    }
    while($get_id = mysql_fetch_array($index))
    {
    $current = $get_id["display_order"];
    }
    ?>
Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Back End’ is closed to new topics and replies.