JaYwzx Wong
JaYwzx Wong

Reputation: 1387

How can I auto renew data from MySQL without refresh?

I create dropdown fields to show the data from a MySQL database. Everytime when I key in new data, it must refresh to read the new data. I know Ajax can do it as well. But any other idea to solve this problem without refreshing to get the new data? Just when new data key in, it will auto renew without pressing F5 or refresh.

This is my code:

<th  style="width:25%"><font><div align="left">Select Product :</div></font>
    <?php echo $form->input('Product',array(
        'label'    => 'Select Products',
        'options'  => $products,
        'id'       => 'product',
        'style'    => 'width:250px;height:100px',
        'selected' => $html->value('Product.Product'),
        'onchange' => 'List();')); ?>
</th>
<th >

Upvotes: 0

Views: 787

Answers (3)

James
James

Reputation: 8586

I think at that point your only option is to get a magical update fairy which performs updates without performing updates.

Seriously though, Ajax isn't that hard for something this simple.

Upvotes: 1

Pesse
Pesse

Reputation: 411

The only way to do this without a refresh is with Ajax (httpRequest). There is, of course, the possibility, that you put your select box into an iFrame and refresh only this, but I think that's bad practice. Why wouldn't you use Ajax?

Upvotes: 0

unorsk
unorsk

Reputation: 9429

There is such thing as comet. With use of it you can make action to happen in browser by the server side's willing.

Upvotes: 0

Related Questions