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 |
Re: EDITING September 20, 2011 02:15PM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
Re: EDITING September 20, 2011 02:24PM |
Registered: 12 years ago Posts: 21 Rating: 0 |
Re: EDITING September 23, 2011 11:59AM |
Registered: 12 years ago Posts: 25 Rating: 0 |
Re: EDITING September 26, 2011 10:48AM |
Registered: 12 years ago Posts: 21 Rating: 0 |
Re: EDITING September 27, 2011 06:58AM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
Re: EDITING September 27, 2011 11:10AM |
Registered: 12 years ago Posts: 21 Rating: 0 |
Re: EDITING September 27, 2011 12:23PM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
Re: EDITING September 28, 2011 11:06AM |
Registered: 12 years ago Posts: 21 Rating: 0 |
Language: PHP//this is what is displayed in the address bar after clicking one of the edit link http://localhost/portfolio/edit.php?x_id = 0 //the following code is my simplify edit page <?php include(';connect.php';); $x_id = $_GET[';x_id';]; // catching the x_id from the list page echo" ID = $x_id"; //displaying the value to make sure the x_id is caught correctly in the edit page ?>
Re: EDITING September 28, 2011 12:43PM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
Re: EDITING September 28, 2011 01:22PM |
Registered: 12 years ago Posts: 21 Rating: 0 |
Re: EDITING September 28, 2011 01:30PM |
Registered: 12 years ago Posts: 21 Rating: 0 |
Re: EDITING September 28, 2011 01:52PM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
Language: PHPedit.php?x_id=0 // no spaces edit.php?x_id = 0 // spaces!
Re: EDITING September 30, 2011 12:34PM |
Registered: 12 years ago Posts: 21 Rating: 0 |
Re: EDITING October 04, 2011 10:46AM |
Registered: 12 years ago Posts: 20 Rating: 0 |
Re: EDITING October 04, 2011 12:34PM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
Re: EDITING October 07, 2011 03:17PM |
Registered: 12 years ago Posts: 19 Rating: 0 |
Language: PHPif (isset($_GET[';shop_name';]) && is_numeric($_GET[';shop_name';]) && $_GET[';shop_name';] > 0) { // query db $shop_name = $_GET[';shop_name';]; $result = mysql_query("SELECT * FROM stock WHERE shop_name=$shop_name") or die(mysql_error()); $row = mysql_fetch_array($result);
Re: EDITING October 07, 2011 05:03PM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
Re: EDITING October 15, 2011 11:01PM |
Registered: 12 years ago Posts: 3 Rating: 0 |
Language: PHP$query = "UPDATE supplies SET (item = $item, printed=$printed, notice=$notice, quantity=$quantity, price=$price) WHERE sup_id = $supID"; $result = mysql_query($query) or die("Query failed: ".mysql_error());
Re: EDITING October 15, 2011 11:52PM |
Registered: 12 years ago Posts: 3 Rating: 0 |
Language: PHP$query = "UPDATE supplies SET (item = $item, printed=$printed, notice=$notice, quantity=$quantity, price=$price) WHERE sup_id = $supID"; $result = mysql_query($query) or die("Query failed: ".mysql_error());
I'm not sure how to explain it, but the spaces in the values I put into the text fields caused problems with mysql. Just like how they cause problems when you send from mysql to php.Language: PHP$query = "UPDATE supplies SET (item = ';$item';, printed=';$printed';, notice=';$notice';, quantity=';$quantity';, price=';$price';) WHERE sup_id = ';$supID';"; $result = mysql_query($query) or die("Query failed: ".mysql_error());
Re: EDITING October 17, 2011 06:36AM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
Re: EDITING October 17, 2011 09:00AM |
Registered: 12 years ago Posts: 3 Rating: 0 |
Re: EDITING October 17, 2011 02:45PM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
Re: EDITING October 20, 2011 01:42PM |
Registered: 13 years ago Posts: 24 Rating: 0 |
Language: PHP//include connection <?PHP //declaration of variables $result = mysql_query("UPDATE music SET cd_title=';$cd_title';, artist_name=';$artist_name';, artist_surname=';$artist_surname';,price=';$price'; WHERE cd_id=';$cd_id';") or die(mysql_error()); ?> <html> <body> <FORM METHOD = ';POST'; ACTION ="edit.php" > <?php $cd_id=$_GET["cd_id"]; if (isset($_GET["cd_id"])) { //echo the cd_id value to test if you caught it from the list/database } $result = mysql_query("SELECT * FROM music WHERE cd_id =';$cd_id';") or die(mysql_error()); $rows = mysql_num_rows($result); while ($row=mysql_fetch_array($result)){ $cd_id=$row[';cd_id';]; $cd_title=$row[';cd_title';]; $artist_name=$row[';artist_name';]; $artist_isurname=$row[';artist_surname';]; $price=$row[';price';]; echo "CD Title:"; echo "<INPUT NAME = ';cd_title'; TYPE = ';TEXT'; VALUE = ';",$row[';cd_title';],"';>"; //echo the artist name //echo the artist surname //echo the price } ?> </FORM> </body> </html>
Re: EDITING October 20, 2011 04:53PM |
Registered: 13 years ago Posts: 24 Rating: 0 |
Language: PHP//connect to the database <?php //declare variables $result = mysql_query("UPDATE music SET cd_title=';$cd_title';, artist_name=';$artist_name';, artist_surname=';$artist_surname';,price=';$price'; WHERE cd_id=';$cd_id';") or die(mysql_error()); ?> //the form starts here with method as post and action as edit.php <?php $cd_id = $_GET["cd_id"]; if (isset ($_GET["cd_id"])){ //echo the cd_id value to test if you caught it from the list/database. It echoes properly } $result = mysql_query("SELECT*FROM music WHERE cd_id = ';$cd_id';") or die(mysql_error(); $rows=mysql_num_rows($result); while ($row=mysql_fetch_array($result)){ $cd_id=$row[';cd_id';]; $cd_title=$row[';cd_title';]; $artist_name=$row[';artist_name';]; $artist_isurname=$row[';artist_surname';]; $price=$row[';price';]; echo "CD Title:"; //echo "form elements with VALUE = '; ",$row[';cd_title';]," '; //echo the other elements the same way //with the hidden element here } ?> //end the form
Re: EDITING October 20, 2011 08:02PM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |