Announcements | Last Post | |
---|---|---|
SoC Curricula | 09/30/2017 01:08PM | |
Demarcation or scoping of examinations and assessment | 02/13/2017 07:59AM | |
School of Computing Short Learning Programmes | 11/24/2014 08:37AM | |
Unisa contact information | 07/28/2011 01:28PM |
Extracting Data from database back to the form September 26, 2012 09:29PM |
Registered: 12 years ago Posts: 64 Rating: 0 |
Re: Extracting Data from database back to the form September 27, 2012 07:53AM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
Re: Extracting Data from database back to the form September 27, 2012 05:02PM |
Registered: 11 years ago Posts: 16 Rating: 0 |
Re: Extracting Data from database back to the form September 28, 2012 08:16AM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
Re: Extracting Data from database back to the form September 28, 2012 08:56AM |
Registered: 12 years ago Posts: 44 Rating: 0 |
Language: PHP$query= ';select * from users where user_id = '; . $user_id; $results = mysql_query($query); $row = mysql_fetch_array($results); echo ';<input type="text" name="textBoxName" value =" ';. $row[';first_name';].'; " >';;
Re: Extracting Data from database back to the form September 28, 2012 12:13PM |
Registered: 11 years ago Posts: 18 Rating: 0 |
Re: Extracting Data from database back to the form October 01, 2012 07:49AM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
Re: Extracting Data from database back to the form October 01, 2012 09:17AM |
Registered: 11 years ago Posts: 18 Rating: 0 |
Re: Extracting Data from database back to the form October 02, 2012 08:09AM |
Registered: 12 years ago Posts: 30 Rating: 0 |
Re: Extracting Data from database back to the form October 02, 2012 08:17AM |
Registered: 12 years ago Posts: 30 Rating: 0 |
Re: Extracting Data from database back to the form October 02, 2012 04:53PM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
Re: Extracting Data from database back to the form October 03, 2012 02:02PM |
Registered: 12 years ago Posts: 30 Rating: 0 |
Re: Extracting Data from database back to the form October 05, 2012 05:49AM |
Registered: 12 years ago Posts: 64 Rating: 0 |
Re: Extracting Data from database back to the form October 05, 2012 07:50AM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
Re: Extracting Data from database back to the form October 05, 2012 08:03AM |
Registered: 11 years ago Posts: 44 Rating: 0 |
Re: Extracting Data from database back to the form October 05, 2012 07:29PM |
Registered: 12 years ago Posts: 64 Rating: 0 |
Re: Extracting Data from database back to the form October 05, 2012 10:04PM |
Registered: 12 years ago Posts: 64 Rating: 0 |
Language: PHP$sql = "UPDATE top_data_capturers SET First_Name = ';$First_Name';, Surname = ';$Surname';, Facility = ';$Facility';, Section = ';$Section'; WHERE employee_number = ';$employee_number';"; $result = mysql_query($result);
Re: Extracting Data from database back to the form October 06, 2012 01:04PM |
Registered: 11 years ago Posts: 44 Rating: 0 |
This is wrong... It should be calling your $sql statement, like this...Language: PHP$result = mysql_query($result);
Then again your $sql statement for UPDATING, are you getting the info strait from your FORM or are you 1st set variables according to your FORM data?Language: PHP$result = mysql_query($sql);
Hope this helps.Language: PHP$sql = "UPDATE top_data_capturers SET First_name = \"$_POST[First_name]\", Surname = \"$_POST[Surname]\",...";
Re: Extracting Data from database back to the form October 06, 2012 08:56PM |
Registered: 12 years ago Posts: 64 Rating: 0 |
Language: PHP<?PHP include (';connect.php';); $employee_number = $_GET[';employee_number';]; $sql = "update top_data_capturers set First_Name = ';$_POST[';First_Name';]';, Surname = ';$_POST[';Surname';], Facility = ';$_POST[';Facility';]';, Section = ';$_POST[';Section';]'; where employee_number = ';$employee_number';"; $result = mysql_query($sql); mysql_close($db_handle); ?> Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in E:\EasyPHP-5.3.3\www\test\test.php on line 6
Re: Extracting Data from database back to the form October 07, 2012 01:35PM |
Registered: 18 years ago Posts: 35 Rating: 0 |
Language: PHP$sql = "update top_data_capturers set First_Name = ';$_POST[First_Name]';, Surname = ';$_POST[Surname], Facility = ';$_POST[Facility]';, Section = ';$_POST[Section]'; where employee_number = ';$employee_number';";
Re: Extracting Data from database back to the form October 07, 2012 07:36PM |
Registered: 12 years ago Posts: 64 Rating: 0 |
Language: PHP$sql = "update top_data_capturers set First_Name = ';$_GET[First_Name]';, Surname = ';$_GET[Surname], Facility = ';$_GET[Facility]';, Section = ';$_GET[Section]'; where employee_number = ';$employee_number';"; $result = mysql_query($sql); Notice: Undefined index: First_Name in E:\EasyPHP-5.3.3\www\test\test.php on line 70 Notice: Undefined index: Surname in E:\EasyPHP-5.3.3\www\test\test.php on line 70 Notice: Undefined index: Facility in E:\EasyPHP-5.3.3\www\test\test.php on line 70 Notice: Undefined index: Section in E:\EasyPHP-5.3.3\www\test\test.php on line 70
Re: Extracting Data from database back to the form October 08, 2012 08:44PM |
Registered: 11 years ago Posts: 44 Rating: 0 |
Language: PHP$sql = "update top_data_capturers set First_Name = ';$_GET[First_Name]';,
Re: Extracting Data from database back to the form October 08, 2012 09:17PM |
Registered: 12 years ago Posts: 64 Rating: 0 |
Re: Extracting Data from database back to the form October 08, 2012 09:38PM |
Registered: 18 years ago Posts: 35 Rating: 0 |
Re: Extracting Data from database back to the form October 09, 2012 05:46AM |
Registered: 12 years ago Posts: 64 Rating: 0 |
Language: PHP<html> <head> <title>Update List</title> </head> <body> <h1>Update List</h1> <form action="test.php" Method="get"> <input type="hidden" name="employee_number" value="<?PHP echo ';$employee_number';; ?>"> <input type="Submit" name="Submit" value="Update" /> </form> <a href=';read1.php'; >Return to List</a> </body> </html>
Language: PHP$sql = "update top_data_capturers set First_Name = ';$_GET[First_Name]';, Surname = ';$_GET[Surname]';, Facility = ';$_GET[Facility]';, Section = ';$_GET[Section]'; where employee_number = ';$employee_number';"; $result = mysql_query($sql) or die ("Query failed: ". mysql_error());
Re: Extracting Data from database back to the form October 09, 2012 06:33AM |
Registered: 12 years ago Posts: 64 Rating: 0 |
Re: Extracting Data from database back to the form October 09, 2012 07:21AM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
Re: Extracting Data from database back to the form October 09, 2012 09:52PM |
Registered: 12 years ago Posts: 64 Rating: 0 |
Language: PHP//check if the update button was clicked if (isset($_GET[';Submit';])) { $Submit = $_GET[';Submit';]; $First_Name = $_GET[';First_Name';]; $Surname = $_GET[';Surname';]; $Facility = $_GET[';Facility';]; $Section = $_GET[';Section';]; if(!$_GET[';Submit';]==';Update';) { echo "No!"; } else { echo "Yes!"; $sql = "update top_data_capturers set First_Name = ';$First_Name';, Surname = ';$Surname';, Facility = ';$Facility';, Section = ';$Section'; where employee_number = ';$employee_number';"; $result = mysql_query($sql) or die ("Query failed: ". mysql_error()); } }
Re: Extracting Data from database back to the form October 10, 2012 09:03AM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
Re: Extracting Data from database back to the form October 10, 2012 10:33AM |
Registered: 18 years ago Posts: 35 Rating: 0 |
Re: Extracting Data from database back to the form October 10, 2012 11:52AM |
Registered: 11 years ago Posts: 18 Rating: 0 |
Re: Extracting Data from database back to the form October 10, 2012 03:07PM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |