|
-
March 2nd, 2011, 05:32 PM
#1
PHP and Flash Builder
hi all,
I will explain my problem, I hope you can help.
I am making an application in flash builder 4. This software uses the language php to connect to the database (I'm using the wampserver).
When I try to do an insertion in the database it returns me these errors:
php-error file:
PHP Fatal error: Call to a member function toString() on a non-object in C:\wamp\www\Maxiclinic\bin-debug\services\UtenteService.php on line 124
apache_error file;
[error] [client 127.0.0.1] File does not exist: C:/wamp/www/favicon.ico
and my php code:
PHP Code:
class UtenteService {
var $username = "root"; var $password = ""; var $server = "localhost"; var $port = "3306"; var $databasename = "clinic_db"; var $tablename = "utente";
var $connection;
/** 3306 * The constructor initializes the connection to database. Everytime a request is * received by Zend AMF, an instance of the service class is created and then the * requested method is invoked. */ public function __construct() { $this->connection = mysqli_connect( $this->server, $this->username, $this->password, $this->databasename, $this->port );
$this->throwExceptionOnError($this->connection); }
public function createUtente($item) {
$stmt = mysqli_prepare($this->connection, "INSERT INTO $this->tablename (Nome, Morada, CodigoPostal, SubCodigoPostal, Localidade, Profissao, Alerta, Telefone, Telemovel, Email, DataNascimento, EstadoCivil, SistemaSaude, NumeroUtente, BI, NumeroFiscal, MedicoFamilia, Foto, Habilitacoes) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); $this->throwExceptionOnError();
//mysqli_stmt_bind_param($stmt, 'ssiisisiissiiiiissi', $item->Nome, $item->Morada, $item->CodigoPostal, $item->SubCodigoPostal, $item->Localidade, $item->Profissao, $item->Alerta, $item->Telefone, $item->Telemovel, $item->Email, $item->DataNascimento->toString('YYYY-MM-dd HH:mm:ss'), $item->EstadoCivil, $item->SistemaSaude, $item->NumeroUtente, $item->BI, $item->NumeroFiscal, $item->MedicoFamilia, $item->Foto, $item->Habilitacoes); $stmt->bind_param('ssiisisiissiiiiissi', $item->Nome, $item->Morada, $item->CodigoPostal, $item->SubCodigoPostal, $item->Localidade, $item->Profissao, $item->Alerta, $item->Telefone, $item->Telemovel, $item->Email, $item->DataNascimento->toString('YYYY-MM-dd HH:mm:ss'), $item->EstadoCivil, $item->SistemaSaude, $item->NumeroUtente, $item->BI, $item->NumeroFiscal, $item->MedicoFamilia, $item->Foto, $item->Habilitacoes); $this->throwExceptionOnError();
mysqli_stmt_execute($stmt); $this->throwExceptionOnError();
$autoid = mysqli_stmt_insert_id($stmt);
mysqli_stmt_free_result($stmt); mysqli_close($this->connection);
return $autoid; }
Anyone know how I can fix?
thanks for the all help you can give
Plácido
Last edited by PeejAvery; March 2nd, 2011 at 09:09 PM.
Reason: Added PHP tags
-
March 2nd, 2011, 09:11 PM
#2
Re: PHP and Flash Builder
Please remember to search before posting. This is the #1 most asked question in PHP.
The variable on line 124 is either not an object-type variable or has not yet been created.
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|