Jump to content

AyKay47

Members
  • Posts

    3,281
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by AyKay47

  1. Well, either way, the .val() method should always be used to get a value from an element.

    So you are saying that $(this).find("input").val() does not work either?

    If not, a couple of questions I have just for some additional info:

     

    1. What version of IE are you using to test this?

     

    2. What version of jquery?

     

    3. Can you please post the snippet of code that this script is meant to grab the value from.

     

    4. Would there by chance be any conflicting code?

     

    5. Are there any errors present before reaching this script? IE is known to stop parsing script if there is an error present.

  2. well, i'm really not sure since I haven't used localhost to test a site in a while.

    Your computer acts as the server, so perhaps it's just grabbing the time from it.

    I am sure someone else will chime in with a solution.

    But really, if this is localhost, it shouldn't be a huge deal. This problem will most likely not occur on a live server.

  3. My technique was basically to look through every post in this forum and try out the posted code for scenario's I understood! I then changed part of the code to see what changed in the output.

     

    I also found the basic tutorials on Tizag useful as a starting point.

     

    Steve

     

    PS. I never brought any brownies in and now feel guilty. Where should I send them?

     

    you sifted through thousands and thousands of posts trying out the code for each one? Impressive..

  4. its errorintg because $result just says weather the query worked or not

    run mysql_fetch_assoc( then count that

     

    No, mysql_query() returns the resulting table from the SELECT query, not a boolean. Those parts of the code are correct.

     

    mysql_query returns a boolean FALSE upon error, and a mysql result resource otherwise.

  5. The error indicates that the query is returning a boolean FALSE due to an error in the SQL.

     

    1. check for the $_POST values being set before using them using isset

     

    2. Add some debugging in your script, echo the SQL and mysql_error upon query failure.

     

    $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'";
    $result=mysql_query($sql) or die($sql . "<br />" . mysql_error());

     

    3. session_register() is deprecated, use the $_SESSION superglobal array to set session values instead.

  6. Instead of having a query inside of a loop, which you should always avoid doing, use a JOIN and filter the results of the join using the ON clause.

     

    $event_select_sql = "SELECT e.*,u.* FROM events e LEFT JOIN users u ON (u.id = e.id_user) WHERE e.event_date = '$datum' AND e.id_user != {$_SESSION['id']}";
    $event_select_query = mysql_query($event_select_sql) or die($event_select_sql . "<br />" . mysql_error());
    while($events = mysql_fetch_array($event_select_query))
    {
        //create table with db fields...
    }

     

    Also, avoid selecting every field from a db table, this will slow down the query. Instead, select only the fields that you are going to use.

  7. Array ( [Mname] => me [email] => test@testing.com [phone] => 2483200036 [btime] => never [Cname] => my mom [city] => anywhere [state] => MI [age] => 138 [gender] => Female [startDate] => 02/29/2012 [hours] => 15 hours [days] => m-w-f [extra] => please call me now [referral] => google [submit] => Send Now ) 

     

    the issue is pretty self explanatory, so I will ask you.

    What do you see wrong with that $_POST array?

  8. No, no, no. This is awful code

    switch ($tags[$i])
        {
            case "moon":
                $moon[] = $tags[$i];
                break;
            case "sun":
                $sun[] = $tags[$i];
                break;
        }
    }
    

    If I had a thousand keywords are you going to add them all to a switch/case statement? What if you don't know what the keywords are?

     

    There is a php function for doing what you are after, array_count_values(). All you need is one array containing all of your keywords. So if you are using the explode() function on many fields, just use array_merge() to put all the data into one array. Then use array_count_values() on the array and it will give you the number of occurances of each keyword in the array.

     

    Here is a link to the manual:

     

    http://uk3.php.net/array_count_values

     

    I said in my post that it depends on a few conditions whether or not my code is viable.

    But yes this is certainly a better solution.

  9. You will have to tweak the padding to make it work.

    As for the span being next to the user image, it's not because class='icon' has a margin-right of 5px;

    You will most likely have to create another class or id specifically for the user pic anchor.

     

    .user-icon
    {
    background-color: red;
    background-repeat: no-repeat;
    background-position: center center;
    padding: 1px 15px 5px 15px;
    //no margin
    }

  10. This can (and probably should) be done in the query itself. Since all I see are SELECT * from a random php variable, I cannot be precise with the query, so I will give you some pseudo code that you can tweak for yourself.

    Also, it's a bad habit to get into using SELECT *, you should be selecting only the fields that you are going to be using. Using SELECT * is not optimized unless you actually want to select all of the fields for use.

    Again I don't know you table set up etc. so this code will not be precise:

     

    SELECT COUNT(XS) as XS_count, COUNT(S) as S_count, COUNT(M) as m_count, COUNT(L) as l_count FROM canonkickoff WHERE Prevoz = 'Yes'

     

    Depending on how you want to go about this, you may want to incorporate this into an existing query using either a join or subquery.

    Also, I am expecting that the Prevoz field contains the literal string "yes" and "no", if it is a type BOOL, the query will change to 0 and 1.

  11. <?php
          // add a checkbox for delivery charges
    		echo '<span class="form"><label>Delivery Charges</label>';
          echo '<input type="checkbox" name="del_charges" id="del_charges" value="1" class="boxes" ';
          if ( isset($_POST['del_charges']) && !empty($_POST['del_charges']) )
            echo 'checked="checked"';
          else
            //do whatever you need to do here to remove the delivery charge
          echo '/>';                 
    ?>  

  12. You could store each keyword in an array and then display the count of the array, depending on how many keywords there actually are. This might be better done from the query itself using COUNT(), but without seeing it it's hard. Here's a snippet of what I am talking about for the PHP:

     

    $tags = explode("|", $row[0]);
    $moon = array();
    $sun = array();
    for($i = 0; $i < count($tags); $i++)
    {
        switch ($tags[$i])
        {
            case "moon":
                $moon[] = $tags[$i];
                break;
            case "sun":
                $sun[] = $tags[$i];
                break;
        }
    }
    
    echo count($moon) . "<br />" . count($sun);

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