note 73806 added to ref.classobj

From: Date: Sun, 11 Mar 2007 08:56:31 +0000
Subject: note 73806 added to ref.classobj
Groups: php.notes 
Request: Send a blank email to php-notes+get-124317@lists.php.net to get a copy of this message
Hi guys, I'm using a class with a function like this: <?php function setStatus($set, $condition) { $m = 0; $q = "UPDATE archivos SET archivos.estado = '".$set."' WHERE archivos.id = '".$this->id."'"; if(isset($condition)) { $q .= " AND archivos.estado = '".$condition."'"; $m++; } $q .= " LIMIT 1"; $query = mysql_query($q, $this->connexio); $queryB = mysql_query('SELECT * FROM archivos WHERE archivos.id = '.$this->id.' LIMIT 1', $this->connexio); $dataB = mysql_fetch_assoc($queryB); if($dataB['estado'] == $set) { $this->url = $set; return true; } else { if($m > 0) { return true; } else { return false; } } } ?> and what I want to know is... how can I do to declare that the second argument ($condition) it's optional, because I'm always seeing that: Warning: Missing argument 2 for files::setStatus() in /home/d191470/public_html/plataforma/class/files.php on line 175 ---- Server IP: 130.206.1.5 Probable Submitter: 87.219.240.135 ---- Manual Page -- http://www.php.net/manual/en/ref.classobj.php Edit -- https://master.php.net/note/edit/73806 Del: integrated -- https://master.php.net/note/delete/73806/integrated Del: useless -- https://master.php.net/note/delete/73806/useless Del: bad code -- https://master.php.net/note/delete/73806/bad+code Del: spam -- https://master.php.net/note/delete/73806/spam Del: non-english -- https://master.php.net/note/delete/73806/non-english Del: in docs -- https://master.php.net/note/delete/73806/in+docs Del: other reasons-- https://master.php.net/note/delete/73806 Reject -- https://master.php.net/note/reject/73806 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#124317) next »