Jump to content

Dharmender

Members
  • Posts

    31
  • Joined

  • Last visited

About Dharmender

  • Birthday November 30

Profile Information

  • Gender
    Male
  • Location
    Delhi, India

Dharmender's Achievements

Member

Member (2/5)

1

Reputation

  1. My client wants to have backup and restore facility online. I have made online backup sql file. Now I want to allow user to upload sql file.
  2. I need to upload SQL file and run it in controller in cakephp. I am unable to execute using exec and shell_exec both returns errors i.e. exec given empty string and shell_exec gives null value. How to run mysql command using exec or shell_exec
  3. I want to display the items in tree structure with checkboxes. How can I get this. Suppose I have table Menus id, parent_id, menuname and Table operations menuid, roleid, edit ,delete, add, update How can I show the Menus in tree structure with add delete and edit checkboxes in front of them which dont have children
  4. I want to have role based access in Cakephp. I want that when I create a new Role the menu in tree structure should appear from where the admin can select the menu and operation. I have gone through ACl component but can't understand its functioning
  5. I tried xpdf. But its of no help. I have tried pdf2text also. but it returns text. I want the result in array so that I can further process it as per my need.
  6. I have a PDF file. I want to read the table in PDF file and store it in array Any suggestions
  7. I have a form where user uploads file i.e. Excel Sheet The data read from sheet is to be store in mysql database. The headers location is not fixed. So I need to search the header with the mysql table column name. Records below header are to be inserted into database. How can I search teh header row in Excel using cakephp
  8. View is not displaying error messages.Validation done at model level My view is add.ctp <?php echo $this->Session->Flash(); foreach($this->form->validationerrors as $errors) { echo $errors['Publishers']; } if(isset($updates)) { $id=$updates['Agreement']['id']; $pubname=$updates['Agreement']['publisherid']; } echo $this->Form->create('Agreement', array('action' => 'add', 'type' => 'file')); //echo $this->Form->file('File'); echo "<table><tr><td>Publisher Name</td><td>".$this->Form->input('Publishers',array('label'=>false,'default'=>@$pubname))."</td></tr>"; echo "<tr><td>Agreement File</td><td>".$this->Form->file('File',array('label'=>false))."</td></tr>"; echo "<tr><td colspan='2'>".$this->Form->input('id',array('label'=>false,'default'=>@$id,'type'=>'hidden'))."</td></tr>"; echo "<tr><td colspan='2'>".$this->Form->submit('Upload',array('label'=>false,'after' => $this->Html->link('Cancel', array('action' => 'view'))))."</td></tr></table>"; echo $this->Form->end(); ?> Model is <?php //License Agreements //Created By Dharmender On 8-2-2013 class Agreement extends AppModel { var $name = 'Agreement'; var $validate=array( 'Publishers' => array( 'rule' => 'notEmpty', 'message' => 'Please enter publisher name.' )); } ?> Controller is <?php class AgreementsController extends AppController { var $name = 'Agreements'; var $components = array('Session'); function add($id=null) { if($id!=null) { $updates=$this->Agreement->findById($id); $this->set('updates',$updates); } if(@$this->request->data['Agreement']['id']==NULL) { $this->Agreement->create(); if (!empty($this->request->data) && is_uploaded_file($this->request->data['Agreement']['File']['tmp_name'])) { $fileData = fread(fopen($this->request->data['Agreement']['File']['tmp_name'], "r"), $this->request->data['Agreement']['File']['size']); $this->request->data['Agreement']['name'] = $this->request->data['Agreement']['File']['name']; $this->request->data['Agreement']['type'] = $this->request->data['Agreement']['File']['type']; $this->request->data['Agreement']['size'] = $this->request->data['Agreement']['File']['size']; $this->request->data['Agreement']['data'] = $fileData; if($this->request->data['Agreement']['Publishers']=='ram') { $id2=1; } else { $id2=2; } $this->request->data['Agreement']['publisherid']=$id2; $this->request->data['Agreement']['createdon'] = date ('Y-m-d H:i:s'); if($this->Agreement->save($this->data)) { $this->Session->setFlash('File Uploaded Successfully!'); $this->Redirect('view'); } else { $this->Session->setFlash('Error in File Uploading!'); } } } else { $this->Agreement->id=$this->request->data['Agreement']['id']; if (!empty($this->request->data) && is_uploaded_file($this->request->data['Agreement']['File']['tmp_name'])) { $fileData = fread(fopen($this->request->data['Agreement']['File']['tmp_name'], "r"), $this->request->data['Agreement']['File']['size']); $this->request->data['Agreement']['name'] = $this->request->data['Agreement']['File']['name']; $this->request->data['Agreement']['type'] = $this->request->data['Agreement']['File']['type']; $this->request->data['Agreement']['size'] = $this->request->data['Agreement']['File']['size']; $this->request->data['Agreement']['data'] = $fileData; if($this->request->data['Agreement']['Publishers']=='ram') { $id2=1; } else { $id2=2; } $this->request->data['Agreement']['publisherid']=$id2; $this->request->data['Agreement']['createdon'] = date ('Y-m-d H:i:s'); if($this->Agreement->save($this->data)) { $this->Session->setFlash('Record Updated Successfully!'); $this->Redirect('view'); } else { $this->Session->setFlash('Error in File Updating!'); } } } }
  9. I need ajax pagination script with edit and delete options. I have created one but when I delete a record it doesnot get updated where as when i add or edit record it gets updated.
  10. I need to create a module where a user can upload csv,xml or excel file and the data from file can be inserted into MySql database.Any plugin which can do it
  11. You can use Ajax and jquery for onchange of dropdownlist value and submit the value. On that value show image $.("#drpdn).change(function(){ $.ajax({ type: "POST", url: "image.php", //your current php file data: 'drpdn':$("#drpdn").val(), dataType: 'html', success: function() { } }); }); get the value of drpdn and use it to find image corresponding to it like if(isset($_POST['drpdn'])) { $drpdn=$_POST['drpdn']; ///code to find image corresponding to $drpdn
  12. Using jquery. Can I select all checkboxes using single click in Jquery. How can I get the values of all checkboxes in jquery for single click action
  13. I have checkboxes with arrays like this foreach($result as $row) { <input type="checkbox" name="customers[]" value=$row['id'] />$row['name']<br>; } I want a CheckBox above all these on whose click all checkboxes of customer[] should be selected
  14. You can save the value of doctype in variable and use it or you can directly use it $result=mysql_query("SELECT * FROM comm_statement WHERE paycode = 'PAYJBARR'"); while($test = mysql_fetch_array($result)) { $id = $test['id']; $doctype=$test['doctype']; echo "<tr align='left'><font size='-2' face='Arial, Helvetica, sans-serif'>"; echo"<td>". $test['date']. "</td>"; echo"<td>" .$test['batch']."</td>"; echo"<td>" .$test['advisercode']."</td>"; echo"<td>" .$doctype."</td>"; echo"<td><a href ='../../documents/advisers/DMS/$doctype'>download</a>";
  15. If you take checkboxes name as an array <input type = "checkbox" name = "country[]" value="states">United states <input type ="checkbox" value = "uk" name="country[]">united kingdom <br> <input type = "submit" name ="submit"> You can get the value of checkboxes using loop foreach($_POST['country'] as $value) { echo 'Checked: '.$value.'; //You can put your code here }
×
×
  • 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.