[Linux-programlama] Re: Connection Class

---------

[Linux-programlama] Re: Connection Class

From: Elvin Şiriyev <elvin_at_siriyev.net>
Date: Sat, 14 Mar 2009 13:01:18 +0200
Message-ID: <ded068c00903140401y12a90230g4e3a0d1baf4777b5@mail.gmail.com>

$result = mysql_query($sql, $this->connection); olarak deneyebilmisiniz.
orjinal hali : $result = mysql_query($this->connection, $sql); idi

On Sat, Mar 14, 2009 at 12:56 PM, Erdal YAZICIOGLU <
erdal.yazicioglu_at_gmail.com> wrote:

> Herkese merhabalar,
>
> Gözümden kaçan birşey var mı bilemiyorum ama sabahtan beri basit bir MySQL
> sorgusunu çalıştıramadım.. Devamlı aşağıdaki hatayı veriyor..
> Warning: mysql_query(): supplied argument is not a valid MySQL-Link
> resource
> in C:\Program Files\Apache Software
> Foundation\Apache2.2\htdocs\erdal.test\ch1\classes\class.Widget.php on line
> 19
> There was a problem: An error occured selecting from database
>
> Class aşağıda... Eğer yardımcı olursanız çok makbule geçer..Teşekkürler
>
> <?php
> class Ports{
>
> private $id;
> private $name;
> private $description;
> private $connection;
> private $update = false;
>
> public function __construct($switchID) {
> $this->connection = mysql_connect('localhost','root','xxx','xxx');
> if(!is_resource($this->connection)){
> throw new Exception('Unable to connect database server');
> }
> $sql = "SELECT \"name\", \"description\" FROM switches WHERE switchid =
> $switchID";
> $result = mysql_query($this->connection, $sql);
>
> if(!is_resource($result)){
> throw new Exception('An error occured selecting from database');
> }
> if(!mysql_num_row($result)){
> throw new Exception('The specified switch does not exist');
> }
> $data = mysql_fetch_array($result);
> $this->id = $switchID;
> $this->name = $data['name'];
> $this->description = $data['description'];
> }
>
> public function getName() {
> return $this->name;
> }
>
> public function getDescription(){
> return $this->description;
> }
>
> public function setName($name){
> $this->name = $name;
> $this->update=true;
> }
>
> public function setDescription($description){
> $this->description = $description;
> $this->update = true;
> }
>
>
> Tekrar çok teşekkürler
>
> Erdal YAZICIOGLU
> Field Project Engineer Manager
> Page Europa
> A GENERAL DYNAMICS COMPANY
> Ras Laffan Industrial City
> Doha, Qatar
> Mobile: +974 325 4479
>
> _______________________________________________
> Linux-programlama mailing list
> Linux-programlama_at_liste.linux.org.tr
> http://liste.linux.org.tr/mailman/listinfo/linux-programlama
>

-- 
Elvin Şiriyev
http://siriyev.net

_______________________________________________
Linux-programlama mailing list
Linux-programlama_at_liste.linux.org.tr
http://liste.linux.org.tr/mailman/listinfo/linux-programlama
Received on Sat 14 Mar 2009 - 11:45:21 EET

---------

Bu arsiv hypermail 2.2.0 tarafindan uretilmistir.