deleting records using a checkboxes

2007-07-13 Thread hashkash

Hi,
The user selects multiple checkboxes and hits the delete button to
delete.
Thats where i get stuck.
Just to check if i can get the values of the checkboxes i did this.
My checkbox name is the user id itself.
function delete()
{
  $j=1;
  //print_r(($this-params['form']['check']['3']));
  $ids=$this-User-findall('','User.id','','','',0);
  foreach($ids as $lastid)
   $last=$lastid['User']['id'];
  print_r($last);
  while($j=$last)
  {
   if($this-params['form']['check'][$j] == on)
{
 echo hi;
}
   $j++;
  }
}
It works but i get
Notice: Undefined offset: 2,
Notice: Undefined offset: 4, etc.
I get that notice for checkboxes that i dint select.
Anyway out of this?
THanks!
Kashyap


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: searching records between 2 dates

2007-07-11 Thread hashkash

my mistake, i got it working now.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



searching records between 2 dates

2007-07-10 Thread hashkash

Hi!
I want to search for records between 2 dates.
This is what i have done but it doesnt seem to work

$date1=$this-data['Equipment']['dop1'];
$date2=$this-data['Equipment']['dop2'];
$conditions['Equipment']['dop']=BETWEEN {$date1} AND {$date2};

also
$warranty=$this-data['Equipment']['dow'];
$conditions['Equipment']['dow']=BEFORE {$warranty};

THen a findall($conditions);

Is there a [pop-up calendar available like in phpmyadmin?Ive heard of
the yahoo widget or so.
 Thanks!


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: searching records between 2 dates

2007-07-10 Thread hashkash

I checked the sql that executes and the dates dont seem to be
included.
why is this?
hoping for some help
thanks!
kashyap


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



search only entered fields

2007-07-09 Thread hashkash

Hi!
 I searched the group for my problem but in vain.  Sorry if this
is redundant.
I have created a search form having 4 fields to be filled up.  I would
like to base my search only on fields that have been filled up.With my
current findall() Im not able to do so.
How do I build the array string based on filled up fields?
I have assigned a buildsearch value i.e if the field is entered = 1
else = 0.In regular PHP i can create a buildsearchstring function but
with cake Im unable to figure out how to do so.

This is my findall()

$this-set('results', $this-Equipment-
findAll(array('Equipment.owner'=$conditions['Equipment']
['owner'],'Equipment.incharge'=$conditions['Equipment']
['incharge'],'Equipment.eqno'=$conditions['Equipment']
['eqno'],'Equipment.type'=$conditions['Equipment']
['type']),'',Equipment.owner ASC,'','',0));

Hoping for some help!
Thanks!
Kashyap


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: search only entered fields

2007-07-09 Thread hashkash

Thanks alot people!
Its working now.
Cheers!
Kashyap


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Search using values from a multiple select option

2007-06-06 Thread hashkash

Hi!
I have a multiple select option where the use can select 1 or more
owners.
I need to query the database based on the owners selected.
There was an article i read
http://groups.google.com/group/cake-php/browse_thread/thread/e6321043e861d1c1/cca8f2f008e7fb32?lnk=gstq=select+multiple+valuesrnum=1#cca8f2f008e7fb32
this is like A or B.What I need is A or B or C or. i.e it depends
on the number of owners selected.
For example if he selects owner1 and owner2 and enters 1234 as
equipment number
I need to check if
owner1 has 1234 equipment number
owner2 has 1234 equipment number i.e owner=owner1 or owner2
I can get the values from the multiple select option
array($conditions['owner'] in this case).
Im able to get it manually and that too only 1 value.
How do I get all the values and place it in the sql?
Hoping for some help
Thanks!
Kashyap


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Search using values from a multiple select option

2007-06-06 Thread hashkash

Thanks alot for the help on the OR condtions,but my problem related to
the checking the owners is based on the number of owners the user
selects.I cant code it directly.Its based on user selection.
Any idea?
Thanks!
Kashyap


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Search using values from a multiple select option

2007-06-06 Thread hashkash

$owners = array('1','2','3')
$equipment = $this-Equipment-findAll( array('Equipment.owner_id'=
$owners) );
Correct me if im wrong but from what grant Cox has written I construe
that there are only 3 owners.
In my case he no of owners keep growing as and when they register.
The owners are selected from a multiple select option.
Im not using a findAll() but using a query() because when i used the
findall()before posting on this group i got a few errors. so im using
the query().
Kashyap



On Jun 6, 12:37 pm, AD7six [EMAIL PROTECTED] wrote:
 On Jun 6, 9:32 am, hashkash [EMAIL PROTECTED] wrote:

  Thanks alot for the help on the OR condtions,but my problem related to
  the checking the owners is based on the number of owners the user
  selects.I cant code it directly.Its based on user selection.
  Any idea?

 don't use an OR and read what Grant Cox kindly already wrote? If that
 doesn't solve your problem explain why.

 hth,

 AD


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Search using values from a multiple select option

2007-06-06 Thread hashkash

here is a part of the controller code
http://bin.cakephp.org/view/486635630



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Querying values from a form

2007-05-31 Thread hashkash

Hi,
here is the link to my code.
http://bin.cakephp.org/view/1152843346
I need to query the database based on the data the user enters.
I have a multiple select and a few checkboxes.
The multiple select is to query the database with equipment having
owner names as those selected.
the checkbox is for the user to select what fields are to be displayed
after querying.
How do i go about the whole process of displaying the desired results.
Hoping for some help!
Thanks!
Kashyap


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



using select tag

2007-05-29 Thread hashkash

Hi!
I need to populate my drop down list with only owners and only
incharge users from my users table.
The Users table
username,password,first_name,owner,incharge,etc.
where owner and incharge are boolean fields to render the user as an
owner or incharge or both.
How do i populate the dropdown list based on this condition?i.e using
the selectTag


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: using select tag

2007-05-29 Thread hashkash

hey!
thanks alot for the help,will try it out once i get back to work tom.
But im guessing this solves my problem.
Thanks mate!
Cheers!
Kashyap

On May 30, 12:44 am, Walker Hamilton [EMAIL PROTECTED] wrote:
 look into using the form-input function. 
 (http://api.cakephp.org/1.2/class_form_helper.html#83ef190e216e07fb0a7...
 )

 'type'='select'
 'options'=$optionsArr

 then in your controller make optionsArr using generateList 
 (http://api.cakephp.org/1.2/class_model.html#27ff9de8aaff38950bee5f4ff...
 )

 Google search  API lookup are your friends!


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Conditional SelectTag

2007-05-28 Thread hashkash

Hi,
I need to create a drop down list which shows a list of owners.
I have a users table which indicates whether a users is an owner or an
incharge person.
The owner and incharge fields are boolean fields i.e owner field is 1
means owner,so on and so forth.
THere is another table called equipment where the user can add
equipment to the inventory.
To do so, the equipment must have an owner and incharge person.
users hasMany equipment
equipment belongsTo users
equipment hasOne owner
equipment hasOne incharge  //owner and incharge are foreign keys
how do I get to populate the owner and incharge drop down list with
only owners and incharge users?
Hoping for some help,
Thanks!
Cheers
Kashyap


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Problem displaying results using findBy()

2007-05-28 Thread hashkash

Hi,
 THis is my findBy()
$this-set('owners', $this-User-findByUsername($username, null, null,
1));

I use the var_dump($owners) to display the values in the form of an
array.Which displays the right data.I cant figure out how to display
this in the form of a table with select fields only.
The Users table has username,password,first_name etc.
The equipment table has equipment_no,serial_no,owner,incharge etc.
I want to display the above mentioned fields from the 2 tables i.e
when the user logs in he should be able to see the equipment he owns.

User hasMany Equipment
Equipment belongsTo Users
Equipment hasOne Owner
Equipment hasOne incharge //are the associations

Im unable to display this in the form of a table.

Hoping for some help
Thanks!
Kashyap


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Displaying the array

2007-05-28 Thread hashkash

Here is the array I obtain after a findByUsername().
$recursive=1, foreign key for equipment is owner i.e i wopuld like to
see only the owners equipment.
I want to print the Equipment part in the form of a table.Im unable to
figure out how.
Hoping for some help!
Thanks!

Array
(
[User] = Array
(
[id] = 1
[username] = hashkash
[password] = 7d7982cc30b26508c71c10836ec12840
[email] = [EMAIL PROTECTED]
[first_name] = Kashyap
[last_name] = Thimmaraju
[last_login] = 2007-05-29 04:18:36
[owner] = 1
[incharge] = 1
)

[Equipment] = Array
(
[0] = Array
(
[eqno] = 1234
[slno] =
[description] =
[specification] =
[owner] = hashkash
[incharge] = kashyap
[type] = computer
[dop] = 2007-05-22 09:38:32
[dow] = -00-00 00:00:00
[w_incharge] =
[w_phone] = 0
[w_addr] =
)

[1] = Array
(
[eqno] = 98765
[slno] = 12387
[description] = lfjksd
[specification] = uiofs
[owner] = hashkash
[incharge] = preeti
[type] = comp
[dop] = 2005-11-15 11:14:00
[dow] = 2006-01-17 14:15:00
[w_incharge] = murajkldf
[w_phone] = 1237843
[w_addr] = jklfdsnmvcl
)

)

)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



SQL or Cakephp

2007-05-26 Thread hashkash

HI,
I have 2 models
User and equipment(the owner is a field in the user table).
user hasMany equipment
equipment belongsTo user
equipment hasOne owner.
I need to display all equipment that a user owns when he logs in.
Even if I were to specify it in the conditions part of the association
how do I get the username dynamically to be specified in the SQL?
Please help!
Thanks!
Kashyap


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: SQL or Cakephp

2007-05-26 Thread hashkash

class User extends AppModel
{
var $name = 'User';
var $primaryKey = 'username';
var $hasMany = array ('Equipment'=
 array('className' = 'Equipment',
   'conditions'=
'Equipment.owner='$logged_in_username', how do I get this
variable
 
here?so that i can display only
 
the equipment the logged in user own
   'order' = '',
   'limit' = '5',
   'foreignKey'= 'owner',
   'dependent' = false,
   'exclusive' = true,
   'finderQuery'   = ''
 )
  );


var $validate = array(
'username' = VALID_NOT_EMPTY,
'incharge' = VALID_NOT_EMPTY,
'eqno' = VALID_NOT_EMPTY,
'type' = VALID_NOT_EMPTY,
);
}
?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Associating 2 or more models

2007-05-22 Thread hashkash

Hi,
I cant get my model association working.Im going through the manual
but Im not able to figure out where im going wrong.
I have a User model = username,password,id,type(owner/incharge/both)
and email.
primary key - id
then there is an Equipment model = type(product type),equipment
no,owner,incharge,dateofpurchse.
Primary key - eqno
Foreign Keys -owner,incharge
The user hasMany Equipment.
The owner and incharge people are different i.e they both reference
the users table.
How do I associate the models??
Please help me!
Thanks!
Kashyap


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Inventory management using cakephp

2007-05-22 Thread hashkash

Hi!
Im in quite a fix.
I have created 2 tables as of now
users
username,id,password,name,type(owner/incharge/both),email
Primary key - id
equipment
type,equipmentno,owner,incharge,dateofpurchase
Primary key - equipmentno
Foreign Keys - owner and incharge.
The User hasMany Equipment.Equipment can be owned by only 1 person.
I have created a form to add equipment.I need to validate the form by
checking whether the user has entered a valid owner name or not.
To do this I need to associate the models which I am unable to do.
Could you please help me out.
Thanks!


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Model association problem

2007-05-22 Thread hashkash

Hi!
Im in quite a fix.
I have created 2 tables as of now
users
username,id,password,name,type(owner/incharge/both),email
Primary key - id
equipment
type,equipmentno,owner,incharge,dateofpurchase
Primary key - equipmentno
Foreign Keys - owner and incharge.
The User hasMany Equipment.Equipment can be owned by only 1 person.
I have created a form to add equipment.I need to validate the form by
checking whether the user has entered a valid owner name or not.
To do this I need to associate the models which I am unable to do.
Could you please help me out.
Thanks!


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Inventory management using cakephp

2007-05-22 Thread hashkash

Hi!
Im in quite a fix.
I have created 2 tables as of now
users
username,id,password,name,type(owner/incharge/both),email
Primary key - id
equipment
type,equipmentno,owner,incharge,dateofpurchase
Primary key - equipmentno
Foreign Keys - owner and incharge.
The User hasMany Equipment.Equipment can be owned by only 1 person.
I have created a form to add equipment.I need to validate the form by
checking whether the user has entered a valid owner name or not.
To do this I need to associate the models which I am unable to do.
Could you please help me out.
Thanks!


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Model Associations

2007-05-19 Thread hashkash

Hi people!
Im new to cake.Im developing an inventory mangement system and would
like to know how to go about the model associations.
I have a users table which has a list of registered users.
Then there is a table called owners,which has the owner name and his
equipment.
I would like to create an index page where he logs in and can see all
equipment he owns.
how do i associate the models??
thanks!
kashyap


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---