Data inserting blank into database

I am inserting data into the addresses of the customers in magento, I am able to add all the fields except the street field, would anyone know why? The data is not entered, does not show any error, the other fields are all text or select, so they will normally, this field has only one label, I get the database label, I give a var_dump and it returns me the addresses, but does not add, I think I'm wrong on setStreet1, setStreet2, setStreet3, setStreet4.

Would I have to enter these values ​​in any different way? How do I set this data in the database? Would I have set them differently? I put the data in the bank normally by its name, first_name = Firstname, and here I am trying to do the same thing, but in street it is different is like [street] [0], street. Other data are like [first_name], [last_name]. Because he opened another [] would I have to add it in another way?

The way I pull this information is this way

'rua'=>$usuario_loaded->getStreet1(), 'numero'=>$usuario_loaded->getStreet2(), 'complemento'=>$usuario_loaded->getStreet3(), 'bairro'=>$usuario_loaded->getStreet4()

                    $i = 1;

                    $link = mysqli_connect('localhost','root','','x');
                    $link->set_charset("utf8");
                    $query = "SELECT * from endereços";
                    $select = mysqli_query($link, $query);
                    foreach ($select as $key => $selects) {
                    $link = mysqli_connect('localhost','root','','x');
                    $link->set_charset("utf8");
                    $query = "SELECT * from endereços";
                    $select = mysqli_query($link, $query);
                    while($row = mysqli_fetch_array($select)){
                    $teste = array(
                            $endereço_id = $row['endereço_id'],
                            $nome = $row['nome'],
                            $assinatura = $row['assinatura'],
                            $sobrenome = $row['sobrenome'],
                            $rua = $row['rua'],
                            $numero = $row['numero'],
                            $complemento = $row['complemento'],
                            $bairro = $row['bairro'],
                            $cidade = $row['cidade'],
                            $país = $row['país'],
                            $estado = $row['estado'],
                            $cep = $row['cep'],
                            $telefone = $row['telefone'],
                            );

                            var_dump($teste);

                            $customer = Mage::getModel("customer/address");
                            $customer   ->setId($endereço_id)
                                        ->setFirstname($nome)
                                        ->setMiddlename($assinatura)
                                        ->setLastname($sobrenome)
                                        ->setStreet1($rua)
                                        ->setStreet2($numero)
                                        ->setStreet3($complemento)
                                        ->setStreet4($bairro)
                                        ->setCity($cidade)
                                        ->setCountryId($país)
                                        ->setRegionId($estado)
                                        ->setPostcode($cep)
                                        ->setTelephone($telefone)

                            try{
                                    $customer->save();
                                }
                                catch (Exception $e) {
                                    Zend_Debug::dump($e->getMessage());
                                }
                            }
                    }

Image

enter image description here

Solutions

I did, I simply had to add the data with an array. Changing only this line

-> setStreet (array ($rua, $numero, $complemento, $bairro))

Tags: PHP / Database / Magento

Similar questions

Column exists but throwing Column not found: 1054 Unknown column 'so.event_id' in 'where clause' while inserting into sales_order
I have event_id column in my sales_order table. I want to place an order & I am not sending event_id because its zero by default. When am trying to place an order, Its throwing me the error Column not found: 1054 Unknown column 'so.event_id' in 'where clause', query was: INSERT INTO sales_order ... Here is the error am getting in INSERT Query: ...
Inserting a value to the new field that I created in Magento database
my question might be lame for magento developers but I am very new to the platform. I added a new input field to my newsletter subscription called offer type as I am encouraging users to subscribe in order to get promo code. I added the input type hidden in the static page in app/code/core/Mage/Newsletter/controllers/SubscriberController.php I adde...
Integrity constraint violations when inserting data
I have a basic table that I've added through my module. This table simply holds a product ID and a JSON string. I am running an observer method via CRON. This method loops through the product collection and inserts a new row for each product that meets some basic conditions. When I run the cron process, I can watch the table start to populate with ...
Magento 2 - How to get attribute options array for inserting the data using rest api
I have json array for attribute options which is showing below: So I need that types of data by the magento 2 collection for particular attribute id or code. I need to add/edit attribute options data using rest api in magento 2 Please provide me collection, thanks in advance.
Inserting Products data programmatically
I'm getting product data from different store via curl call.Now i want insert all the product in my magento store. But only 3 products are inserting than i'm getting this error Uncaught exception 'Exception' with message 'Warning: Invalid argument supplied for foreach(). Any help will be appreciated Thanks
Custom attribute for customer is not inserting data
I have written the install script to insert the attribute on admin form. But when i click save it does not save the value. Below is the screen short. Prefer feel is the attribute.

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.