Jump to content

182x

Members
  • Posts

    179
  • Joined

  • Last visited

    Never

Posts posted by 182x

  1. Hey guys,

     

    I am just wondering why the following code works.. shouldn't it be an mysql_fetch_assoc instead as its not using the index but a name instead?

     

    Thanks.

     

    
    <?php
    
    while($var=mysql_fetch_array($queryResult))
    {
    
    
         echo "<tr><td>".$var['name']."</td></td><td>".$var['job']."</td></tr>";
    }
    ?>
    
    

  2. Hey guys, I have put data into the database wchich contains the word "can't" I have escaped this so it displayed normally in most tables but in one case it is displayed "can<?>t" I was just wondering why the question mark has appeared? Thanks.

  3. Hey guys I am using the following code in order to ensure that a user does not exceed the limit of 2000 characters when processing a form. I also have some javascript which informs the user how many characters they have left and the php code is just a fail safe incase javascript is not enabled. However when using the code below if I have 2001 charaters it is still accepted it goes to around 2300 before it works I was just wondering why this is the case? Thanks

     

    if(strlen($_POST['text']) > 2000)
    
    {
    //error
    }
    
    else{
    //ok
    }
    

  4. hey guys I am using the following syntax to insert records into my database however if one of the records contains an apostrophe the sql statement will not work I was just wondering why and how to fix it? Thanks.

     

     $test="INSERT INTO test VALUES ('','{$testing['cId']}','{$testing['user']}')"; 

  5. Hey guys,

     

    I have an int field in a database and for teh purposes of this case the insert statement doesn't insert anything into the field using the ' ' syntax however in the mysql database this appears as 0. I was wondering can I still use the empty syntax as follows or will it not work as it is 0 does is this not classed as empty? Thanks.

     

      if (empty($row['intTest'])){
    
     $sns= "empty";
     }
    
    

  6. Its just the row from a query based on the login details so based on that information and taking the question about the different users logging in if no session destroy was called will the variables still all be ok and no a jumble of eachother?

  7. another question I have about session variables would be if for example my username was 'testUsername' and I logged in with that username and didn't logout using session_destroy and someone else used the login page with a shorter username for example 'test' would the session store the username as test or because it didn't logout properly would it be a jumble of both usernames? ans does this apply to all session variable? thanks.

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