MySQL query + PHP : Warning: implode() [function.implode]: Bad arguments : What's wrong here?
| From: | jinxed | Date: | Thu, 21 Apr 2005 12:35:23 +0000 |
| Subject: | MySQL query + PHP : Warning: implode() [function.implode]: Bad arguments : What's wrong here? | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-39250@lists.php.net to get a copy of this message | ||
I have 2 tables employees & transactions. 'employees' carry info about the
employees and transactions carry there payslip info for each period.
I am trying to display a list of employees that don't have transactions in
the current ($pp_id) period,
thus doing an array of the $emp_ids, having transactions in the current
period
in order to exclude them in the next query.
I am using MySQL 4.1.11
Any help will be appreciated.
$pp_id = $_GET['pp_id'];
$t1 = "employees";
$t2 = "transactions";
$query = mysql_query("SELECT
emp_id FROM $t2 WHERE pp_id =
'$pp_id'");
while ($row = @mysql_fetch_array($query)) {
$emp_ids=$row['emp_id'];
}
line 83: $select_employee_query = mysql_query(" SELECT $t1.* FROM $t1
WHERE emp_id IN (" . implode(', ', $emp_ids) . ") ");
while ($row = @mysql_fetch_array($select_employee_query))
{
$var3=$row['emp_num'];
$var4=$row['emp_title'];
$var5=$row['emp_initials'];
$var6=$row['emp_surname'];
echo "$var3 $var4 $var5 $var6";
}
Warning: implode() [function.implode]: Bad arguments. in
../add_payslip1.php on line 83