Can't add new relationship record (not a permissions issue)

A place for users and developers of the Xataface to discuss and receive support.

Can't add new relationship record (not a permissions issue)

Postby bdaley » Wed Nov 10, 2010 9:37 am

I have two tables for a small poll question app that I've written:

poll_questions

poll_choices

The relationship is one-to-many, as in one poll question can have many choices. I *believe* that I have configured the relationship properly. I am able to view AND edit existing poll choices, as they relate to a particular poll question. The problem arises when I attempt to add a new poll choice. After submitting the "add new poll choices record" form, the Xataface app returns the very same form again, only blank and without an error or success message.

Using firebug, I am able to see that all of the fields are being POSTed to Xataface. However, when I view the MySQL queries that are being run, there are no attempts to insert the new record. I am using the following PHP code to view the queries:

Code: Select all
define('DATAFACE_DEBUG_DB',true);


Please let me know if you need any more information. Much thanks.
bdaley
 
Posts: 5
Joined: Thu Jul 16, 2009 6:19 am
Location: Storrs, CT

Re: Can't add new relationship record (not a permissions issue)

Postby shannah » Wed Nov 10, 2010 10:13 am

Hard to comment with limited info. Can you post relevant table defs, and relationships.ini rules.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Can't add new relationship record (not a permissions issue)

Postby bdaley » Wed Nov 10, 2010 11:32 am

Thanks, I figured as much. I was just hoping for a quick solution to a common problem. Apparently not the case.

Anywho, here is the DB structure:

Code: Select all
CREATE TABLE IF NOT EXISTS `poll_choices` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `poll_question_id` int(10) unsigned NOT NULL COMMENT 'FK - Poll Questions',
  `choice` tinytext NOT NULL COMMENT 'Choice/Option for poll question',
  `votes` int(10) unsigned default '0' COMMENT 'Number of Votes',
  `order` tinyint(3) unsigned default '1' COMMENT 'Order to display',
  PRIMARY KEY  (`id`),
  KEY `poll_question_id` (`poll_question_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Choices/options for the poll questions' AUTO_INCREMENT=12799 ;

-- --------------------------------------------------------

--
-- Table structure for table `poll_questions`
--

CREATE TABLE IF NOT EXISTS `poll_questions` (
  `id` int(11) unsigned NOT NULL auto_increment,
  `date` date default NULL,
  `question` tinytext NOT NULL,
  `answer` tinytext,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Poll Questions and publish dates' AUTO_INCREMENT=2828 ;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `poll_choices`
--
ALTER TABLE `poll_choices`
  ADD CONSTRAINT `poll_choices_ibfk_1` FOREIGN KEY (`poll_question_id`) REFERENCES `poll_questions` (`id`) ON DELETE CASCADE;


Here is my relationships.ini definition for the poll_questions table:

Code: Select all
[Poll Choices]
__sql__ = "select * from poll_choices where poll_question_id='$id'"
bdaley
 
Posts: 5
Joined: Thu Jul 16, 2009 6:19 am
Location: Storrs, CT

Re: Can't add new relationship record (not a permissions issue)

Postby bdaley » Mon Nov 15, 2010 12:31 pm

Ah, figured it out. In relationships.ini...

[Poll Choices]

should have been...

[poll_choices]

Can't believe I missed that. Thanks anyway.
bdaley
 
Posts: 5
Joined: Thu Jul 16, 2009 6:19 am
Location: Storrs, CT


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 8 guests

Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved