Jump to content

simplysandeep

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

simplysandeep's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi I need some case studies of PHP driven systems being used in Engineering Companies like mining, electricity, Agriculture firms etc. What I'm trying to achieve is: demonstrating the importance of PHP web development/web driven systems in Engineering projects. Some scenarios are: - Intranet web portals which are used by several departments for storing Engineering data, complex calculations etc something like sharepoint being used in companies - Integration of several data systems with PHP - SAP-PHP integration - Web portals(PHP portals) used by the end users which get the data from complex data systems in the back end Can some one provide me some information on this? TIA
  2. Hi there In another forum. I got below response, but I did not understand this. Can some one please help me out? Response: I didn't read the fields so you'll have to adapt but it's more of a php question than a mysql question. You'd have to build a list of criterias and then implode them together. <code> $criterias = array(); if(isset($_POST['option1']) && $_POST['option1'] == 'yes'){ $criterias[] = '(mytable.myfield1 = 1) } if(isset($_POST['option2']) && $_POST['option2'] == 'yes'){ $criterias[] = '(mytable.myfield2 = 1) } $sql = 'SELECT * FROM mytable'.(count($criterias) > 0 ? ' WHERE '.implode(' OR ', $criterias) : '').' ORDER BY mytable.sortkey'; </code> This will help you build any kind of criteria list that you want. Note that i used OR in the implode because these criterias seem to be inclusive, so you show workers based on their type based on the user's choice. But i aint sure exactly if thats what you wanted. Note also that you can setup your criterias to be much more complex and combine two information together such as: <code> if(isset($_POST['option2']) && $_POST['option2'] == 'yes'){ $criterias[] = '(mytable.myfield2 = 1 AND mytable.location = "'.$_POST['location'].'") } </code>
  3. I've a simple Inset List (jQuery Mobile) of several items with a Flip switch, Drop down, check box and Slider elements. I have wrapped this Inset List inside a HTML Form. <code> [pre]<div data-role="fieldcontain"> <ul data-role="listview" data-inset="true"> <li data-role="list-divider"> Inhouse capabilities </li> <li> <label for="flip-b">Project Manager</label> <select name="slider" id="flip-b" data-role="slider"> <option value="no">No</option> <option value="yes">Yes</option> </select> </li> <li> <label for="flip-b">Site Supervisor</label> <select name="slider" id="flip-b" data-role="slider"> <option value="no">No</option> <option value="yes">Yes</option> </select> </li> <li><label for="flip-b">Architect</label> <select name="slider" id="flip-b" data-role="slider"> <option value="no">No</option> <option value="yes">Yes</option> </select> </li> <li><label for="flip-b">Builderworks</label> <select name="slider" id="flip-b" data-role="slider"> <option value="no">No</option> <option value="yes">Yes</option> </select> </li> <li><label for="flip-b">Electrical</label> <select name="slider" id="flip-b" data-role="slider"> <option value="no">No</option> <option value="yes">Yes</option> </select> </li> <li><label for="flip-b">Mechanical</label> <select name="slider" id="flip-b" data-role="slider"> <option value="no">No</option> <option value="yes">Yes</option> </select> </li> <li><label for="flip-b">Hydraulics</label> <select name="slider" id="flip-b" data-role="slider"> <option value="no">No</option> <option value="yes">Yes</option> </select> </li> <li><label for="flip-b">Joinery</label> <select name="slider" id="flip-b" data-role="slider"> <option value="no">No</option> <option value="yes">Yes</option> </select> </li> <li> <label for="select-choice-1" class="select">Main Location:</label> <select name="select-choice-1" id="select-choice-1"> <option value="NSW">NSW</option> <option value="ACT">ACT</option> <option value="VIC">VIC</option> <option value="SA">SA</option> <option value="QLD">QLD</option> <option value="NT">NT</option> <option value="WA">WA</option> <option value="TAS">TAS</option> </select> </li> <!-- Select Menus: Main Location--> <li> <div data-role="fieldcontain"> <fieldset data-role="controlgroup"> <legend>CBA Reference</legend> <input type="checkbox" name="checkbox-1a" id="checkbox-1a" class="custom" /> <label for="checkbox-1a">Commercial</label> <input type="checkbox" name="checkbox-2a" id="checkbox-2a" class="custom" /> <label for="checkbox-2a">Retail</label> </fieldset> </div> </li> </ul> </div> <!-- End of Field Contain div tag --> <a href="#additionalinfo" data-role="button" data-inline="true" data-iconpos="left" data-theme="b">Additional Info</a> <a href="./search2.html" rel="external" data-ajax="false" data-role="button" data-inline="true" data-icon="search" data-iconpos="left" data-theme="e">Search</a> [/pre]</code> I want to know, how I can include only the elements the user selected in my SQL query. Lets say, User wants to find the Electrical workers in QLD, then he will select Yes for Electrical and QLD as Main Location and the other items he would not touch. Now, how can I include only those two values in the select clause. Say, Select Electrical, Main Location from table where Main location='QLD'. I used POST method to gather users input. I use PHP, MySQL for this project. Any ideas on how to achieve this. Regards Sandeep
  4. Hi PHP gurus I'm a newbie in this PHP world and I'm working on a tough project (A multi-step questionnaire system). Note: To cut down the coding, I would like to do it for only 1 step. Overview of the Process: Questionnaires: - Step 1: Authenticated users will see a variety of questions (Multiple answers for checkboxes, Radio buttons for single answers, text areas, etc) - Step 2: After finishing the first step; Users will be given a second set of questions (Based on their responses in step 1) - Step 3: After finishing the second step; Users will be given a third set of questions (Based on their responses in step 2) (These steps can be five or 10 or 20) - Step n: After finishing the (n-1) step; Users will be given a nth set of questions (Based on their responses in step n-1) Reports: - Admin should be able to generate reports at various levels (for each question, each user, each step etc). Data input: - Questions are in a csv file. Sample data records: - {Question Number; Question Name; Question Type; Answers}; - {1; What features would you like to have in your car; Checkbox; GPS||Leather Seats||Rear Camera & Sensors||Media Center} My approach: Database Name: Questionnaire Database Tables: 1. tbl_user_details (username; password; name, email) 2. tbl_questions (qid; qname, qtype_id, qanswers) ---> Data (1; What features would you like to have in your car; T1; GPS||Leather Seats||Rear Camera & Sensors||Media Center) 3. tbl_question_types (qtype_id; qtype_name) ----> Data (T1, checkbox) 4. tbl_user_response (username; qid; qname; user_answer; timestamp) I did get successful in writing code in importing a CSV file into MySQL db table (tbl_questions) and also displaying that in an HTML form. Questions look like: <input type= "value from tbl_questions"> Answer value from tbl_questions I need your suggestions in linking the input types and multiple-answers... so that I can store data in anew table. TIA. <html> <style type="text/css"> </style> <body> <?php $database_host="localhost"; $username="root"; $password=""; $database="test"; mysql_connect($database_host,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); // $query="SELECT * FROM tbl_qn_csv_input"; $query2="SELECT * FROM tbl_qn_csv_input, tbl_qn_types WHERE tbl_qn_csv_input.qn_type = tbl_qn_types.qn_type_id"; // $result=mysql_query($query); $result2=mysql_query($query2); $num=mysql_numrows($result2); mysql_close(); ?> <form action="test_questionnaire_step2.php" method="POST"> <table border="1" cellspacing="0" cellpadding="0"> <tr> <th><font face="Arial, Helvetica, sans-serif">Question ID</font></th> <th><font face="Arial, Helvetica, sans-serif">Question Name</font></th> <th><font face="Arial, Helvetica, sans-serif">Answer </font></th> </tr> <?php $i=0; while ($i < $num) { $f1=mysql_result($result2,$i,"qid"); $f2=mysql_result($result2,$i,"qname"); $f4=mysql_result($result2,$i,"qn_type_name"); $f3=mysql_result($result2,$i,"qn_answer"); $array = explode("||", $f3); $count=sizeof($array); ?> <tr> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f1; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f2; ?></font></td> <?Php echo ("<td>"); foreach($array as $count ) { echo ("<p style='word-spacing:10px;'> "); echo ("<input type='"); echo $f4; echo("' name=a[]"); echo (">"); echo ("<font face='Arial, Helvetica, sans-serif'>"); echo $count; echo ("</font> </p>"); } echo ("</td>"); ?> </tr> <?php $i++; /* variables to be stored in the mysql table tbl_qn_report are $f1, $ f2, $f3, time stamp */ $query3= "INSERT INTO tbl_qn_report(qn_id, qn_name) values($f1, $f2)"; $result3=mysql_query($query3); } ?> </table> <br /> <input name="formsubmit" type="submit" value="Submit"> </form> <?Php ?> </body> </html>
  5. Thank you very much Drummin & Zane for your quick responses. I'm taking your inputs and recoding both my DB and PHP. My big problem is to link the input type say radio,checkbox or text area with the user responses. Since both the input type and answers/options are drawn from MySQL db. I will update you both, after recoding my PHP files. Thanks again.
  6. Thanks for your response. Can you please tell me, where I need to apply the Serialize() and on which array? For example: let's say a question with checkboxes (a,b,c,d) Which of these features would you like to have in your car? a. In built GPS b. Air bag c. Leather seats d. Media center The user may like all or some or none. (Let's say user wants In built GPS & Air bag) Below is how I would prefer data to be in a new table that stores users responses: Response_id, qid, response, 1, 1, In built GPS||Air bag Can you please suggest me how to achieve this???
  7. Thanks for the information. I did not know that. Here's my code: <html> <style type="text/css"> </style> <body> <?php $database_host="localhost"; $username="root"; $password="Blinks524!"; $database="test"; mysql_connect($database_host,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); // $query="SELECT * FROM tbl_qn_csv_input"; $query2="SELECT * FROM tbl_qn_csv_input, tbl_qn_types WHERE tbl_qn_csv_input.qn_type = tbl_qn_types.qn_type_id"; // $result=mysql_query($query); $result2=mysql_query($query2); $num=mysql_numrows($result2); mysql_close(); ?> <form action="test_questionnaire_step2.php" method="POST"> <table border="1" cellspacing="0" cellpadding="0"> <tr> <th><font face="Arial, Helvetica, sans-serif">Question ID</font></th> <th><font face="Arial, Helvetica, sans-serif">Question Name</font></th> <th><font face="Arial, Helvetica, sans-serif">Answer </font></th> </tr> <?php $i=0; while ($i < $num) { $f1=mysql_result($result2,$i,"qid"); $f2=mysql_result($result2,$i,"qname"); $f4=mysql_result($result2,$i,"qn_type_name"); $f3=mysql_result($result2,$i,"qn_answer"); $array = explode("||", $f3); $count=sizeof($array); ?> <tr> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f1; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f2; ?></font></td> <?Php echo ("<td>"); foreach($array as $count) { echo ("<p style='word-spacing:10px;'> "); echo ("<input type='"); echo $f4; echo("' name='A'>"); echo ("<font face='Arial, Helvetica, sans-serif'>"); echo $count; echo ("</font> </p>"); } echo ("</td>"); ?> </tr> <?php $i++; } ?> </table> <br /> <input type="submit" value="Submit"> </form> </body> </html>
  8. Hi there I have a MySQL database table that has multiple records which look like (1, Which of these are your favorite color(s)?, Red||Blue||Orange||Green, question-type1 ) I have written some PHP code in extracting that data into a HTML form. (The above data looks like a question with multiple options (radio buttons/checkboxes) below it). Below is what I'm trying to achieve: When the action is Submit: store the question number, user responses of the options , time stamp and user name into a new database table. I came to know that passing arrays will do the job, but I got stuck in the middle. Please see the attached documents that has the code. TIA [attachment deleted by admin]
  9. Hi everyone. I've two MySQL tables (tbl_csv_input & tbl_qn_types). Table Details: 1. tbl_csv_input (qid, qname, qn_answer, qn_type) Primary Key = qid; Foreign Key = qn_type ref tbl_qn_types qn_type_id 2. tbl_qn_types (qn_type_id, qn_type_name, notes) Primary Key = qn_type_id Sample Data: tbl_csv_input 1 ; Ferrari is the fastest car? ; Yes||No ; T1 2 ; Which below features would you like to have in you... ; Navigator||Airbag||Seat Belt||Camera & Sensors ; T1 3 ; Which model would you prefer? ; CX||MX||SX||LX ; T2 4 ; Comments ; ; T3 tbl_qn_types T1; checkbox; This qn type is used for yes/no T2; radio; Multiple options but only one is correct T3; text area; Users enter input like comments The whole idea is to have a questionnaire displayed in a HTML table depending upon the question types (T1, T2, T3) In simple terms: You have a question and below it there are options. Some questions have check boxes and some have radio buttons and some have text areas. The problem I'm facing is with the column: qn_answer; and column = qn_type. I'm unable to make a loop inside a table which is already in a loop. Please see the attached files (which has the code I've written). TIA. [attachment deleted by admin]
  10. Hi Guys I'm returning to programming after 5 years, almost a newbie. I have a field(column) in a MySQL database table that has strings of characters separated by a delimiter (||). For example: (TOM||PAUL||HARRIS) I would like to separate the strings into an array. Something like this: ARRAY[0] = 'TOM'; ARRAY[1]='PAUL'; ARRAY[3]='HARRIS'; Can some one tell me how to do this? TIA.
  11. Hi everyone... I would like to implement a questionnaire/survey system that has only two Answers (Yes /No). Basically, this questionnaire system will be widely used on Mobile Phones. It will be looking something like this below: http://awardwinningfjords.com/2009/06/16/iphone-style-checkboxes.html Lets say a user selects a response as No (Using the above slider button for a question). That response should be recorded in the database with User Details + Time Stamp. Also, I would like to generate a report for each question (Responses of Multiple Users) and a report at a User Level for the entire questionnaire/survey (s). Can some one guide me the fastest & easiest way to achieve this? I'm a new learner of PHP. Regards Sandeep
  12. Hi I have a website that is optimized for mobile. Now I would like to have a function/feature that can use the phone's GPS or google maps and give directions to my business place from the users current location. Other thing is: when users go to contact page, they will see some phone numbers. When user touches a phone number I want the phone dialer to open with the number, & ready to be dialed. Can some one give me suggestions or references... TYI.
×
×
  • 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.