0

Good Day,

I am trying to load some data from RedBean from my PHP table:

R::freeze( true );

$idfunctions=1; $function = R::load('functions', $idfunctions); if (!$function->id) { echo "...help bean not found!!.."; }

The table functions has a primary key column called idfunctions. However, the library keeps assuming my id column is "id". Is there anyway I can set it to idfunctions?

raaj
  • 2,869
  • 4
  • 38
  • 58

2 Answers2

1

Redbean expects certain schema configurations. One of them is a primary key named id. Please read this page carefully for the others. http://www.redbeanphp.com/schema

zewa666
  • 2,593
  • 17
  • 20
  • Sigh, I wish there was some kind of library that could automatically generate PHP Objects dynamically from my MySQL Table. I mean, I could technically develop one myself, albeit with a week or two of programming, but I'm surprised it doesn't exist yet – raaj Jan 28 '14 at 19:59
  • RB is doing exactly that but since there are different rdbms and ways to work with them there need to be some prerequisites to make it doing the job automatically. If thats a show-stopper for you check out the new roadmap. http://www.redbeanphp.com/roadmap – zewa666 Jan 29 '14 at 16:58
0

first of all , u cant change the "id" field. because it is already defined bydefault in "rb.php".

but if you want you can change there in rb.php file.But that is not a good idea to do that.

so better avoid this and follow the red bean schema type.

HAppy coding

jazs
  • 19
  • 3