Jump to content

ratcateme

Members
  • Posts

    1,216
  • Joined

  • Last visited

    Never

Posts posted by ratcateme

  1. strpos is returning 0 php treats a 0 as false. try changing the ifs to

    if (strpos($rank[$team], '1<sup>st</sup>') !== false) {

    and

    if (strpos($rank[$team], '2<sup>nd</sup>') !== false) {

    !== checks the type of value as well.

     

    Scott.

  2. have you read the sticky on header issues?

    you need to move the header command to before any output

    <html>
    <head>
    <title>Order Online</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style type="text/css">
    <!--
    .style1 {
       font-family: Arial, Helvetica, sans-serif;
       font-weight: bold;
    }
    -->
    </style>
    </head>

    is output and needs to be after the header command

    also try to use [ code][/code] tags around code

     

    Scott.

  3. do you understand how headers work and how php handles them?

    headers are sent at the top of a HTTP response.

    so you cannot send headers after any output has been sent because they had to come first

    now if you read the error output is started on line 5 "<div id="wrapper">"

    looking at your code i don't quite see how this line of code works with the rest of the script

    you need. anyway to i would recommend moving the login checker part of the script to the top on the lines after session_start()

    that way you would have no problems

     

    Scott.

  4. you could go say

    function get_number($number){
        while($number > 9) {
            $number = array_sum(str_split($number));
        }
        return $number;
    }
    $sum1 = get_number($number);
    
    $bnum=get_number($split_date[0]);

     

    Scott.

     

  5. a quick observation about that math behind this

    this will also work

    $number = 58;
    $number = $number%9;
    if($number == 0){
        $number = 9;
    }

    only problem is if the original number is 0 it outputs 9

    so might need another if if you are planning on using it with numbers including 9

     

    Scott.

  6. $number = 58;
    while(strlen($number)!= 1){
        $numbers = str_split($number);
        $number = 0;
        foreach($numbers as $add){
            $number+=$add;
        }
    }
    echo $number;

     

    Scott.

    edit: guess i was beaten and with a better solution.

    may never terminate? i can't think of a way off the top of my head for that?

     

  7. looking at that and the PM i still can't see any reasons why it wont update.

    the only thing i can think of done but have you tired the echo  mysql_affected_rows

    also are there any other if's around the update section that could stop the update from happening?

    they might need rechecking

    also try to add say echo "UPDATING NOW"; on the line after the query to make sure it gets to that line?

     

    Scott.

  8. well try this

     

    mysql_query("UPDATE available SET sex= 'Male' WHERE id = '1'",$con) or die(mysql_error($con));
    echo mysql_affected_rows($con);
    mysql_close($con);

    are you sure there is a row with an ID of 1 and a sex of Female? other wise you wont see anything

     

    Scott.

     

  9. try this code

    <?php
    
    $con = mysql_connect("localhost","*********","**********");
    if (!$con)
      {
      die('Could not connect: ' . mysql_error());
      }
    mysql_select_db("**********", $con);
    
    mysql_query("UPDATE available SET sex= 'Male' WHERE id = '1'",$con) or die(mysql_error($con));
    mysql_close($con);

    that will exit if there is a error with your query.

    and hopefully tell you what is going wrong

     

    Scott.

     

  10. how do you mean it alters is it at all possible for say one or two vars to alter but the core code remain the same the you could store just those 2 in the database?

    but if you want to do code inside a var checkout eval

    you might be able to go say:

    <?php
    $function = "If($me == 2){
    
    echo 'fail';}Else{
    echo '<input type=\"checkbox\" name=\"list[]\" value=\"$value\">';
    }";
    eval($function);
    ?>

    i think

     

    Scott.

  11. i haven't done to much ajax programming myself but i could see how it would work basically if your php script got the list of new users stored it in session and sent the list to the client.

    on next request it gets the list checks it with the one saved in session and if they are the same it calls sleep for say 1 second then checks again.

    now i am not sure how long it would take for the ajax request to timeout so you might have to add limit in the loop so the ajax wont time out but you probably also want to make sure that there is some kind of checking in you ajax so that if one times out then another call is made.

     

    Scott.

  12. $categorycount=mysql_result($result,$i,"count(category)");

    needs to be

    $categorycount=mysql_result($result,$i,"count( category )");

    a better way is do set a name for count like this

    $query="SELECT DISTINCT category, count( category ) AS count FROM `masterdata` GROUP BY category";

    and then retrieving it like

    $categorycount=mysql_result($result,$i,"count");

     

    Scott.

     

  13. try adding some headers

    $headers = 'From: sgfair.com <sgfair@yourhostingnet.com>' . "\r\n";
    mail("sung@hotmail.com", "$emailsubject", "Dear $fname $lname,
    Thank you for registering. Below you will find your username and password that will let you log in and begin to enter
    rental listings.
    Username: $email
    Password: $newpass
    ", $headers);

    Scott.

     

  14. errors like that you just need to read and re-read the line until you can pick something up

    you are missing a . after $fname also you only the the "or dir" part on the end of a mysql_query call not when you are putting the query into a var

     

    Scott.

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