$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 <
[email protected]> 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
> [email protected]
> http://liste.linux.org.tr/mailman/listinfo/linux-programlama
>



-- 
Elvin Şiriyev
http://siriyev.net
_______________________________________________
Linux-programlama mailing list
[email protected]
http://liste.linux.org.tr/mailman/listinfo/linux-programlama

Cevap