Jump to content

manmadareddy

Members
  • Posts

    50
  • Joined

  • Last visited

Posts posted by manmadareddy

  1. try this
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE> New Document </TITLE>
    <META NAME="Generator" CONTENT="EditPlus">
    <META NAME="Author" CONTENT="">
    <META NAME="Keywords" CONTENT="">
    <META NAME="Description" CONTENT="">
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function checksub(obj)
    {
    if(obj.checked==true)
    {
    document.frmtest.txt_once.disabled=true;
    }
    else
    {
    document.frmtest.txt_once.disabled=false;
    }
    }
    //-->
    </SCRIPT>
    </HEAD>
    <BODY>
    <FORM name='frmtest' METHOD=POST ACTION="" >
    <INPUT TYPE="checkbox" NAME="chk_once" onclick="return checksub(this);">checkbox <INPUT TYPE="text" NAME="txt_once">
    </FORM>
    </BODY>
    </HTML>
  2. $sql="select distinct(Item),count(Item) as cnt,itemcode from products group by Item";
    By using the above query u will get the counts of each item with itemcode.
    u can do sort on the result set and get the max one.
  3. I hope u need only some fields which are not replicated I mean unique like email.
    first identify those fields and just write a select query .
    $sql="select count(*) as cnt from tablename where email!='".$_REQUEST['email']."'";
    //you can add if you need to check another fields too like $sql." and fname!='".$_REQUEST['fname']."'";
    $res=mysql_query($sql);
    $result=mysql_fetch_assoc($res);
    if(!$result['cnt'])
    {
      //here insert statement
    }else
    {
      //email already exists error message
    //same form with $_REQUEST fields filled
    }
  4. Just small suggestion, I hope you don't need to do any coding changes
    for this. Just need to have the permissions for your IP at Geocities.
    To know this just open the cpanel of geocities in the main page click
    the mysql databse and in that page you will find the list of IPs
    which are having permissions to access that database.Just you need
    to put one entry of  your IP there. I am sure this will solve your problem.
  5. You can just replace that character with your customize character using string functions.
    But while retrieving for disaply you must again need to replace you character with new line character.
  6. <html>
    <head>
    <title>JavaScript - Adding html elements dynamically</title>
    <script type="text/javascript">
    var numrows = 0;
    function drawoptions()
    {
      var tbl = document.getElementById("formtable");
      var targetnumrows = parseInt(document.getElementById("numoptions").value + "");
      // if they've selected to show more rows, then we add more rows
      if(targetnumrows > numrows)
      {
          for(var i=0; i<targetnumrows - numrows; i++)
          {
              var row = tbl.insertRow(tbl.rows.length);

              // create the name cell
              var cell = row.insertCell(0);
              var namefield = document.createElement("input");
              namefield.setAttribute("type", "text");
              namefield.setAttribute("id", "Name" + (numrows+i));
              namefield.setAttribute("value", "field id : Name" + (numrows+i));
              cell.appendChild(namefield);
     
              // create the email cell
              cell = row.insertCell(1);
              var emailfield = document.createElement("input");
              emailfield.setAttribute("type", "text");
              emailfield.setAttribute("id", "Email" + (numrows+i));
              emailfield.setAttribute("value", "field id : Email" + (numrows+i));
              cell.appendChild(emailfield);
          }
      }
      // they've decided to show less rows, so we remove some
      else
      {
          for(var i=0; i<numrows - targetnumrows; i++)
          {
              tbl.deleteRow(tbl.rows.length - 1);
          }
      }

      numrows = tbl.rows.length - 1;
      document.getElementById("numoptions").value=tbl.rows.length; 
      //alert(numrows);
    }

    window.onload = drawoptions;

    </script>
    </head>

    <body>

    <form method="post" action="someformhandler.aspx">
    Enter your friends names and email addresses<br />

    Show
    <input type='hidden'  id="numoptions" value=1>
    <table id="formtable">
    <tr><td colspan=2><a href="javascript:drawoptions();">add</td></tr>
    <tr>
      <td>Name</td>
      <td>Email</td>     
    </tr>
    </table>

    <input type="submit" value="Save"  />

    </form>

    </body>

    </html>
  7. <?php

    // Connecting, selecting database

    $link = mysql_connect('localhost', 'dbusername', 'dbpassword')

    or die('Could not connect: ' . mysql_error());

    mysql_select_db('dbname') or die('Could not select database');

    //$message=stripslashes($_POST['txt_message']);

    $sql="select username from mytable where username='".$_POST['username']."' and password='".$_POST['pass']."'";

    $rs=mysql_query($sql);

    $count=mysql_num_rows($rs);

    if(!$count)

    {

    $insertsql="insert into mytable (id,username,password) values(0,'".$_POST['username']."','".$_POST['pass']."')";

    mysql_query($insertsql);

    header("Location:userhome.php");

    exit;

    }

    else

    {

    echo "username alerady exists";

    }

     

    ?>

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

    <HTML>

    <HEAD>

    <TITLE> New Document </TITLE>

    <META NAME="Generator" CONTENT="EditPlus">

    <META NAME="Author" CONTENT="">

    <META NAME="Keywords" CONTENT="">

    <META NAME="Description" CONTENT="">

    </HEAD>

    <BODY>

    <FORM METHOD=POST ACTION="">

    <input type='text' name='username' >

    <input type='text' name='pass' >

    <INPUT TYPE="submit">

    </FORM>

    </BODY>

    </HTML>

     

     

    Try this

×
×
  • 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.