Jump to content

MySQL Ajax Table Editor, index problem.


eleymonster

Recommended Posts

Hi,
I'm fairly new to the world of php and I'm working on a project using MySQL Ajax Table Editor (MATE).
I hope that maybe someone on here has some experience using MATE and can shine some light on my problem.

I have a page with a html select box. When a user makes a selection and submits it, the value is posted via php to another page which contains the MATE.

I'm trying to filter the results of the displayed table based on the value posted.
 

$this->Editor->setConfig('viewQuery',true);

$query = isset($_POST['id2']) ? $_POST['id2'] : '';
echo $query;
$this->Editor->setConfig('sqlFilters', "id = '".$query."'");

Below is the debug text of the query being executed:

select `purchase`.`ponumber`,
`purchase`.`id`,
concat(suppliers_0d594_0.sup_name) as `sup_id`,
concat(customers_54543_1.cust_name) as `cust_id`,
concat(cc.cat) as `cc_id`,
cc.markup as `markup`,
`purchase`.`DOP`,
`purchase`.`chargeable`,
`purchase`.`DESCR`,
`purchase`.`COG`,
`purchase`.`SRN`,
`purchase`.`charged`
from purchase
left join `suppliers` as `suppliers_0d594_0` on `purchase`.`sup_id` = `suppliers_0d594_0`.`sup_id`
left join `customers` as `customers_54543_1` on `purchase`.`cust_id` = `customers_54543_1`.`cust_id`
left join `cost_code` as `cc` on `purchase`.`cc_id` = `cc`.`cc_id`
where id = ''
order by `ponumber` desc limit 0, 20

As you can see the second last line WHERE id="" has no value. I don't understand why this is, it should take the value of $query.

I've echoed the variable $query and that displays the correct value. I've also used var_dump and that shows the echo of the $query variable to be a 1 character string, which is correct. However it shows the $query variable as being a 0 character string when it's within:

 
$this->Editor->setConfig('sqlFilters', "id = '".$query."'");

Can anyone shine some light as to why this is not working? 

Thanks,
Grant

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.