473,405 Members | 2,354 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

assign many attribute to one function

Hi evryone....
i need you help in this coding....
i named this page search0.php.....
this is my code....


Expand|Select|Wrap|Line Numbers
  1. <?php
  2. include("dbconn.php");
  3. $dateday = $_POST['dateday'];
  4. $datemonth = $_POST['datemonth'];
  5. $dateyear = $_POST['dateyear'];
  6.  
  7.  
  8. $sql= "SELECT * FROM staffactivity WHERE dateday = '$dateday' AND datemonth = '$datemonth' AND dateyear = '$dateyear'";
  9. $query = mysql_query($sql) or die ("Error: " . mysql_error());
  10. $row = mysql_num_rows($query);
  11.  
  12. if($row == 0){
  13. echo "No record found";
  14. }
  15. else{
  16. $r = mysql_fetch_assoc($query);
  17. //$studentid= $r['studentid'];
  18. //$studentnumber= $r['studentnumber'];
  19. //$studentname= $r['studentname'];
  20. //$studentpassword= $r['studentpassword'];
  21. ?>
  22.  
  23. <html>
  24. <body>
  25. <form name="form4" method="post" action="process0.php">
  26. <table border="2" width="100" height="100">
  27. <?php
  28.     $sqlGet= "SELECT * FROM staffactivity  WHERE dateday = '$dateday' AND datemonth = '$datemonth' AND dateyear = '$dateyear'";
  29.     $queryGet = mysql_query($sqlGet) or die("Error: " . mysql_error());
  30.     while($rGet = mysql_fetch_assoc($queryGet))
  31.     {
  32.         //echo "<table border='0'>";
  33.         echo "<tr>";
  34.         echo "<td class='fonttable'>".$rGet['dateday'];
  35.         echo "&nbsp;&nbsp;";
  36.         echo $rGet['datemonth'];
  37.         echo "&nbsp;&nbsp;";
  38.         echo $rGet['dateyear']."</td>";
  39.         echo "<td class='fonttable'>".$rGet['task2']."</td>";
  40.         echo "<td class='fonttable'>".$rGet['note2']."</td>";
  41.         echo "</tr>";
  42.     }
  43. ?>
  44. </table>
  45. <input type="submit" name="Update" value="Update">
  46. <input type="submit" name="Delete" value="Delete">
  47. </form>
  48.  
  49. </body>
  50. </html>
  51. <?php
  52. }
  53. mysql_close($dbconn);
  54. ?>

i would like to assign the code at line 3 until line 5 to one attribute or variable....so that, when i want to call the 3 attribute,i just need to call one variable.....is it possible? how is it?
plz help me anyone...
Feb 13 '12 #1
1 1473
Rabbit
12,516 Expert Mod 8TB
I suppose you could combine them into a date but why would you want to do that? It looks like your database is set up with them separated anyways so even if you combine them, you will have to separate them. It's just more work.

Ideally, it should be a date variable and the database should also be set up as a date field.
Feb 13 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: ogled | last post by:
Hi I have an odd question: is it possible to have a delegate that recieves a methodname dynamically? Like this: aClassObj.OnGo += new ANamespace.Invoke(fName); where fName would be a string...
5
by: nick | last post by:
I have the following code: var ocevent = function(v) { alert('javascript event: u clicked '+v); return false; };
2
by: laredotornado | last post by:
Hello, I am looking for a cross-browser way (Firefox 1+, IE 5.5+) to have my Javascript function execute from the BODY's "onload" method, but if there is already an onload method defined, I would...
7
by: Giacomo | last post by:
I work on a page structured like: <h2> ... </h2> <div ="div1" class="show"> ... </div> <h2> ... </h2> <div id="div2" class="show"> ... </div> <h2> ... </h2> <div id="div3" class="show">...
1
by: Carl Maloney | last post by:
I have a checkbox that is being created dynamically in C# when I load the page. When it is checked, I want it to run a javascript function. How do assign a checkbox to launch a javascript function...
2
by: Fuy | last post by:
Hi, i have a next problem: In the method startElement(const XMLCh* const uri, const XMLCh *const localname, const XMLCh *const qname, const Attributes &attrs ){
1
by: vega80 | last post by:
Hi. I have a problem with assigning an onkeypress-function to dynamically created input-boxes.I want to put the content of an input-field into a tag-list when the user hits enter. This works...
4
by: simon | last post by:
hi, I would like to separate my javascript completely from my xhtml. in the end there should be only <script type="text/javascript" src="javalib.js"></script> in the head-tag to my javascript....
3
by: Stefano Esposito | last post by:
Hi all what i'm trying to do is this: .... return None .... .... print "called bar" .... .... foo = bar ....
1
by: howa | last post by:
The topic is not very good, so please see the example below... function bar(fn) { fn.hi = function() { alert('hi'); } };
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.