
Dharmender
Members-
Posts
31 -
Joined
-
Last visited
Everything posted by Dharmender
-
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.
-
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
-
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
-
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
-
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.
-
I have a PDF file. I want to read the table in PDF file and store it in array Any suggestions
-
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
-
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!'); } } } }
-
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.
-
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
-
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
-
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
-
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
-
Using mysql field in a href using php echo
Dharmender replied to WAMFT1's topic in Third Party Scripts
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>"; -
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 }
-
in Your select statement remove single quote from $uid. Query should be $sql="SELECT * FROM students WHERE student_id=$uid"; And in your While loop use mysql_fetch_assoc($result) and in your code write row['filedname'] And if you want to use mysql_fetch_array the the code would be while($row[]=mysql_fetch_array($result)) { ///use $row[0] $row[1] etc.... }
-
I am java developer and now working on PHP. I Have learnt Drupal and CakePHP. but facing problems in simple PHP
-
1. How can we save it as csv. 2. Why not directly into .xls format
-
I have generated HTML table from Mysql data using PHP. I want to export this table to Excel. I have 'googled' a lot but not satisfied with it.
-
Saving runtime generated table rows in mysql database using php
Dharmender replied to reyhan's topic in PHP Coding Help
Why you are again and again connecting to database and generating it. Use it once at top of page. For generating table you can echo tr like this echo "<tr><td>"- 2 replies
-
- phpmysql
- javascript
-
(and 1 more)
Tagged with:
-
How to get next two records in PHP and MYSQL
Dharmender replied to Dharmender's topic in PHP Coding Help
It only displays current row. I want next two rows also to be displayed next to it. I have found the solution for it using mysql_data_seek($result,$i) Like This $result=mysql_query($sql); $j = mysql_num_rows($result) - 1; echo $j; for ($i=0;$i<=$j; ) { if (mysql_data_seek($result, $i)) { $row=mysql_fetch_assoc($result); //echo $row } if (mysql_data_seek($result, ++$i)) { $row=mysql_fetch_assoc($result); //echo $row } if (mysql_data_seek($result, ++$i)) { $row=mysql_fetch_assoc($result); //echo $row } } -
Parse error:syntax error,unexpected $event_date' (T_VARIABLE)
Dharmender replied to xanie's topic in PHP Coding Help
From where the value of $event_date is coming. Is it on form submit -
In Mysql query I want to display three records at time $sql="select id,name from supplierinfo"; $result=mysql_query($result); foreach($result as $row) { //display record here for current row // I want next two records here }
-
Listbox with checkboxes in PHP and MYSQL
Dharmender replied to Dharmender's topic in PHP Coding Help
I want listbox as given here http://demo.koolphp.net/Examples/KoolListBox/Features/CheckBoxes/index.php -
Listbox with checkboxes in PHP and MYSQL
Dharmender replied to Dharmender's topic in PHP Coding Help
I know this procedure. What I want is every option should have checkbox before it. Check this link http://demo.koolphp.net/Examples/KoolListBox/Features/CheckBoxes/index.php