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 7503775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T21:20:53+00:00 2026-05-29T21:20:53+00:00

SQL: CREATE TABLE IF NOT EXISTS `photoalbums` ( `id` int(11) NOT NULL AUTO_INCREMENT, `title`

  • 0

SQL:

CREATE TABLE IF NOT EXISTS `photoalbums` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `title` varchar(200) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;

Model:

<?php defined('SYSPATH') OR die('No Direct Script Access');

    Class Model_PhotoAlbum extends ORM {}

?>

Controller’s action:

public function action_edit()
{
    $id = $this->request->param('id');
    $album = ORM::factory('photoalbum', $id);
    $this->template->album = $album;

    if ($this->request->post())
    {
        $album->title = $this->request->post('title');
        $album->save();
        $this->request->redirect('/');
    }
}

Every time I edit some album, ORM just insers new instance in DB instead of update it. I googled very well, but i can’t find the solution.
Also, i tried to use Jelly ORM and it caused this problem too.

UPDATE:

TWIG:

<!DOCTYPE HTML>
<html>
<head>
    <title>Фотоальбомы</title>
    <link rel="stylesheet" type="text/css" href="/media/css/main.css" />/>
    <script src="media/js/jquery-1.7.1.min.js" />
    <script src="media/js/main.js" />
</head>
<body>
    <h1>Новый фотоальбом</h1>
    <form action="/photoalbum/edit/" method="POST">
        <p>
            <label for="title">Название:</label><input type="text" id="title" name="title" value="{{ album.title }}" />
        </p>
        <p><input type="submit" value="Сохранить" /></p>
    </form>
</body>
</html>
  • 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-05-29T21:20:55+00:00Added an answer on May 29, 2026 at 9:20 pm

    The problem seems to be that you are not passing the ID to the controller in your form.

    Your form action should look like

    action="/photoalbum/edit/ALBUM_ID"

    or something similar.

    You are requesting the album ID with

    $id = $this->request->param('id');
    $album = ORM::factory('photoalbum', $id);
    

    But you have no parameter “id” in you Forms action.

    <form action="/photoalbum/edit/" method="POST">
    

    Or, you could send the ID as hidden field in you form, but then you have to get it with

    $id = $this->request->post('id');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two SQL statements: CREATE TABLE legs(legid INT PRIMARY KEY AUTO_INCREMENT NOT NULL,
SQL STRUCTURE CREATE TABLE IF NOT EXISTS `map` ( `id` int(11) NOT NULL AUTO_INCREMENT,
I have this sql statement: CREATE TABLE [dbo].[User]( [UserId] [int] IDENTITY(1,1) NOT NULL, [FirstName]
I have a sql server table: CREATE TABLE [Workflow].[MilestoneDate]( [MilestoneDateId] [int] IDENTITY(1,1) NOT NULL,
CREATE TABLE IF NOT EXISTS XY ( x INT NOT NULL , y FLOAT
12-31 23:21:15.285: I/System.out(1609): onCreate SQL 12-31 23:21:15.535: I/System.out(1609): CREATE TABLE IF NOT EXISTS la_table
Here is my sql: CREATE TABLE companyprinciple { userid INT, FOREIGN KEY (userid) REFERENCES
I have a mysql table like this (sql): CREATE TABLE IF NOT EXISTS silver_and_pgm
I have the following sql create statement mysql> CREATE TABLE IF NOT EXISTS `erp`.`je_menus`
Hello, I have the following sql table + data: CREATE TABLE IF NOT EXISTS

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.