HughbertD
Members-
Posts
61 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
HughbertD's Achievements
Member (2/5)
0
Reputation
-
So far I have, select timediff(dateTimeFin, DateTimeStart) from calendar; I'm lost as to how to distinguish between meetings over 2 hours and to add them up by each company
-
Hi all, I have a table which holds information for meetings, in the form of, startDate (timestamp), finishDate(timestamp), meetingCompany (varchar). I want to: Add up the total amount of time spent in meetings for each different company. But only include meetings that are longer than 2 hours long. I haven't a clue how to do this, which is why I have come to you guys, I was told that this was possible in SQL but I had my doubts. If anyone can help I would really appreciate it
-
Hi all, I was wondering if there was a way of catching the foreign key constraint error from MYSQL in PHP. I want to inform the user, that they need to change the values of a row in order to delete it. Thanks for any help
-
[TOPIC SOLVED] Probably a very simple bracket problem....
HughbertD replied to HughbertD's topic in PHP Coding Help
Ah-ha! Cheers big-ears! -
Hi all, I am getting an "unexpected }" here: echo $content; mysql_close($con) } To me it seems as though all my brckets add up nicely though? Am I missing something? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Bamboo : Placement Monitoring System</title> </head> <body> <?php if (isset($_POST['updatePlac'])) { $con = mysql_connect("localhost","root","michael"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("jostark", $con); $sql="insert into studentplacement values ('$_POST[id]','$_POST[placement]','$_POST[startdate]' ,'$_POST[enddate]')"; if (!mysql_query($sql,$con)) { echo ($sql); die('Error: ' . mysql_error()); } $id = $_POST[id]; echo "<b>Record Added Successfully</b>"; $url = "http://localhost/joStark/css/insertUpdateEdit/studentEdit.php?id=$id"; $content = file_get_contents($url); echo $content; mysql_close($con) } if (isset($_POST['updateStud'])) { $con = mysql_connect("localhost","root","michael"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("jostark", $con); echo " '$_POST[firstname]' '$_POST[mobilenum]'"; $sql="update student set courseID='$_POST[courseID]', firstName = '$_POST[firstname]', lastName = '$_POST[lastName]', otherName = '$_POST[otherName]', title = '$_POST[title]', houseNum = '$_POST[houseNum]', streetName= '$_POST[streetName]', postalTown = '$_POST[postalTown]', city = '$_POST[city]', postCode='$_POST[postCode]', county='$_POST[county]', country='$_POST[country]', termHouseNum='$_POST[termHouseNum]', termStreetName= '$_POST[termStreetName]', termPostalTown = '$_POST[termPostalTown]', termCity = '$_POST[termCity]', termPostCode='$_POST[termPostCode]', termCounty='$_POST[termCounty]', termCountry='$_POST[termCountry]', phoneNum='$_POST[phoneNum]', mobilePhoneNum='$_POST[mobilePhoneNum]', termPhoneNum='$_POST[termPhoneNum]', email='$_POST[email]', termEmail='$_POST[termEmail]', personalEmail='$_POST[personalEmail]', dateOfBirth='$_POST[dateOfBirth]', gender='$_POST[gender]', facebook='$_POST[facebook]', myspace='$_POST[myspace]', homeWebsite='$_POST[homeWebsite]' where studentID= '$_POST[id]'"; if (!mysql_query($sql,$con)) { echo ($sql); die('Error: ' . mysql_error()); } echo ($sql); // echo "<b>Record Added Successfully</b>"; //$url = "http://localhost/joStark/css/display/student/displayStudent.php"; //$content = file_get_contents($url); //echo $content; mysql_close($con); } ?> </body> </html>
-
Ok, apologies for being very lazy. I have a mySQL database holding information on students. The page itself, echos all the information from the db into the textboxes, and has a submit button at the very end of the page which sends the info to an update.php script which uses $_POST[values] to update the db. However, one <form> is referring to a different table in the database. Due to the design of the page it is halfway through my first form. I want the two forms to do two things. I thought that by doing; <form name=1> ...textboxes etc... </form> <form name=2> ..textboxes plus submit button... </form> <form name=1> ..the forms submit button... </form> I could get around it, but my $_POSTs dont pick up anything Thank for taking the time to help Hugh
-
Hi all, I have a PHP page. What I am trying to do is open a <form> which has text boxes in, close that form, then open a different form, close that form, open the first <form> so that I can include the submit button. My hoping was that if i reference by name, the information would come through after the submit. However, I get nothing. Can I actually do this with forms? Code is below but it is quite lengthy Thanks for any help you can give Hugh <?php $usr = "root"; $pwd = "michael"; $db = "jostark"; $host = "localhost"; #connect to database $cid = mysql_connect($host,$usr,$pwd); if (!$cid) { echo("ERROR: " . mysql_error() . "\n"); } mysql_select_db("jostark", $cid); ?> <?php $id=$_GET[id];?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script language="javascript"> function toolbar(url) { newwindow=window.open(url,'name','height=325,width=600'); if (window.focus) {newwindow.focus()} } </script> <script language="JavaScript" src="../javascript/calendar3.js"></script> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Bamboo : Placement Monitor</title> <script type="text/javascript" src="../add/tabpane/local/webfxlayout.js"></script> <link id="luna-tab-style-sheet" type="text/css" rel="stylesheet" href="../add/tabpane/css/luna/tab.css" disabled="disabled" /> <style type="text/css"> /* the bit that does the work */ body { margin:0; border:0; padding:0; height:100%; max-height:100%; background:#fff; font-family:arial, verdana, sans-serif; font-size:76%; overflow: hidden; margin-bottom: 10px; } /* for internet explorer */ * html body { padding:120px 0 50px 0; } * html #container { height:100%; width:100%; } * html #header {height:120px;} #footer { position:absolute; bottom:0; left:0; width:100%; height:45px; overflow:auto; text-align:right; background:#344E05; border-top:5px solid #507607; } * html #footer {height:50px;} /* end of bit that does the work */ h1 {font-size:4em; margin:0; padding:0;} #footer p { color:#CCF77D; margin:5px 10px 0 10px; } #header img { margin:8px 10px 10px 10px; } #container img {margin:5px;} #absolute { position:absolute; top:400px; right:100px; width:200px; background:#ddd; padding:10px; border:1px solid #000; } #left { float:left; background:#eee; padding:10px; border:1px solid #000; color:#000; width:50%; } #right { float:right; background:#ddd; padding:10px; border:1px solid #000; color:#000; } a:visited { font-size:1.1em; text-decoration:none; color:#ddd; } a:hover { color:#666666; text-decoration:none; } a:link { color:#808000; } .grey {color:#888;} .ltgrey {color:#ddd;} img#mascot {float:right;} #header ul { clear:both; text-align:center; border-top:1px solid #000000; } #header ul { margin:0; padding:0; list-style-type:none; background:transparent; height:1em; } #header ul li { display:inline; color:#000000; } .strike {text-decoration:line-through;} .lft {float:left;} .rgt{float:right;} .columnone, .columntwo {width:31%; float:left; text-align:justify; margin-right:2%;} .columnthree {text-align:justify; border:1px solid #fff;} * html .columnthree {border:0;} hr {clear:both; border:0; height:1px; color:#000000; background-color:#888;} .columnthree a, .columnthree a:visited {font-size:1em; color:#000; text-decoration:underline;} .columnthree a:hover {color:#888; text-decoration:none;} #header { position:absolute; top:0px; left:0px; width:100%; height:120px; overflow:auto; background:#283C04; border-bottom:4px solid #547C07; } #container { font-family:"verdana", serif; font-size: 0.9em; position:fixed; top:160px; left:0; bottom:50px; right:0; overflow:auto; background:#fff; padding:20px; text-align:center; color:#000000; } .style1 {color: #CCCCCC} </style> <script language="JavaScript" src="../javascript/calendar3.js"></script> <script type="text/javascript" src="../add/tabpane/js/tabpane.js"></script> </head> <body> <div id="header"> <div align="center"><img src="../img/bambooBannerTop.jpg" align="absmiddle" height="70" width="500" border="2"/></div> <ul> <li><a href="../index.html" title="AccessKey: 1" class="style1" accesskey="1">Home</a> | </li> <li><a href="../add/addData.php" title="AccessKey: a" accesskey="a">Add Data</a> | </li> <li><a href="http://localhost/joStark/css/display/displayData.php" title="AccessKey: b" accesskey="b">Display Data</a> | </li> <li><a href="../calendar/admin/calendar.php" title="AccessKey: c" accesskey="c">Manage Calendar</a> | </li> <li><a href="../export/export.php" title="AccessKey: d" accesskey="d">Export</a> | </li> <li><a href="../import/import.php" title="AccessKey: e" accesskey="e">Import</a> | </li> <li><a href="../help/help.php" title="AccessKey: f" accesskey="f">Help!</a> | </li> <li><a href="http://www.djduff.co.uk" title="AccessKey: h" accesskey="h">About the author</a></li> </ul> </div> <div id="footer"> <P align="right"><a href="javascript:toolbar('../toolbar/toolbar.php')"><img src="../img/cal.gif" border="0"/></a> <p align="right">Author: Hugh Downer | <a href="http://www.w3.org/Style/CSS/">CSS</a> | <a href="http://www.php.net">PHP</a> | <a href="http://www.mysql.com">MySQL</a></p> </div> <div id="container" align="center"> <?php # processed when form is submitted back onto itself if ($REQUEST_METHOD=="POST") { # setup SQL statement $SQL = " UPDATE student SET"; //$SQL = $SQL . " student.deptID = '$deptID', "; // $SQL = $SQL . " student.companyID = '$companyID', "; $SQL = $SQL . " student.firstName = '$firstName', "; $SQL = $SQL . " student.lastName = '$lastName', "; $SQL = $SQL . " student.otherName = '$otherName', "; $SQL = $SQL . " student.title = '$title', "; $SQL = $SQL . " student.houseNum = '$houseNum', "; $SQL = $SQL . " student.streetName = '$streetName', "; $SQL = $SQL . " student.postalTown = '$postalTown', "; $SQL = $SQL . " student.city = '$city', "; $SQL = $SQL . " student.postCode = '$postcode', "; $SQL = $SQL . " student.county = '$county', "; $SQL = $SQL . " student.country = '$country', "; $SQL = $SQL . " student.termHouseNum = '$termHouseNum', "; $SQL = $SQL . " student.termStreetName = '$ternStreetName', "; $SQL = $SQL . " student.termPostalTown = '$termPostalTown', "; $SQL = $SQL . " student.termCity = '$termCity', "; $SQL = $SQL . " student.termPostalCode = '$termPostCode', "; $SQL = $SQL . " student.termCounty = '$termCounty', "; $SQL = $SQL . " student.termCountry = '$termCountry', "; $SQL = $SQL . " student.phoneNum = '$phoneNum', "; $SQL = $SQL . " student.mobilePhoneNum = '$mobilePhoneNum', "; $SQL = $SQL . " student.termPhoneNum = '$termPhoneNum', "; $SQL = $SQL . " student.email = '$email', "; $SQL = $SQL . " student.termEmail = '$termEmail', "; $SQL = $SQL . " student.personalEmail = '$personalEmail', "; $SQL = $SQL . " student.dateOfBirth = '$dateOfBirth', "; $SQL = $SQL . " student.gender = '$gender', "; $SQL = $SQL . " student.facebook = '$facebook', "; $SQL = $SQL . " student.myspace = '$myspace',"; $SQL = $SQL . " student.homeWebsite = '$homeWebsite', "; $SQL = $SQL . " WHERE student.studentid = $id"; # execute SQL statement $result = mysql_query($SQL,$cid) or die (mysql_error()); # check for errors if (!$result) { echo("ERROR: " . mysql_error() . "\n$SQL\n"); } echo ("<P><B> Link Updated</B></P>\n"); } else { //$id=$_POST['$id']; $id=$_GET[id]; //echo "the id is $id\n"; # display edit form (not post method) # setup SQL statement to retrieve link # that we want to edit $SQL = "select * from (student left join studentplacement on student.studentid=studentplacement.studentid) left join placement on studentplacement.companyID=placement.companyid where student.studentid=$id"; # SELECT * FROM student, placement, studentplacement WHERE student.studentID= $id and student.studentid = studentplacement.studentid and placement.companyID = studentplacement.companyID"; // $SQL = $SQL . " WHERE id = $id "; # execute SQL statement $ret = mysql_query($SQL,$cid) or die (mysql_error() . "\n$SQL\n"); # retrieve values $row = mysql_fetch_array($ret); $courseID=$row["courseID"]; $firstName = $row["firstName"]; $lastName = $row["lastName"]; $otherName = $row["otherName"]; $title = $row["title"]; $houseNum = $row["houseNum"]; $streetName = $row["streetName"]; $postalTown = $row["postalTown"]; $city = $row["city"]; $postCode = $row["postCode"]; $county = $row["county"]; $country = $row["country"]; $termHouseNum = $row["termHouseNum"]; $termStreetName = $row["termStreetName"]; $termPostalTown = $row["termPostalTown"]; $termCity = $row["termCity"]; $termPostCode = $row["termPostCode"]; $termCounty = $row["termCounty"]; $termCountry = $row["termCountry"]; $phoneNum = $row["phoneNum"]; $mobilePhoneNum = $row["mobilePhoneNum"]; $termPhoneNum = $row["termPhoneNum"]; $email = $row["email"]; $termEmail = $row["termEmail"]; $personalEmail = $row["personalEmail"]; $dateOfBirth = $row["dateOfBirth"]; $$gender = $row["gender"]; $facebook = $row["facebook"]; $myspace = $row["myspace"]; $homeWebsite = $row["homeWebsite"]; ?> <table align="center" width="75%"> <tr> <td align="left"><b>Create a new student</b></td> </tr> </table> <br /> <table align="center" width="75%"> <tr><td align="center"> <div class="tab-pane" id="tabPane1" align="center"> <script type="text/javascript"> tp1 = new WebFXTabPane( document.getElementById( "tabPane1" ) ); //tp1.setClassNameTag( "dynamic-tab-pane-control-luna" ); //alert( 0 ) </script> <div class="tab-page" id="tabPage1" align="center"> <h2 class="tab" align="center">Name</h2> <script type="text/javascript">tp1.addTabPage( document.getElementById( "tabPage1" ) );</script> <form name="fa" action="updateStud.php" id="fa" method="post"> <INPUT TYPE="hidden" NAME="id" VALUE="<?php echo("$id"); ?>"> <fieldset><legend><b>Name</b></legend> <table border="0" width="100%"> <th align="center"></th> <tr> <td width="10%"></td> <td width="10%"></td> <td width="10%" align="right">Firstname:</td><td width="15%"><input type="text" name="firstname" value="<?php echo ("$firstName"); ?>" /></td> <td width="5%"></td> <td width="10%" align="right">Lastname:</td><td width="15%"><input type="text" name="lastname" value="<?php echo ("$lastName"); ?>" /></td> <td width="25%"></td> </tr> <tr> <td width="10%"></td> <td width="10%"></td> <td width="10%" align="right">Other Name:</td><td width="15%"><input type="text" name="othername" value="<?php echo ("$otherName"); ?>" /></td> <td width="5%"></td> <td width="10%" align="right">Title:</td><td width="15%"><input type="text" name="title" value="<?php echo("$title");?>" /></td> <td width="25%"></td> </tr> </table> </fieldset> </div> <div class="tab-page" id="tabPage2" align="center"> <h2 class="tab" align="center">Addresses</h2> <script type="text/javascript">tp1.addTabPage( document.getElementById( "tabPage2" ) );</script> <fieldset> <legend><b>Home Address</b></legend> <table border="0" align="center"> <tr> <td width="10%"></td> <td width="20%" align="right">House Name or Number:</td><td width="15%"><input type="text" name="housenum" value="<?php echo("$houseNum"); ?>" /></td> <td width="7%" align="right">Street:</td><td width="15%"><input type="text" name="streetname" value="<?php echo("$streetName"); ?>" /></td> <td width="12%" align="right">Postal Town:</td><td width="15%"><input type="text" name="postaltown" value="<?php echo("$postalTown"); ?>" /></td> <td width="7%"></td> <td width="10%"></td> </tr> <tr> <td width="10%"></td> <td width="13%" align="right">City:</td><td width="15%"> <input type="text" name="city" value="<?php echo("$city"); ?>" /></td> <td width="7%" align="right">Postcode:</td> <td width="15%"><input type="text" name="postcode" value="<?php echo("$postCode"); ?>"/></td> <td width="7%" align="right">County:</td> <td width="15%"><input type="text" name="county" value="<?php echo("$county"); ?>" /></td> </tr> <tr> <td width="10%"></td> <td width="7" align="right">Country:</td> <td width="10%"><input type="text" name="country" value="<?php echo("$country"); ?>" /></td> </tr> </table> </fieldset> <br /> <br /> <fieldset> <legend><b>Term Time Address</b></legend> <table border="0" align="center" width="100%"> <tr> <td width="10%"></td> <td width="14%" align="right">House Name or Number:</td><td width="15%"><input type="text" name="termhousenum" value="<?php echo("$termHouseNum"); ?>" /></td> <td width="7%" align="right">Street:</td><td width="15%"><input type="text" name="termstreetname" value="<?php echo("$termStreetName"); ?>" /></td> <td width="7%" align="right">Postal Town:</td><td width="15%"><input type="text" name="termpostaltown" value="<?php echo("$termPostalTown"); ?>" /></td> <td width="7%"></td> <td width="10%"></td> </tr> <tr> <td width="10%"></td> <td width="13%" align="right">City:</td><td width="15%"> <input type="text" name="termcity" value="<?php echo("$termCity"); ?>"/></td> <td width="7%" align="right">Postcode:</td> <td width="15%"><input type="text" name="termpostcode" value="<?php echo("$termPostCode"); ?>" /></td> <td width="7%" align="right">County:</td> <td width="15%"><input type="text" name="termcounty" value="<?php echo("$termCounty"); ?>" /></td> </tr> <tr> <td width="10%"></td> <td width="7%" align="right">Country:</td> <td width="10%"><input type="text" name="termcountry" value="<?php echo("$termCountry");?>" /></td> </tr> </table> </fieldset> </div> <div class="tab-page" id="tabPage3" align="center"> <h2 class="tab" align="center">Contact</h2> <script type="text/javascript">tp1.addTabPage( document.getElementById( "tabPage3" ) );</script> <fieldset><legend><b>Phone Numbers</b></legend> <table border="0" align="center"> <tr> <td width="10%"></td> <td width="" align="right">Phone Number:</td><td width=""> <input type="text" name="phonenum" value="<?php echo("$phoneNum");?>" /></td> <td width="" align="right">Mobile Phone Number:</td><td width=""> <input type="text" name="mobilenum" value="<?php echo("$mobilePhoneNum"); ?>" /></td> <td width="" align="right">Term Time Phone Number:</td><td width=""> <input type="text" name="termphonenum" value="<?php echo("$termPhoneNum"); ?>" /></td> </tr> </table></fieldset> <fieldset><legend><b>E-Mail</b></legend> <table border="0" align="center"> <tr> <td width=""></td> <td width="" align="right">E-mail Address:</td><td width=""> <input type="text" name="email" value="<?php echo("$email"); ?>" /></td> <td width="" align="right">Term Email Address:</td><td width=""> <input type="text" name="termemail" value="<?php echo("$termEmail"); ?>" /></td> <td width="" align="right">Personal e-mail:</td><td width=""> <input type="text" name="personalemail" value="<?php echo("$termPhoneNum"); ?>" /></td> </tr> </table> </fieldset> <fieldset><legend><b>Social Networks</b></legend> <table border="0" align="center"> <tr> <td width=""></td> <td width="" align="right">Facebook:</td><td width=""> <input type="text" name="facebook" value="<?php echo("$facebook");?>" /></td> <td width="" align="right">Myspace:</td><td width=""> <input type="text" name="myspace" value="<?php echo("$myspace");?>"/></td> <td width="" align="right">Home website:</td><td width=""> <input type="text" name="homewebsite" value="<?php echo("$homeWebsite");?>" /></td> </tr> </table> </fieldset> </form> </div> <div class="tab-page" id="tabPage5" align="center"> <h2 class="tab" align="center">Placement</h2> <fieldset><legend><B>Placement</B></legend> <?php $usr = "root"; $pwd = "michael"; $db = "jostark"; $host = "localhost"; $cid = mysql_connect($host,$usr,$pwd); if (!$cid) { echo("ERROR: " . mysql_error() . "\n"); } mysql_select_db("jostark", $cid); $SQL = "select current_date"; $retid = mysql_query($SQL, $cid); if (!$retid) { echo( mysql_error()); } else { while ($row = mysql_fetch_array($retid)) { $currentDate = $row["current_date"]; $task = $_GET['task']; if ($task=="del") { $id = $_GET[id]; $compid = $_GET[compid]; $SQL = " DELETE FROM studentplacement "; $SQL = $SQL . " WHERE studentID = $id and companyID = $compid "; mysql_query($SQL, $cid) or die (mysql_error()); } } } ?> <form name="tstest" action="insertStudPlacement.php" method="post"> <INPUT TYPE="hidden" NAME="id" VALUE="<?php echo("$id"); ?>"> <?php $SQL = "select * from student, placement, studentplacement where student.studentid = studentplacement.studentid and placement.companyID = studentplacement.companyID and student.courseID=course.courseID and studentplacement.studentID = '$_GET[id]'"; # retrieve values $row = mysql_fetch_array($ret); $retid = mysql_query($SQL, $cid); if (!$retid) { echo( mysql_error()); } else { echo "<P><TABLE CELLPADDING=4 align=center >\n";?> <tr> <td bgcolor="#FFFFFF" align="center"><b>Company</b></td> <td bgcolor="#FFFFFF"align="center"><b>Start Date</b></td> <td bgcolor="#FFFFFF" align="center"><b>End Date</b></td> </tr> <?php while ($row = mysql_fetch_array($retid)) { $compName = $row["compName"]; $compCity = $row["compCity"]; $compCountry = $row["compCountry"]; $email = $row["email"]; $compid = $row["companyID"]; $startdate = $row["start"]; $enddate = $row["end"]; if ($currentDate > $startdate && $currentDate < $enddate) { $bg = "#82A4FD"; } else { $bg = "#E6FBBD"; } $ConvertedStartDate = date("F jS, Y", strtotime($startdate)); //echo $ConvertedStartDate; $ConvertedEndDate = date("F jS, Y", strtotime($enddate)); ?> <TR bgcolor="<?php echo ("$bg");?>"> <?php echo ("<TD>$compName $compCity, $compCountry</TD>\n");?> <TD align=center><?php echo ($ConvertedStartDate);?></TD> <?php echo ("<TD align=center>$ConvertedEndDate</TD>\n"); echo ("<TD><A HREF=\"studentEdit.php?id=$id&task=del&compid=$compid\">Delete</A></TD>"); echo ("</TR>"); } echo ("</TABLE>"); } ?> <br /> <table border="0" align="center"> <tr> <td align="center"><b>Add another placement</b></td> </tr> <tr> <td> <?php $id=$_GET[id]; //connect to MySQL $connect = mysql_connect("localhost","root","michael") or die ("Could not connect to database."); //choose the database mysql_select_db("jostark"); //get data from database $query = mysql_query("SELECT `companyID`,`compName`, `compCity`, `compCountry` FROM `placement` ORDER BY `companyID` ASC") or die (mysql_error()); echo "<select name='placement'>\n"; while ($data = mysql_fetch_array($query, MYSQL_ASSOC)) { echo "<option value='{$data['companyID']}'6>{$data['compName']}, {$data['compCity']}, {$data['compCountry']}</option>\n"; } echo "</select>\n"; ?> </td> </tr> </table> <br /> <table border="0" align="center"> <tr> <td align="center"><b>Start Date</b></td> <td></td> <td align="center"><b>End Date</b></td> </tr> <tr> <td><input type="Text" name="startdate" value=""></td> <td><a href="javascript:cal5.popup();"><img src="../img/cal.gif" width="16" height="16" border="0" alt="Click Here to Pick up the date"></a></td> <td><input type="Text" name="enddate" value=""></td> <td><a href="javascript:cal6.popup();"><img src="../img/cal.gif" width="16" height="16" border="0" alt="Click Here to Pick up the date"></a></td> </tr> </table> <br /> <table align="center"> <tr> <td align="center" valign="bottom"><input type="submit" value="Add Placement"/></td> </tr> <tr> <td align="center" height="60px" valign="bottom">Company not Listed?</td> </tr> <tr> <td align="center"><a href="javascript: void(0)" onMouseUp="window.opener.location.href='addPlacement.php'">Add new placement</a></td> </tr> <tr> <td align="center" height="70px" valign="bottom"></td> </tr> </table> </form> <script language="JavaScript"> var cal5 = new calendar3(document.forms['tstest'].elements['startdate']); cal5.year_scroll = true; // year scrolling is enabled here cal5.time_comp = false; //time display is disable var cal6 = new calendar3(document.forms['tstest'].elements['enddate']); cal5.year_scroll = true; // year scrolling is enabled here cal5.time_comp = false; //time display is disable </script> </fieldset> </div> <div class="tab-page" id="tabPage6" align="center"> <h2 class="tab" align="center">Course</h2> <fieldset><legend><b>Select Course</b></legend> <table align="left"> <tr> <TD align="left"> <form action="updateStud.php" method="post" name="fa" id="fa"> <?php $SQL = "select * from (student left join studentplacement on student.studentid=studentplacement.studentid) left join placement on studentplacement.companyID=placement.companyid where student.studentid=$id"; $ret = mysql_query($SQL,$cid) or die (mysql_error() . "\n$SQL\n"); $row = mysql_fetch_array($ret); $courseID=$row["courseID"]; $sql2 = "SELECT `courseID`, `courseName` from course ORDER BY `courseName` ASC"; if ( !$result = mysql_query($sql2) ) { echo ('Database error: ' . mysql_error()); } else { $school_select = "<select name=\"courseID\">\n"; while( $data = mysql_fetch_array($result) ) { $selected = ($courseID == $data['courseID']) ? " SELECTED" : ""; $school_select .= "<option value=\"".$data['courseID']."\"".$selected.">".$data['courseName']."</option>\n"; } $school_select .= "</select>\n"; } echo ($school_select); ?> <td><a href="../add/addCourse.php">Can't find Course? Add a new one</a></td> </tr> </table> </fieldset> </div> <br /> <table border="0" width="100%"> <tr> <td align="right"> <input type="submit" align="right" value="Create Student" /> </form> </td> </tr> </table> <br /> </form> <script language="JavaScript"> var cal5 = new calendar3(document.forms['tstest'].elements['startdate']); cal5.year_scroll = true; // year scrolling is enabled here cal5.time_comp = false; //time display is disable var cal6 = new calendar3(document.forms['tstest'].elements['enddate']); cal5.year_scroll = true; // year scrolling is enabled here cal5.time_comp = false; //time display is disable </script> </div> </div> <script type="text/javascript"> //<![CDATA[ setupAllTabs(); //]]> </script> <hr /> </td> </tr> </table> <?php } ?> </div> </body> </html>
-
Wow good effort nealios, I never would've seen that!
-
I've been following this problem from the side lines, and can't see where limit_status is defined. Should it be limit $currentRecordNumber, $number_of_records_per_page ? I see $rowsPerPage, but where does it find out the number of the last record viewed? Any help would be appreciated
-
Writing to file, new line character \n doesn't work
HughbertD replied to HughbertD's topic in PHP Coding Help
\r\n worked! Thanks! -
Hi all, I am writing some data to a file (well appending) I am using \n for a new line return, but all I get is a small square, and all the data is on one line $file="export_$time"; $handle=fopen($file,'a'); $data="$start2 TO $end2\n"; fwrite($handle, $data); fclose($handle); Thanks for any help you can give.
-
Damn timestamps and dates! Wheres the extra 70 years coming from!?
HughbertD replied to HughbertD's topic in PHP Coding Help
Thanks so much! Explanation makes sense to! I take it the topic solved button is still down? Thanks again! -
Damn timestamps and dates! Wheres the extra 70 years coming from!?
HughbertD replied to HughbertD's topic in PHP Coding Help
I gave it a go, it was 6 years out (!) I sent you a PM btw, just so you know. I simply don't understand why counting the number of seconds from 1970 would make the dates do this. Is it the conversion back from the timestamp which is the problem? -
Damn timestamps and dates! Wheres the extra 70 years coming from!?
HughbertD replied to HughbertD's topic in PHP Coding Help
Hi, Sorry, I realise you made a function to do this. Do I take off, 1970*(365*(3600*24)) ? And then the extra day and month etc? -
I have done a calculation of the differnce in time between two timestamps like so, $start = strtotime($row["dateTime"]); $end = strtotime($row["dateTimeFin"]); $result = ($end - $start); $conv=gmdate("m \m\o\\n\\t\h\s d \d\a\y\s H \h\o\u\\r\s\ i \m\i\\n\s\ s \s\e\c\s",$result); echo ($conv); I have noticed however that there is always 1 extra day, 1 extra month and 70 years in the result. I only want the days, hours, minutes of the difference, but I tried taking off 3600*24 for the extra day this works for results of more than one day, but if the time difference is less than a day, it displays 31 days. I don't want to use a function to do this. If anyone can help I would appreciate it massively