Page 1 of 3 123 LastLast
Results 1 to 10 of 23

Thread: Admin > Change "ID Search" to "REF Search"

  1. #1
    Join Date
    Oct 2004
    Posts
    73

    Default Admin - SOLVED

    Hi,
    Can anyone please tell the code to, in admin, i can search for ID when i go to edit listings...but i wanna change that...i've created a field to put the reference (diferent number from ID) and i would like to search not on id but on reference...anyone knows where can i changed that?
    Thanks in advance!
    Last edited by BMCouto; 03-18-2005 at 05:12 AM.

  2. #2
    Join Date
    Oct 2004
    Posts
    73

    Default

    really urgent... anyone can help me on this?

  3. #3
    Join Date
    Oct 2004
    Posts
    73

    Default

    anyone please?
    Sorry the rush but it's really urgent...
    Thanks in advance!

  4. #4
    the_sandking's Avatar
    the_sandking is offline hadron remnant - Moderation Fachmann
    Join Date
    Apr 2003
    Location
    Nullspace
    Posts
    5,289

    Default

    I don't think anyone understands what you are wanting to do, so no one has responded..
    "Much of what looks like rudeness in hacker circles is not intended to give offense. Rather, it's the product of the direct, cut-through-the-BS communications style that is natural to people who are more concerned about solving problems than making others feel warm and fuzzy."

    "We gotta' go to the crappy town where I'm a hero!"
    -Hoban 'Wash' Washburne 2485-2519


    "When you’re born you get a ticket to the freak show. When you’re born in America, you get a front-row seat.."
    -George Carlin 1937-2008

    New to Open-Realty® and need help? Check the:
    -OR DOCUMENTATION -

    Important: Read this at least once in your lifetime
    How To Ask Questions The Smart Way

  5. #5
    Join Date
    Oct 2004
    Posts
    73

    Default

    Sorry my bad english, ler me see if i can explain myself better...
    When you enter admin, on edit listings you have centered on the top something like "search listing by ID"... well on the "normal site" viewed by "normal users" i have added a search field "search by reference" (everytime i add a listing i have to give a reference to that listing) ... what i want to do is in admin (edit listing like i said above) i dont have the "Search by ID" but yes a "Search by reference"

    i dont know if you can understand now...sorry my english one more time
    but is this possible? how?

    Thanks in advance!

  6. #6
    Join Date
    May 2004
    Location
    Long Island, NY
    Age
    49
    Posts
    9,796

    Default

    This is possible.

    Find these 2 lines:

    if ($edit != "")
    {
    $sql_edit = make_db_safe($edit);

    and replace them with:

    if ($edit!="")
    {
    $sql="SELECT listing_id FROM " . $config[table_prefix] . "listingsDBElements WHERE ((field_name='reference') AND (field_value=$edit))";
    $rs=$conn->Execute($sql);
    while ($rs->EOF)
    {
    $sql_edit=make_db_safe($rs->fields[listing_id]);
    $rs->MoveNext();
    }

    This hasn't been tested but should work so I would backup your original file just in case.

  7. #7
    Join Date
    Oct 2004
    Posts
    73

    Default

    Ok, now i have something like

    PHP Code:
    if ($edit!="")
            {
            
    $sql="SELECT listing_id FROM " $config[table_prefix] . "listingsDBElements WHERE ((field_name='REF') AND (field_value=$edit))";
            
    $rs=$conn->Execute($sql);
            while (
    $rs->EOF)
            {
            
    $sql_edit=make_db_safe($rs->fields[listing_id]);
            
    $rs->MoveNext();
            }
            
    // first, grab the listings's main info
            
    $sql "SELECT ID, title, notes, last_modified, featured, active, mlsimport, expiration FROM " $config[table_prefix] . "listingsDB WHERE ((ID = $sql_edit) AND (user_ID = '$userID'))";
            
    $ADODB_FETCH_MODE ADODB_FETCH_ASSOC;
            
    $recordSet $conn->Execute($sql);
            if (
    $recordSet === false)
            {
                
    log_error($sql);
            }

            
    $num_records $recordSet->RecordCount();
            if (
    $num_records == 0)
            {
                die(
    "$lang[priv_failure]");
            } 
    And when i try to make a search it says something like "A problem as ocurred, please contact the administrator"... any idea of where is the error?

    Big thanks for making this to me...

  8. #8
    Join Date
    May 2004
    Location
    Long Island, NY
    Age
    49
    Posts
    9,796

    Default

    What is the error message received in your email?

  9. #9
    Join Date
    Oct 2004
    Posts
    73

    Default

    82.154.144.212 -- March 10, 2005, 9:55:33 pm -- SELECT ID, title, notes, last_modified, featured, active, mlsimport, expiration FROM default_listingsDB WHERE ((ID = ) AND (user_ID = '1'))

    That message...what can be wrong?

    Thanks in advance!

  10. #10
    Join Date
    May 2004
    Location
    Long Island, NY
    Age
    49
    Posts
    9,796

    Default

    It looks like it's not matching a listing with the reference number you're entering. Or you have the wrong field_name for the reference field in the query (make sure you entered the field name and not the field caption). Can't say for sure as I have no way to test it.

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
  •