How can I see changes made by admin in the client page?What exactly I want is that I have few events in admin side when admin selects any of them the selected event must be viewed in the client page..How can I do that...Any help?
I used insert command..but i got an error.What eactly i want is in admin side i have few events and checkboxes.If i check those boxes the checked events shuld be displayed on the client page.so i worte my code like this
For loop is not a function and therefore does not return anything and thats why you are getting a syntax error. I am having a difficult time understanding your code though. On the admin form you are giving all the check boxes the same name which is 'chkbx'. Take a look at the html that your php is generating. If you want want to name your check boxes as chkbx0, chkbx1 and so on you have to explicitly do so. So try something like the following:
And I really don't think that the second query you created will do what you want either. It wouldn't execute and if it did it would create a new row in table eventdesc and insert everything thats in the array chkbox (which doesn't really exist at this point) in a single cell called show. And it will do this step for every entry in array chkbox. Perhaps you want something like this:
$value = $_POST[chkbx . $i];
$id = $_POST[id .$i]
mysql_query(UPDATE eventdesc SET show='$value' WHERE id='$id');
Note: You don't seem to have an unique id field in your code. But I think you should.
I sincerely recommend that you study sql INSERT, DELETE, UPDATE, JOIN, UNIQUE KEY, FOREIGN KEY before making web pages that rely on databases. Otherwise, you will struggle a lot.