Jump to content

cobalt-rose

Members
  • Posts

    20
  • Joined

  • Last visited

    Never

Everything posted by cobalt-rose

  1. Yer i googled it and could only find books that taught you how to program :s
  2. Thanks of the reply, but is there not any literature about it at all? or is it just a common fact. Thanks again
  3. Hello all, i was wondering whether you could help me with my ERD for my project. Would this be viable? here it is below Thanks in advance
  4. Hello there i am looking for a diagram/schema that basically illustrates how php/mysql/xhtml interact in a web page? As i wish to understand how it is all put together. Can anyone help? Many thanks C¬Rose
  5. Just wanted to know if there were any tutorials (or sample code) as to doing this? or how difficult it is. As i have only found packages in which you have to pay £30 odd for it ? I have a web app which out puts mysql table data and i need to export it to either a word (mail merge) and pdf doc Thanks C¬Rose
  6. o ok ill ask in the php section. do you know were i could find one though? thanks
  7. Ha ha, well basically i have a web app that shows client data in a table that is pulled from mysql. And i want to have a button that when pressed extracts invoice details for that client and put it in word to print out.
  8. Just wanted to know if there were any tutorials (or sample code) as to doing this? or how difficult it is. As i have only found packages in which you have to pay £30 odd for it ? Thanks C¬Rose
  9. Yes i do have a row that auto increments...so i do have a unique field
  10. How can i get unique values into the data table? do i have to use an array?
  11. That's the thing... it isn't passing and i am only getting the first row... I thought that as i put in the view jobs page <td class="table_results" id="' . $row['job_id'] . '" onclick=' . $LOADcreateJOB1 . '>' . $row['job_id'] . '</td> Which i thought would set the id of the table row to the id of the [job_id] that was pulled from the database then, i would be able to call the [job_id] on the profile page and select all the data where job_id(row from db) is equal to the [job_id] and display in the job profile page. This obviously isn't working so how would you suggest i go about it?
  12. Hey sorry i posted redundant code i have already added the 'second period' and it still did not work. I'm trying to get the job_id from the previous page which is a table: of jobs: BELOW: table with jobs from db <? if ($log_in = true){ $db_name = ""; $table_name = "job"; $connection = @mysql_connect("localhost", "", "") or die(mysql_error()); $db = @mysql_select_db($db_name, $connection) or die(mysql_error()); $sql = "SELECT * FROM $table_name"; $result = @mysql_query($sql) or die(mysql_error()); $numberofrows=mysql_num_rows($result); $LOADcreateJOB1 = "$('#page_contents').load('profile_job.php');" ; echo' <div id="rounded-corner"> <p class="title">View Jobs</p> <table class="jobs"> <tr> <th ><a class="table_header" >Job ID</a></th> <th ><a class="table_header" >Job Name</a></th> <th ><a class="table_header" >Company Name</a></th> <th ><a class="table_header" >Comapny ID</a></th> <th ><a class="table_header" >Job Status</a></th> <th ><a class="table_header" >% Complete</a></th> <th ><a class="table_header" >Contractor</a></th> </tr>'; while ($row = mysql_fetch_array($result)) { echo' <tr> <td class="table_results" id="' . $row['job_id'] . '" onclick=' . $LOADcreateJOB1 . '>' . $row['job_id'] . '</td> <td class="table_results" href="index.php">' . $row['job_name'] . '</td> <td class="table_results">' . $row['FK_company_id'] . '</td> <td class="table_results">' . $row['FK_company_id'] . '</td> <td class="table_results">' . $row['job_status'] . '</td> <td class="table_results">' . $row['pcnt_complete'] . '</td> <td class="table_results">' . $row['FK_contractor_id'] . '</td> </tr> </div>'; } } ?> <? echo'<html> <head> <link href="forms_css.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="jquery.js"></script> <link href="style.css" rel="stylesheet" type="text/css" /> </head> <body> </body> </html>'; ?> And then when a row is clicked on it opens up the "job profile page" but currently i am only getting data displayed into the profile when i click on the first row of data but when i click on any other row i still get just the first row that it put into the profile?? Do i need to put the data into an array [0] on the PAGE ABOVE? Below is my job profile page code which should show data collected form the row that was clicked on previously: <? echo'THIS IS THE JOB PROFILE PAGE'; if ($log_in = true){ $db_name = ""; $table_name = "job"; $connection = @mysql_connect("localhost", "", "") or die(mysql_error()); $db = @mysql_select_db($db_name, $connection) or die(mysql_error()); $sql = "SELECT * FROM $table_name WHERE job_id = [job_id]"; $result = @mysql_query($sql) or die(mysql_error()); echo'$GET_[job_id]'; while ($data=mysql_fetch_array($result)) { echo'<P>JOB ID:' . $data['job_id'] . '</P> <P> JOB NAME:' . $data['job_name'] . '</P> <P>COMPANY NAME:' . $data['company_name'] . '</P> <P> COMPANY ID:' . $data['company_id'] . '</P> <P> CONTACT FORENAME:</P>' . $data['contact_fname'] . '</P> <P> CONTACT SURNAME:</P>' . $data['contact_sname'] . '</P> <P> JOB STATUS:</P>' . $data['job_status'] . '</P> <P> COMPLETE PERCENTAGE:</P>' . $data['pcnt_complete'] . '</P> <P> CONTRACTOR:</P>' . $data['contractor'] . '</P> '; } } ?> <html> <head> </head> <body> P </body> </html> Hope this helps you understand at what ii am trying to do Thank you for your time given so far, very much appreciated C¬Rose
  13. Thanks for the replies, i have tried to use the method that you both instructed and keep getting a parse error at line 17... im guessing its the quotes and how i have set them? <? echo'THIS IS THE JOB PROFILE PAGE'; if ($log_in = true){ $db_name = ""; $table_name = "job"; $connection = @mysql_connect("localhost", "", "") or die(mysql_error()); $db = @mysql_select_db($db_name, $connection) or die(mysql_error()); $sql = "SELECT * FROM $table_name WHERE FK_company_id = '$row[company_id]'"; $result = @mysql_query($sql) or die(mysql_error()); $data=mysql_fetch_array($result) echo'<P>JOB ID:</P>' . $data['job_id'] . '</P> <P> JOB NAME:</P>' . $data['job_name'] . '</P> <P>COMPANY NAME:</P>' . $data['company_name']'</P> <P> COMPANY ID:</P>' . $data['company_id']'</P> <P> CONTACT FORENAME:</P>' . $data['contact_fname']'</P> <P> CONTACT SURNAME:</P>' . $data['contact_sname']'</P> <P> JOB STATUS:</P>' . $data['job_status']'</P> <P> COMPLETE PERCENTAGE:</P>' . $data['pcnt_complete']'</P> <P> CONTRACTOR:</P>' . $data['contractor'] . '</P> '; } ?>
  14. Hey thanks for the reply, I have tried a script to display the information from the table and it does not display the [] just the text? Could you tell me where i am going wrong with this Cheers C¬Rose <? echo'THIS IS THE JOB PROFILE PAGE'; if ($log_in = true){ $db_name = ""; $table_name = "job"; $connection = @mysql_connect("localhost", "root", "") or die(mysql_error()); $db = @mysql_select_db($db_name, $connection) or die(mysql_error()); $sql = "SELECT * FROM $table_name WHERE FK_company_id = '$row[company_id]'"; $result = @mysql_query($sql) or die(mysql_error()); $data=mysql_fetch_array($result); echo'<P>JOB ID:</P>'; $data['job_id']; echo'<P> JOB NAME:</P>'; $data['job_name']; echo'<P>COMPANY NAME:</P>'; $data['company_name']; echo'<P> COMPANY ID:</P>'; $data['company_id']; echo'<P> CONTACT FORENAME:</P>'; $data['contact_fname']; echo'<P> CONTACT SURNAME:</P>'; $data['contact_sname']; echo'<P> JOB STATUS:</P>'; $data['job_status']; echo'<P> COMPLETE PERCENTAGE:</P>'; $data['pcnt_complete']; echo'<P> CONTRACTOR:</P>'; $data['contractor']; } ?>
  15. Hello all, i was wondering whether somebody could help me with a problem that i am having with my client contact web app. I am fairly new to php; and what i am trying to do is when a user clicks on the row of the table that displays all the jobs from the job table it opens up the profile-page for the selected job with all its details showing. I know i need to get the [id] from the table but i am unaware how to do this ... Any help would be greatly appreciated C¬Rose <? if ($log_in = true){ $db_name = ""; $table_name = "job"; $connection = @mysql_connect("localhost", "", "") or die(mysql_error()); $db = @mysql_select_db($db_name, $connection) or die(mysql_error()); $sql = "SELECT * FROM $table_name"; $result = @mysql_query($sql) or die(mysql_error()); $numberofrows=mysql_num_rows($result); $LOADcreateJOB1 = "$('#page_contents').load('profile_job.php');" ; echo' <div id="rounded-corner"> <p class="title">View Jobs</p> <table class="jobs"> <tr> <th ><a class="table_header" >Job ID</a></th> <th ><a class="table_header" >Job Name</a></th> <th ><a class="table_header" >Company Name</a></th> <th ><a class="table_header" >Comapny ID</a></th> <th ><a class="table_header" >Job Status</a></th> <th ><a class="table_header" >% Complete</a></th> <th ><a class="table_header" >Contractor</a></th> </tr>'; while ($row = mysql_fetch_array($result)) { echo' <tr> <td class="table_results" id="' . $row['job_id'] . '" onclick=' . $LOADcreateJOB1 . '>' . $row['job_id'] . '</td> <td class="table_results" href="index.php">' . $row['job_name'] . '</td> <td class="table_results">' . $row['company_name'] . '</td> <td class="table_results">' . $row['company_id'] . '</td> <td class="table_results">' . $row['job_status'] . '</td> <td class="table_results">' . $row['pcnt_complete'] . '</td> <td class="table_results">' . $row['contractor'] . '</td> </tr> </div>'; } } ?> <? echo'<html> <head> <link href="forms_css.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="jquery.js"></script> <link href="style.css" rel="stylesheet" type="text/css" /> </head> <body> </body> </html>'; ?>
  16. Ok thanks for your help so far. reply when ever you have the time to do so! Cheers, C~Rose
  17. Ahh thanks mate thats awesome! The query wasn't there as i took it out of the code before i posted (sorry). I didn't know how to 'populate' the next bit properly and have just been trying to understand how it would work from random bits of code (but thanks again!). I understand why you say that it should be the ID that they should be selecting but... I thought (from a user point of view) if you want to add a job for a company it would be easier to find the company by the company name: (James n Son) than either numbers (ID:12312) or letters (ID:JAS)??? Yes regarding adding the ID to the new table ( the once the company name is selected on the "do_add_job script" that will actually add the POST's to the database i am going to try and have a 2nd sql query that "SELECTS company_id FROM company WHERE company_name = '{$record[company_name]}'" the id returned will go into the jobs table as a foreign key under FK job_id field) Does that sound ok? Also could you just have a quick look at how i have set out my quotes for the calendar input? As everything seems to show up fine (textbox/small-calendar image) but when clicked it does not pop up with the calendar to select a date (So i'm guessing its to do with the quotes because its situated in a PHP script? and is not calling the 'NewCssCal' function) I even tried putting the href into a variable but am stil unable to get it to work... :S <? [color=green] $OPENcalendar = "javascript:NewCssCal(\'todays_date\',\'ddmmyyyy\')" ;[/color] echo'<br/> <div> <p class="addquote">Add Quote Form</p> <form class="center" name="newq" action="do_add_quote.php" method="post"> <table class="data"> <tr> <td>Todays Date</td> <td> <input type="text" id="todays_date" name="todays_date" size="5" )></input> [color=green]<a href=' . $OPENcalendar . '> <img src="sample/images/cal.gif" width="16" height="16" alt="Pick a date"></a>';[/color] echo'</td> </tr> <tr> <td>'; echo'<input type="text" id="hours2" name="hours" size="10" )></input> [color=red]<a href="javascript:NewCssCal(\'hours2\',\'ddmmyyyy\')"> <img src="sample/images/cal.gif" width="16" height="16" alt="Pick a date"></a>';[/color] echo'</td> </tr>'; </table><br/> </form> </div> <html> <head> <link href="forms_css.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="datetimepicker_css.js"></script> <script type="text/javascript" src="jquery.js"></script> <link href="rfnet.css" rel="stylesheet" type="text/css" /> <script language="javascript" type="text/javascript" src="datetimepicker.js"> //Date Time Picker script- by TengYong Ng of http://www.rainforestnet.com //Script featured on JavaScript Kit (http://www.javascriptkit.com) //For this script, visit http://www.javascriptkit.com </script> </head> <body> </body> </html>'; ?>
  18. Hello there and thank you for the response (I only started learning php last week so am quite the noob) I now see why i was unable to get the values (silly mistake on my part). * Regarding the Select Company Name.... This was left blank because the name that need to populate this have to come from the database (Because the 'user' will be selecting a adding a job for a company that is already in the database e.g. "SELECT company_name FROM company"). Do you know how i would go about this? That is weird because i have looked around for the majority of the day and a lot of answers suggested using javascript :S oh well! Thanks for your help
  19. I have searched for a solution and have seen that it is possible using javascript but the examples that i have seem to not work with my exact code. Could somebody assist me with getting this task done. All of the values from my form pass into the database except those with a drop down list. Hello, I have been searching for a long while on how to get the values from my drop down list and none of the methods that i have seen actually work with my code... :v: I have read that it is possible only using javascript? but i have also seen people say that it doable with php? i have tried both methods and i still cannot get the values to be entered into my database (All of the other fields enter except the fields that i have to select using a drop down Here is my code... <? echo'<br/> <div> <p class="addjob">Add Job Form</p> <form class="job_form" name="job_form" action="do_add_job.php" method="POST"> <table class="data"> <tr> <td>Job Name</td> <td> <input type="text" id="job_name" name="job_name" size="20"></td> <td ALIGN=CENTER> <tr> <td>Company Name</td> <td> <select name="Select Company Name">'; echo '<option value="">--Select Company Name--</option>'; while($opt = mysql_fetch_array($result)) { echo '<option value="' . $opt['company_name'] . '"></option>'; } echo'</select> $num <td id="fnamev" class="vn"></td>'; echo'<tr> <td>Start Date</td> <td>'; echo'<input type="text" id="start_date" name="start_date" size="10" )></input> <a href="javascript:NewCssCal(\'start_date\',\'ddmmyyyy\')"> <img src="sample/images/cal.gif" width="16" height="16" alt="Pick a date"></a>'; echo'</td> </tr> <tr> <td>End Date</td> <td> <input type="text" id="end_date" name="end_date" size="10" )></input> <a href="javascript:NewCssCal(\'end_date\',\'ddmmyyyy\')"> <img src="sample/images/cal.gif" width="16" height="16" alt="Pick a date"></a> </td> </tr> <tr> <td>Contractor for this job</td> <td> <SELECT id="contractor" name="contractor" > <option value="">--Select Contractor--</option> <OPTION VALUE=>James</OPTION> <OPTION VALUE=>John</OPTION> <OPTION VALUE=>Jim</OPTION> </SELECT> </td> </tr> <tr> <td>Contracted Hours</td> <td> <input type="text" id="contracted_hours" name="contracted_hours" size="5" ></input> </td> </tr> <tr> <td>Price</td> <td> <input type="text" id="job_price" name="job_price" size="10" ></input> </td> </tr> <tr> <td>VAT</td> <td> <input type="text" id="vat" name="vat" size="10" ></input> </td> </tr> <tr> <td>Status</td> <td> <SELECT id="job_status" name="job_status"> <option value="">--Select--</option> <OPTION VALUE="ns">Not Started</OPTION> <OPTION VALUE="o">Open</OPTION> <OPTION VALUE="c">Completed</OPTION> </SELECT> </td> </tr> <tr> <td>Cost of Job</td> <td> <input type="text" id="job_cost" name="job_cost" size="10" ></input> </td> </tr> <tr> <td>Job Created By</td> <td> <SELECT id="created_by" name="created_by"> <option value="">--Select--</option> <OPTION VALUE=>John</OPTION> <OPTION VALUE=>Jim</OPTION> <OPTION VALUE=>James</OPTION> </SELECT> </td> </tr> <tr> <td>Notes</td> <td> <TEXTAREA id="notes" name="notes" rows=4 size="110")></TEXTAREA> </td> </tr> <tr> <td> <button type="submit1">SUBMIT</button> <class="spacer"> <td> </tr> </table> <br/> </form> </div> <html> <head> <link href="forms_css.css" rel="stylesheet" type="text/css" /> </head> <body> </body> </html>'; ?> And my do_add_job.php code <? if ((!$_POST[job_name]) || (!$_POST[notes]) ) { header( "Location: add_client_form.php"); exit; } else { $db_name = ""; $table_name = "job"; $connection = @mysql_connect("localhost", "", "") or die(mysql_error()); $db = @mysql_select_db($db_name, $connection) or die(mysql_error()); $sql = "INSERT INTO $table_name (job_name, FK_company_id, date_started, date_finished, FK_contractor_id, hours, price, vat, job_status, created_by, cost, notes) VALUES ('$_POST[job_name]', '$_POST[company_name]', '$_POST[start_date]','$_POST[end_date]', '$_POST[contractor]', '$_POST[contracted_hours]', '$_POST[job_price]', '$_POST[vat]', '$_POST[job_status]', '$_POST[created_by]', '$_POST[job_cost]', '$_POST[notes]')"; $result = @mysql_query($sql, $connection) or die(mysql_error()); header("Location:adminpage.php"); exit; } ?> <HTML> <HEAD> <TITLE>add client</TITLE> </HEAD> <BODY> Any help would be greatly appreciated
×
×
  • 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.