Jump to content

paul2463

Members
  • Posts

    955
  • Joined

  • Last visited

    Never

Posts posted by paul2463

  1. PHP is a server side script, all variables are set at the server before being given over the the client

     

    Javascript is a client side script working with what it has been given

     

    to change a php variable and maintain it as a php variable then php server side has to do the change, hence you would have to pass it back to php, allow it to make the change and then pass it back to the client

     

    so in other words javascript cannot change the value of a php variable

  2. $query = "SELECT * FROM object WHERE object_name = '$result' AND proj_id = '$proj'"; //get all rows with this information
    $result = mysql_query($query) or die(mysql_error());
    $count = mysql_num_rows($result); //count the rows returned, if it doesnt exist in the DB then it will be 0
    if ($count == 0) { //for conditional checking it should be == (= assigns a value to a variable)
    

  3. you could write a javascript funcion such as this to do it for you

    function validateDate(var datestring)
    {
    var returnvar = false;
    if(parseDate(datestring)) //check to see if it is a valid date
    {
    	var brokenDate=datestring.split(”-“); //break the datestring up
    	if (brokenDate[0] > 2001) //check the year is greater than 2001
    	{
    		//check months and days(max) here, if all good make returnvar = true	
    	}
    }
    return returnvar;
    }
    [/code
    
    not done all the coding but given you a start

  4. you problem is in here

    $query  = "SELECT * FROM user WHERE username= $username";
    $result = mysql_query($query);
    

     

    try using

    $query  = "SELECT * FROM user WHERE username= '$username'";         //variables should have single ticks on them
    $result = mysql_query($query) or die ("error in query" . mysql_error());  //would tell you where the error is
    

  5. you are missing a closing brace for your first if statement

     

    try changing these couple of lines

    <?php
    $nr++;
    	endforeach;
    }
    else {
    ?>
    

     

    for

     

    <?php
    $nr++;
         }                                        //closes the last if/else statement
    endforeach;                  // end your foreach statement
    }                                //end the first if statement prior to last else
    else {
    ?>
    

  6. Javascript

     

    delete

     

    The delete operator is used to delete an object, an object's property or a specified element in an array, returning true if the operation is possible, and false if not. With the defined object 'fruit' below, the following delete operations are possible:

     

    Code:

    fruit = new Object;

    fruit.name = 'apple';

    fruit.color = 'green';

    fruit.size = 'large';

     

    delete fruit.size;

     

    with(fruit)

      delete color;

     

    delete fruit;

     

    NOTE:

     

    To delete an object's property, you must precede that property's name with the name of the object, unless it's used in a with statement.

     

    The delete operator can also be used to delete an element of an array. This does not affect the length of the array or any of the other elements but changes the deleted element to undefined. The following example creates an array called 'fruit' and then deletes element #2 (orange):

     

    Code:

    fruit = new Array ("apple", "pear", "orange", "cherry", "grape");

    delete fruit[2];

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