php class return
Posted: Tue Oct 13, 2009 7:00 am
Hello,
I'm kinda new to OOP PHP so this could be something easy to solve
I have here a class which fetches some rows in MySQL DB:
this should return an array with values.
I would like to fetch these values but with an if(in_array())
Someone knows how to do this?
Thanks
I'm kinda new to OOP PHP so this could be something easy to solve
I have here a class which fetches some rows in MySQL DB:
Code: Select all
<?php
class Contact
{
public function get_Contact($cl_number,$contact_id){
if(isset($cl_number)){
$sql = "SELECT * FROM tbl_client_contacts WHERE CUST_ID = '$cl_number' ";
$query = mysql_query($sql);
while($row = mysql_fetch_array($query)){
$contact[] = $row;
}
return $contact;
}elseif(isset($contact_id)){
$sql = "SELECT * FROM tbl_client_contacts WHERE CUST_ID = (SELECT CUST_ID FROM tbl_client_contacts WHERE ID = '$contact_id' ) ";
$query = mysql_query($sql);
while($row = mysql_fetch_array($query)){
$contact[] = $row;
}
return $contact;
}
}
}
?>I would like to fetch these values but with an if(in_array())
Someone knows how to do this?
Thanks