Welcome Guest, Not a member yet? Register   Sign In
DataMapper ORM v1.8.0

[eluser]costicanu[/eluser]
I used it in an entire app, but when I moved it online a huge problem was there:
A Database Error Occurred

Unable to connect to your database server using the provided settings.

Filename: /home/x17avct/public_html/third_party/datamapper/system/DB.php

Line Number: 150


Mysql server details:
Server version: 5.1.62-cll
Protocol version: 10



I used it many times, but now it has problems. Any help will be appreciated.

[eluser]WanWizard[/eluser]
That is a CI DB (mysql driver) error, and has nothing to do with Datamapper.

It is generated when mysql_connect() fails, so check your hostname, username and password. And the connection to the MySQL server if it's not local.

[eluser]costicanu[/eluser]
Well, I tried a simple connection script and passwords are well set in database.php

If you want to have a look at this strange thing I send you now some passwords.

[eluser]WanWizard[/eluser]
I can't tell you any more. The error is generated and displayed by CI's DB driver.

Datamapper doesn't have a DB layer, it just uses $this->db, like any other application.

[eluser]shenanigans01[/eluser]
Hello, I have a quick question about how to gather some data. I have two tables
users & scores

the users table has a field (card_id) along with id, name, etc
the scores table has some score information along with a field (card_id)

users can have many scores, but each score belongs to one user what I would like to-do is link via the (card_id) (which is where I'm lost) and then secondly once I have them linked as such would anyone be able to provide me a simple sample query to take one user and list all of their scores? So if my card_id is 9 I would like all the scores with the same card_id. Any help would be greatly appreciated. Thank you.

[eluser]Hakkai[/eluser]
I am having this error when I am trying to save it into the database.

Need some guidance, thank you.

Code:
Error Number: 1364

Field 'updated' doesn't have a default value

INSERT INTO `brands` (`brandname`, `created`) VALUES (1860868128, '2012-05-23 12:51:14')

Filename: /Users/chernsuentea/Works/shoppingcart/libraries/Datamapper.php

[eluser]WanWizard[/eluser]
@mikem562,

You can't do that. Relations are made on primary key -> foreign key, not on two foreign_keys. If you want all scores of a user with the same card_id, add a where "users.card_id = scores.card_id".

If a score belongs to a single user, it should contain user_id.

I don't really understand this card_id, from a normalisation point of view it doesn't add anything. For the user, there is a one-on-one between the card_id and the users id (as they are in the same record), so where ever you use card_id you can use the users id.

[eluser]WanWizard[/eluser]
@Hakkai

You don't post any code or a table structure, so I have to guess. I think you have a column called 'updated' which is defined 'NOT NULL' in your table, but you don't provide a value for it when you insert the record.

For Datamapper, if configured "created" is a field that gets added on INSERT, "updated" on UPDATE. Which means you can not define "updated" as NOT NULL, unless you have defined a default value for it in your table structure.

[eluser]Hakkai[/eluser]
[quote author="WanWizard" date="1337755356"]@Hakkai

You don't post any code or a table structure, so I have to guess. I think you have a column called 'updated' which is defined 'NOT NULL' in your table, but you don't provide a value for it when you insert the record.

For Datamapper, if configured "created" is a field that gets added on INSERT, "updated" on UPDATE. Which means you can not define "updated" as NOT NULL, unless you have defined a default value for it in your table structure.
[/quote]
thanks for the advice, I fix the issue already ;-)

[eluser]Hakkai[/eluser]
is there any solution for me to repopulate the form after validation has failed?

set_value is not functioning.




Theme © iAndrew 2016 - Forum software by © MyBB