Welcome Guest, Not a member yet? Register   Sign In
Inserting the data
#1

[eluser]piyush138[/eluser]
Hi, i am using doctrine (with codeigniter) in the following way to insert the data in the database everything is working fine but i am worried about these things
1. is this the right way to do that?
2. will it effect the server performance(page loadding)?
3. is there any other way to get the same functionality ?

here is the code

foreach($rows as $row){
$crd = new cma_records_data();
$crd->record_id = $cr_record_id;
$crd->user_id = 1;
$crd->address = $row['address'];
$crd->price = $row['price'];
$crd->recordListingID = $i;
$i++;
echo $row['address']." ".$row['price']."<br/>";
$crd->save();
unset($crd);
}


Thanks
#2

[eluser]saidai jagan[/eluser]
I don't know more abt doctrine Big Grin but some fine tuning ll help
Code:
$crd = new cma_records_data();
foreach($rows as $row)
{
  $crd->record_id = $cr_record_id;
  $crd->user_id = 1;
  $crd->address = $row[‘address’];
  $crd->price = $row[‘price’];
  $crd->recordListingID = $i;
  echo $row[‘address’].” “.$row[‘price’].”<br>”;
  $crd->save();
  $i++;
}
unset($crd);
hope it helps Smile
#3

[eluser]piyush138[/eluser]
By applying this technique it just inserts the last method ... what i want to know is can we create and destroy object like this in foreach Loop. doesn't it put effect on server performance.
#4

[eluser]danmontgomery[/eluser]
[quote author="piyush138" date="1265151473"]By applying this technique it just inserts the last method ... what i want to know is can we create and destroy object like this in foreach Loop. doesn't it put effect on server performance.[/quote]

Everything you do has an effect on server performance.




Theme © iAndrew 2016 - Forum software by © MyBB