I've tried and tried, but I can't get this to work. I use Joomla and I have 2 articles/pages, one for edit and one for posting the form. I have a database with all the matches for the World Cup coming up and I want my users to bet on the matches.

I have 2 tables - one with all matches like this (named vm_kampe):

|id |hhold   |uhold   |res  |
|1  |Rusland |Saudi   |NULL |
|2  |Egypten |Uruguay |NULL |
... and so on

and the other table is my coupon where my bets are stored(named vm_207 where 207 is my user-id, so every user gets its own table):

|id |resu |
|1  |2-1  |
|2  |1-3  |
... and so on.

So the id in vm_207 should connect to the id of the match in vm_kampe.

So I want a page, where I can update my bets, so I have this:

foreach($results as $row){     
echo '<div class="vm_kupon_row">     
<div class="vm_id"><input type="hidden" name="kampid[]" value="'.$row->id.'"></div>     
<div class="vm_kampe">'.$row->hhold.' - '.$row->uhold.'</div>     
<div class="vm_result"><input class="vm_resultat" type="text" name="resultat[]" placeholder="X-X" value="'.$row->resu.'"></div>



echo '<input type="submit" class="godkend-vm-kupon" name="submit" value="Godkend">';

That calls out all matches with an input field where the value is selected from my table vm_207 and it works. Now, if I change something I want to update, the form action calls this page:

$jinput = JFactory::getApplication()->input;
$kampid = $jinput->get('$kampid');
$resultat = $jinput->get('$resultat', 'string');

$fields = array(
$db->quoteName('resu') . ' = ' . $db->quote($resultat)

$conditions = array(
$db->quoteName('id') . '=' . $kampid


But it won't update anything.

Please help me make this work. If you need any more details just say so :)


  • Please do not post links to code, include it in your question as text formatted as code. Make it easy for people to help you, few people will bother to follow a link to help you out. Commented Apr 3, 2018 at 18:47
  • Also, edit your question to show the schema of the tables involved. Commented Apr 3, 2018 at 18:48
  • @SloanThrasher So, I editted my question :) Commented Apr 4, 2018 at 11:30
  • 1
    I would just like to say that generating a new table for each user seems like poor architecture. Why wouldn't you just create a single table and dedicate a column for the users' ids? This way you can write simple join queries. If there is a compelling reason to create a bunch of identically structured tables, I'd like to hear it. Commented Jun 11, 2018 at 11:42
  • 1
    Hi @mickmackusa :) You're right - it was bad architecture. I ended up with a single table as you suggested :) I just forgot about this post again afterwards. But I now have one table containing all users bets :) Commented Jun 13, 2018 at 10:55

1 Answer 1


It seems to me that you are missing the following lines (which effectively execute the update operation):

$result = $db->execute();

Can you check?

  • Wow, I didn't execute the operation :D Jesus ... Thank you :) Commented Apr 12, 2018 at 6:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.