Welcome Guest, Not a member yet? Register   Sign In
Weird problem trying to create/update a table with Model function
#11

[eluser]BoyBlue[/eluser]
Is this perhaps happening due to me using CI 2.0 and not the latest version?
#12

[eluser]InsiteFX[/eluser]
Your accessing these but they are not in your database table:

Unknown column ‘temp_email’ in ‘field list’

Try adding it to your database table, thats why your getting the error...

InsiteFX
#13

[eluser]BoyBlue[/eluser]
That's right, those items aren't in the "games" table I'm trying to read from...

So, here's a simplified version of what I'm trying to do(and I've probably screwed myself up along the way so thinking through it again will probably help you and me...)

Upon receiving the members link back from the "Verification Email"--

1. Update Data in the "member" table [working]

2. Create a new table($table_name) for tracking this member's activity [working]

3. Insert existing data into ($table_name) by...
3a. "getting/reading" specific data from the "games" table [where error hangs up]
3b. "inserting" that specific data from "games" into the new table($table_name)

So, the error is correct that "confirm_email" is not found in the "games" table...but I'm not requesting SELECT "confirm_email etc" in the "games" table. I'm only requesting SELECT "game_id" and "base_number" for the "games" table. The table that has "confirm_email etc" is the "members" table. But, for some reason in the "get_game_data" function it is including me asking for data SELECT "confirm_email etc" which I can't figure out why it's including that...because just before line 153 I'm only asking for SELECT "game_id" and "base_number"

Anyway, I hope that helps in helping me...
#14

[eluser]InsiteFX[/eluser]
Do a MySQL dump and show me your tables!

InsiteFX
#15

[eluser]BoyBlue[/eluser]
Sure no problem. Thanks for the help...

Members Table Data
Code:
-- phpMyAdmin SQL Dump
-- version 3.2.5
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Apr 14, 2011 at 05:12 PM
-- Server version: 5.1.44
-- PHP Version: 5.3.2

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

--
-- Database: `tester_main`
--

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

--
-- Table structure for table `members`
--

CREATE TABLE `members` (
  `member_id` int(10) NOT NULL AUTO_INCREMENT,
  `member_name` varchar(15) NOT NULL,
  `email` varchar(200) NOT NULL,
  `password` varchar(32) NOT NULL,
  `keep_logged` smallint(1) DEFAULT NULL,
  `temp_email` varchar(200) NOT NULL,
  `temp_password` varchar(32) NOT NULL,
  `confirm_password` varchar(32) NOT NULL,
  `table_name` varchar(15) NOT NULL,
  `birth_year` char(4) NOT NULL,
  `signup_date` datetime DEFAULT NULL,
  `username` varchar(32) DEFAULT NULL,
  `username_public` varchar(32) NOT NULL,
  `sex` enum('male','female') DEFAULT NULL,
  `language` varchar(30) DEFAULT NULL,
  `alt_language` varchar(30) DEFAULT NULL,
  `accept_terms` tinyint(4) NOT NULL,
   `3` int(11) NOT NULL,
  `5` int(11) NOT NULL,
  `9` int(11) NOT NULL,
  `12` int(11) NOT NULL,
  `13` int(11) NOT NULL,
  `19` int(11) NOT NULL,
  `20` int(11) NOT NULL,
  `69` int(11) NOT NULL,
  `84` int(11) NOT NULL,
  `92` int(11) NOT NULL,
  `135` int(11) NOT NULL,
  `153` int(11) NOT NULL,
  `160` int(11) NOT NULL,
  `213` int(11) NOT NULL,
  `230` int(11) NOT NULL,
  `231` int(11) NOT NULL,
  `232` int(11) NOT NULL,
  `233` int(11) NOT NULL,
  `234` int(11) NOT NULL,
  `235` int(11) NOT NULL,
  `236` int(11) NOT NULL,
  `237` int(11) NOT NULL,
  `238` int(11) NOT NULL,
  `239` int(11) NOT NULL,
  `240` int(11) NOT NULL,
  `242` int(11) NOT NULL,
  `243` int(11) NOT NULL,
  `244` int(11) NOT NULL,
  `245` int(11) NOT NULL,
  `246` int(11) NOT NULL,
  `member_status` varchar(100) NOT NULL,
  `total_games_rated` int(50) NOT NULL,
  `total_community_shared` int(50) NOT NULL,
  PRIMARY KEY (`member_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=252 ;

--
-- Dumping data for table `members`
--

INSERT INTO `members` VALUES(245, 'RF-jdV-mZyZ9', '[email protected]', '2c5504ab9a86164db22a92dc8793843d', NULL, '0', '0', '0', 'z-jdV-mZyZ9', '2005', '0000-00-00 00:00:00', NULL, '', 'male', 'English', 'nothing', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Greenie', 0, 0);

Games Table Data
Code:
-- phpMyAdmin SQL Dump
-- version 3.2.5
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Apr 14, 2011 at 04:58 PM
-- Server version: 5.1.44
-- PHP Version: 5.3.2

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

--
-- Database: `tester_main`
--

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

--
-- Table structure for table `games`
--

CREATE TABLE `games` (
  `game_id` int(11) NOT NULL AUTO_INCREMENT,
  `title` varchar(128) NOT NULL,
  `release_date` date DEFAULT NULL,
   `summary` text,
  `rate_at_signup` tinyint(1) NOT NULL DEFAULT '0',
  `base_number` float DEFAULT '0',
  PRIMARY KEY (`game_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4373 ;

--
-- Dumping data for table `games`
--

INSERT INTO `games` VALUES(1, 'Monopoly', '2002-12-25',  'Summary Info goes here.', 0, 3.88);
INSERT INTO `games` VALUES(2, 'Stratego', '2002-12-25',  'Summary Info goes here.', 0, 3.88);

$table_name Table Data
Code:
-- phpMyAdmin SQL Dump
-- version 3.2.5
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Apr 14, 2011 at 05:14 PM
-- Server version: 5.1.44
-- PHP Version: 5.3.2

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

--
-- Database: `tester_main`
--

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

--
-- Table structure for table `z-of1-NjUeh`
--

CREATE TABLE `z-of1-NjUeh` (
  `member_rating_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `game_id` int(10) DEFAULT NULL,
  `rated` int(10) DEFAULT NULL,
  `have_rated` int(10) DEFAULT NULL,
  `suggested_rating` int(10) DEFAULT NULL,
  `base_number` int(10) DEFAULT NULL,
  `wish_list` int(10) DEFAULT NULL,
  `member_review` int(10) DEFAULT NULL,
    PRIMARY KEY (`member_rating_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

--
-- Dumping data for table `z-of1-NjUeh`
--

I think that's all of it that is relevant for this function. I have other tables but they aren't being called in this function...

thanks so much for the help...
#16

[eluser]Unknown[/eluser]
who is who of redemption, who is a catastrophe?
#17

[eluser]BoyBlue[/eluser]
Very deep thought. Thanks...
#18

[eluser]BoyBlue[/eluser]
...
#19

[eluser]InsiteFX[/eluser]
I may be wrong here!
Code:
/*Turn temp_email to 0*/
'temp_email' => 0,

/*Turn confirm_password to 0*/
'confirm_password' => 0,

/*Turn temp_password to 0*/
'temp_password' => 0

You are using a varchar field, error might be caused by asigning an int vale try this.
Code:
/*Turn temp_email to 0*/
'temp_email' => '0',

/*Turn confirm_password to 0*/
'confirm_password' => '0',

/*Turn temp_password to 0*/
'temp_password' => '0'
I mean you have those fields set as NOT NULL but you are passing NULL values to them...

InsiteFX
#20

[eluser]BoyBlue[/eluser]
Thanks so much for that feedback. I changed those and everything worked the same way...though I'm grateful to have the improved code so that bugs don't come up later.

It actually doesn't seem like I'm having any problems at all on the Model functions "update_member()" or "create_member_table()". My only problem seems to be in the function "get_game_data()"...

For some reason, in the "get_game_data()" function when I try to do the 1st step of getting/reading just 2 columns of data from the "games" table(game_id and base_number) the function is thinking that I'm trying to SELECT game_id, base_number, PLUS temp_email, temp_password, confirm_password, and password(That's what the Error tells me anyway) but I'm only specifically asking in the SELECT statement just above "line 153" for game_id and base_number.

Why is the "get_game_data()" function including the extra items(temp_email etc) into my SELECT clause when I'm specifically stating only "game_id" and "base_number" for it to read/get?




Theme © iAndrew 2016 - Forum software by © MyBB