Results 1 to 7 of 7
  1. #1
    Join Date
    Feb 2008
    Posts
    8
    Plugin Contributions
    0

    Default To get the $admin_name in the categories.php

    I want to get the admin name after they log in,
    and use this variable in the categories.php

    is it a session variable?

    I tried to echo $admin_name; in categories, but it didn't work

  2. #2
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: To get the $admin_name in the categories.php

    Quote Originally Posted by juniorphp View Post
    I want to get the admin name after they log in,
    and use this variable in the categories.php
    Why?

    Quote Originally Posted by juniorphp View Post
    is it a session variable?

    I tried to echo $admin_name; in categories, but it didn't work
    You'd have to look it up from the database by referencing $_SESSION['admin_id']
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Feb 2008
    Posts
    8
    Plugin Contributions
    0

    Default Re: To get the $admin_name in the categories.php

    I got it, thank you.

    Also, i want to know the location of code for categories listing in categories.php

    thank a lot~

  4. #4
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: To get the $admin_name in the categories.php

    Quote Originally Posted by juniorphp View Post
    I got it, thank you.

    Also, i want to know the location of code for categories listing in categories.php

    thank a lot~
    You're changing topics now, but I think what you're looking for is /admin/includes/modules/category_product_listing.php
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  5. #5
    Join Date
    Feb 2008
    Posts
    8
    Plugin Contributions
    0

    Default Re: To get the $admin_name in the categories.php

    I can get the admin_id

    echo $_SESSION['admin_id'];

    but I still can't extract the admin name from the SQL by the code


    {

    $result = $db->Execute("select admin_name from " . TABLE_ADMIN . " where admin_id = '" .$_SESSION['admin_id'] . "'");

    $row = mysql_fetch_assoc($result);

    echo $row['Variable_name'];

    }


    it give Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\~...

    how can i fix it ?

  6. #6
    Join Date
    Feb 2008
    Posts
    8
    Plugin Contributions
    0

    Default get the admin_name

    as I can get the admin_id after login in

    echo $_SESSION['admin_id'];

    but I still can't extract the admin name from the SQL by the code


    {

    $result = $db->Execute("select admin_name from " . TABLE_ADMIN . " where admin_id = '" .$_SESSION['admin_id'] . "'");

    $row = mysql_fetch_assoc($result);

    echo $row['Variable_name'];

    }


    it give Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\~...

    how can i fix it ?

  7. #7
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: get the admin_name

    Repeating the same post again isn't very helpful to anybody.
    Posting more information about things you've tried will usually get you faster (and definitely friendlier) answers.
    Quote Originally Posted by juniorphp View Post
    but I still can't extract the admin name from the SQL by the code


    {

    $result = $db->Execute("select admin_name from " . TABLE_ADMIN . " where admin_id = '" .$_SESSION['admin_id'] . "'");

    $row = mysql_fetch_assoc($result);

    echo $row['Variable_name'];

    }
    1. Why would you expect $row['Variable_name"] to match anything in the original query?

    2. If you're going to use the Zen Cart functions to query the database, you need to be consistent in doing so.
    You'll find it much easier to use this:
    Code:
    $result = $db->Execute("select admin_name from " . TABLE_ADMIN . " where admin_id = '" . $_SESSION['admin_id'] . "'");
    
    echo $result->fields['admin_name'];
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 

Similar Threads

  1. How do I get rid of the advertisement on the bottom of my index.php page?
    By moonlight in forum Installing on a Windows Server
    Replies: 2
    Last Post: 17 Jan 2010, 12:50 AM
  2. I cant get the php include statement to work in the tpl_header file.
    By buxton1 in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 23 Oct 2009, 12:16 AM
  3. select admin_id, admin_name, admin_pass from zen_admin where admin_name =
    By coucho in forum Upgrading from 1.3.x to 1.3.9
    Replies: 3
    Last Post: 19 Jan 2008, 06:15 AM
  4. Get rid of the Sub Catergories in the Categories Box
    By wmorris in forum General Questions
    Replies: 3
    Last Post: 7 Aug 2007, 05:44 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg