Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8488703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:37:07+00:00 2026-06-10T21:37:07+00:00

In a nutshell a userID is being saved in the database that doesn’t exist

  • 0

In a nutshell a userID is being saved in the database that doesn’t exist anywhere else in code. I’m a beginner with PHP and Joomla, just finished a big component that was for the most part simple in what it does:

Component Description

  • Main screen has the list of all the users, filtered by department.
  • There are two main tables whose values are listed on that main screen. Click on a value, bring up the edit.php view.
  • The link to the Chapters table contains the user’s ID, a class ID, and if the record exists a record ID, and if not then the record ID gets populated on save using Joomla’s JForm native save functionality.
  • There are 9 chapters, so each user has up to 9 entries depending on what stage of completion they’re at.
  • Fill out the information, Save / Save & Close / Cancel are the only options.

Problem Description
– If the user has no entries at all for chapters 1-9, then a userID of 127 is saved. Where is the 127 coming from? No clue. If there’s an entry in one chapter then it works fine.

Code snippets:

To save: (view.html.php)

JToolBarHelper::apply('chapters.apply', 'JTOOLBAR_APPLY');
JToolBarHelper::save('chapters.save', 'JTOOLBAR_SAVE');

XML (chapters.xml)

<field name="chapter_userid"
  type="text"
  label="Student UserID"
  description=""
  size="10"
  readonly="true" 
  class="readonly"
/> 

Edit form: (edit.php)

<li> 
  <?php echo $this->form->getLabel('chapter_userid'); ?>
  <?php echo $this->form->getInput('chapter_userid', null, $this->UserID ); ?>          
</li>

HTML output for example user 170 (saved in the database as 127, Joomla says it was saved correctly):

<input type="text" name="jform[chapter_userid]" id="jform_chapter_userid" **value="170"** class="readonly" size="10" readonly="readonly"/>  

Stuff I’ve done:

  • Have debugging on

  • Lot of adding values to see what’s triggering this.

  • Searched entire html outputs (both main screen and edit.php) for “127” with debugging on – nothing

  • Used get_defined_vars() at the top of the edit screen, searched for 127 – nothing.

  • Pulled out out a lot of hair

I don’t understand why if userID=170 is correctly being passed all the way to the html output that it’s being saved as 127. Has anyone seen anything like this? Is there anything else I can do to debug? Places to check? I suspect that it’s some sort of value stuck in Joomla’s memory, but I also would have thought that get_defined_vars would have spit that out in some way. Or some sort of binary 2^8 offset by 1 (ok, so now I’m in MIDI land, but I’m desperate).

Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T21:37:08+00:00Added an answer on June 10, 2026 at 9:37 pm

    The 127 value was really bugging me, went through all the output and could find nothing out of place – turned out that not only did I have the wrong datatype set but I had the wrong idea of what datatypes were:

    http://matthom.com/archive/2006/11/28/mysql-integer-columns-and-display-width

    I was expecting no more than a three digit value, so setting it to TinyInt(4) seemed safe when really the () had nothing to do with the length of the value, only the display length.

    Hoping this helps out someone else.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code copied from C# 4.0 in a nutshell that uses Attribute/Reflection
In a nutshell I'm updating some code that uses CodeIgniter and I'm wasting a
In a nutshell on page1.php I have a calculator that consists of an HTML
In a nutshell, I have a solution that builds fine in the IDE, and
The Javadoc about String.intern() doesn't give much detail. (In a nutshell: It returns a
In a nutshell, I wish to create a query that will help me find
The problem in a nutshell is that in development mode we'd make changes to
In the book 'C++ In A Nutshell', there is the following example code std::vector<int>
As far as I read in a nutshell book, code contracts could degrade the
Browsing the code sample from C# 4.0 in a nutshell I came across some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.