Jump to content

zenag

Members
  • Posts

    443
  • Joined

  • Last visited

Posts posted by zenag

  1.  

    have u changed $row1 in every while statement???

    like this..

     

    while($row1=mysql_fetch_row($result))

    {

     

    while ($row1=mysql_fetch_row($result2)){

     

    if so ...change it...to different variable...$row,$row1

  2. regarding $sql1 we can assign it.variable can be of any type...nothing problem in that...

    and...below query is correct it works fine

     

    and regardng..
    while ($row1=mysql_fetch_row($result2))(
    $uuid=$row1[0];
    echo $uuid;
    
    }
    $result3 = mysql_query("SELECT users.firstname,users.surname,incidents.owner_id FROM incidents,users where (incidents.owner_id = users.id) OR (incidents.owner_id <'$uuid') OR (incidents.owner_id = NULL)",$link);
    
    
    
    

  3. this will redirect you to rmslogin.php if they typed incorrect username or password

    
    <?php  
    $username=$_POST['loginname']; 
    
    $userpassword=$_POST['loginpassword'];
    
    $sql="SELECT * FROM user WHERE username='$username' and password='$userpassword'";
    $result=mysql_query($sql);
    if (mysql_num_rows($result)==0) {
                    $_SESSION['invalid']='invalid';
                    header("Location:rmslogin.php");
            }
           
    // Mysql_num_row is counting table row
    if(mysql_num_rows($result)>1)
    // If result matched $myusername and $mypassword, table row must be 1 row
    
    {
    // Register $myusername, $mypassword and redirect to file "rms.php"
    $_SESSION['username']=$username;
    $_SESSION['userpassword']=$userpassword;
    header("location:rms.php");
    }
    
    
    ?>
    

  4. 
    <?php
    $ageTime = mktime(0, 0, 0, 9, 9, 1919); 
    $t = time(); 
    $age = ($ageTime < 0) ? ( $t + ($ageTime * -1) ) : $t - $ageTime;
    $year = 60 * 60 * 24 * 365;
    $ageYears = $age / $year;
    
    echo 'You are ' . floor($ageYears) . ' years old.';
    ?>
    

  5. 
    like this??????????????
    
    <?
    
    session_start();
    
    $clicked=$_POST["gender"];
    
    ?><?
    if($clicked=="open")
    {
    ?>
    <html>
    <title> Welcome to Project Management Tool</title>
    <body bgcolor=#AFC7C7>
    <h1> Report</h1>
    
    
    <?php
    
    $myusername = $_SESSION['myusername'];
    echo $myusername;
    
    //put the above right at the top of your script. Everything else can follow
    ?>
    
    <?
    
    //header("Content-Type: text/plain");
    
    
    /* set's the variables for MySQL connection */
    
    $server = "localhost"; // this is the server address and port
    $username = "root"; // change this to your username
    $password = ""; // change this to your password
    
    /* Connects to the MySQL server */
    
    $link = @mysql_connect ($server, $username, $password)
    or die (mysql_error());
    
    /* Defines the Active Database for the Connection */
    
    if (!@mysql_select_db("test", $link)) {
         echo "<p>There has been an error. This is the error message:</p>";
         echo "<p><strong>" . mysql_error() . "</strong></p>";
         echo "Please Contact Your Systems Administrator with the details";
    }
    
    $sql1 = mysql_query("SELECT id from users where loginname ='".$myusername."'",$link);
    
    while($row=mysql_fetch_row($sql1 ))
    {
                                       
    #echo $result[0];
    $uid=$row[0];
    echo $uid;
    #$uid=$result["id"];
    #echo "$uid";
    
    }
    
    #$result2 = mysql_query("SELECT incidents.id, incidents.description, users.firstname, users.surname, users.loginname FROM incidents,users WHERE (incidents.owner_id = users.id) AND (incidents.contact_id = '".$result[0]."')", $link);
    $result2 = mysql_query("SELECT  incidents.id, incidents.description, users.firstname, users.surname, users.loginname FROM incidents,users where (incidents.owner_id = users.id) OR (incidents.owner_id= NULL) AND (incidents.contact_id = '".$result[0]."')", $link);
    #echo ("SELECT incidents.id, incidents.description, users.firstname, users.surname, users.loginname FROM incidents,users WHERE (incidents.owner_id = users.id) OR (incidents.contact_id = '".$uid."')";
    echo $result2 ;
    
    #$result2 = mysql_query("SELECT incidents.id,incidents.description,users.firstname,users.surname,users.loginname from incidents,users where (incidents.owner_id = users.id) OR (incidents.contact_id =  '".$uid."')", $link);
    
    
    
    
    if (!$result2) {
      echo("<p>Error performing query: " . mysql_error() . "</p>");
      exit();
    }
    
    /* Starts the table and creates headings */
    ?>
    <table border="1">
    <tr>
    <td><strong>ID</strong></td>
    
    <td><strong>Description</strong></td>
    <td><strong>Owner Name</strong></td>
    <td><strong>Notes</strong></td>
    
    </tr> <td><strong>Description</strong></td>
    <td><strong>Owner Name</strong></td>
    <td><strong>Notes</strong></td></tr>
    <?
    /* Retrieves the rows from the query result set
    and puts them into a HTML table row */
                  
    
    
    
    
    /* Retrieves the rows from the query result set
    and puts them into a HTML table row */
    #echo "hello";
    #echo "$myusername";
    while ($row = mysql_fetch_array($result2, MYSQL_ASSOC)) {
    
    
    echo "\n";
         echo("<tr>\n<td>" . $row["id"] . "</td>");
        echo("<td>" . $row["description"] . "</td>");
        echo("<td>" . $row["firstname"] . $row["surname"]. "</td>");
        echo("<td>" . $row["loginname"] . "</td></tr>");
    
       # echo("<td>" . $row["name"] . "</td>");
       # echo("<td>" . $row["create_time"] . "</td>");
    }
    
    /* Closes the table */
    ?>
    </table>
    <?
    
    /* Closes Connection to the MySQL server */
    mysql_close ($link);
    
    }
    else
    {
    if($clicked=="closed")
    
    {
    echo "closed";
    }
    }
    
    ?>
    
    
    

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.