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 |
2008 project May 13, 2009 11:19AM |
Registered: 15 years ago Posts: 36 Rating: 0 |
Language: PHP[b]amend1.php[/b] <?PHP session_start(); ?> <HTML> <?php $record = $_POST[';record';]; echo "Course id: $record<br><BR>"; $cname=cname; printf($_POST[';cname';]); //Connecting to MYSQL $con = mysql_connect("localhost","root",""); if (!$con) { die(';Could not connect: '; . mysql_error()); } mysql_select_db("registration", $con); //Select the database we want to use mysql_select_db("registration") or die("Could not find database"); $result=mysql_query(" SELECT * FROM course WHERE cid=';$record';"); $num=mysql_num_rows($result); $i=0; while ($i < $num) { // collect all details for our one reference $cid=mysql_result($result,$i,"cid"); $cname=mysql_result($result,$i,"cname"); $f=';<font face=Verdana,Arial,Helvetica size=2 Color=Blue';; ?> <TABLE WIDTH="100%" CELLPADDING="10" CELLSPACING="0" BORDER="2"> <TR ALIGN="center" VALIGN="top"> <TD ALIGN="center" COLSPAN="2" ROWSPAN="1" BGCOLOR="#F2F2F2"> <FORM ACTION="amend2.php" METHOD=POST> <P ALIGN="LEFT"> Course ID: <INPUT TYPE="text" cid="ud_cid" VALUE="<? echo "$record" ?>"> <P ALIGN="LEFT"> Course name: <INPUT TYPE="text" cname="ud_cname" Size="50" VALUE="<? echo "$cname" ?>"> </B><BR><BR> </P><P><INPUT TYPE="Submit" VALUE="Update the Record" NAME="Submit"> </P></FORM></TD></TR></TABLE> <? ++$i; } ?> [b]Amend2.php[/b] ?PHP session_start(); ?> <?php $ud_cid=$_POST[';ud_cid';]; $ud_cname=$_POST[';ud_cname';]; if ($ud_cid = "") echo "! No identifier retrieved"; else echo "Amending record $ud_cid"; //clean up any carriage returns etc //$ud_cname = preg_replace("/[\n\r]*/","",$ud_cname); //Connecting to MYSQL $con = mysql_connect("localhost","root",""); if (!$con) { die(';Could not connect: '; . mysql_error()); } //Select the database we want to use mysql_select_db("registration", $con) or die("Could not select database"); mysql_query(" UPDATE course SET cname=';$ud_cname'; WHERE cid=';$ud_cid';"); echo "<BR>Record $ud_cid Updated<BR><BR>"; ?> <?php //if you want to check it';s ok, display new data echo "Search on $ud_cid"; echo "<BR>"; //Connecting to MYSQL $con = mysql_connect("localhost","root",""); if (!$con) { die(';Could not connect: '; . mysql_error()); } mysql_select_db("registration", $con) or die("Could not select database"); $q="SELECT * FROM course WHERE cid =';$ud_cid';"; $result = mysql_query( $q, $con ) or die(" - Failed More Information:<br> <pre>$q</pre><br>Error: " . mysql_error()); $num_rows = mysql_num_rows($result); echo "<table border=0>\n"; echo "<tr><td></td><td></td><td></td><td></td></tr>\n"; do { printf("<tr><td>%s</td><td>%s</td>\n", $myrow["cid"], $myrow["cname"]); } while ($myrow = mysql_fetch_array($result)); echo "</table>\n"; //else { //echo "Sorry, no records were found"; //} mysql_free_result($result); mysql_close(); session_destroy(); ?>
Re: 2008 project May 14, 2009 08:41AM |
Registered: 15 years ago Posts: 29 Rating: 0 |
Re: 2008 project May 14, 2009 10:37AM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
Re: 2008 project May 14, 2009 11:42AM |
Registered: 15 years ago Posts: 29 Rating: 0 |
Language: PHPmysql_select_db("registration", $con); //Select the database we want to use mysql_select_db("registration") or die("Could not find database");
Language: PHP$cname=cname;
Language: PHP$result=mysql_query(" SELECT * FROM course WHERE cid=';$record';"); $num=mysql_num_rows($result); $i=0; while ($i < $num) { // collect all details for our one reference $cid=mysql_result($result,$i,"cid"); $cname=mysql_result($result,$i,"cname");
Re: 2008 project May 14, 2009 09:38PM |
Registered: 15 years ago Posts: 36 Rating: 0 |
Re: 2008 project May 15, 2009 10:59AM |
Registered: 15 years ago Posts: 29 Rating: 0 |
Re: 2008 project May 15, 2009 01:59PM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
Re: 2008 project May 15, 2009 09:52PM |
Registered: 15 years ago Posts: 36 Rating: 0 |
Re: 2008 project May 15, 2009 09:53PM |
Registered: 15 years ago Posts: 36 Rating: 0 |
Re: 2008 project May 15, 2009 10:30PM |
Registered: 15 years ago Posts: 36 Rating: 0 |
Re: 2008 project May 28, 2009 11:19AM |
Registered: 15 years ago Posts: 36 Rating: 0 |
Language: PHP<?php $link = mysql_connect("localhost", "root", "") or die("Could not connect: " . mysql_error()); mysql_select_db(';moviesite';, $link) or die ( mysql_error()); // DELETE SCRIPT if (!isset(!isset($_GET[';do';]) || $_GET[';do';] != 1) || $_GET[';do';] != 1) { ?> <p align="center" style="color:#FF0000"> Are you sure you want to delete this <?php echo $_GET[';type';]; ?>?<br> <a href="<?php echo $_SERVER[';REQUEST_URI';]; ?>&do=1">yes</a> or <a href="index.php">Index</a> </p>
Re: 2008 project May 28, 2009 01:10PM |
Registered: 15 years ago Posts: 8 Rating: 0 |
Re: 2008 project May 28, 2009 01:10PM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
Re: 2008 project May 28, 2009 02:24PM |
Registered: 15 years ago Posts: 36 Rating: 0 |
Re: 2008 project June 05, 2009 08:20AM |
Registered: 15 years ago Posts: 36 Rating: 0 |
Re: 2008 project June 05, 2009 09:19AM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |
Re: 2008 project June 09, 2009 01:36AM |
Registered: 15 years ago Posts: 36 Rating: 0 |
Re: 2008 project June 09, 2009 04:02PM |
Admin Registered: 18 years ago Posts: 10,001 Rating: 353 |