Jump to content

sasa

Staff Alumni
  • Posts

    2,804
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by sasa

  1. no

    let see

    1st condition

    strpos($currentuser['Skills'],"Accordion-") == "true"

    strpos return number 0 (start position of substring)

    when php compare number and string it convert string to number and get 0 == 0 => true (btw. "true" is not same as true)

    1st condition can be

    strpos($currentuser['Skills'].'-',"Accordion-") !== false

    2nd must be

    strpos($currentuser['Skills'].'-',"Bass (Upright)-") !== false

    and so on

  2. try

    if($itemDescription[0] === "1") {
    $itemPrice *= 1.0625;//add 6.25 %
    
        mysql_query("INSERT INTO transactions (`itemDescription`, `itemPrice`, `bidderId`, `itemQty`, `totalPrice`) VALUES ('$itemDescription', '$itemPrice', '$winningBidder', '$totalDeals', '$totalPrice');");
        $message1 = 'The transaction has been successfully added.';
    }

  3. change this part of code

    <td id="present">
                                        <input type="radio" name="present<? echo $rows['STUDENT_ID']; ?>" checked="checked" value="PRESENT">Present            
                                     </td>
                                     <td id="absent">                                    
                                        <input type="radio" name="present<? echo $rows['STUDENT_ID']; ?>" value="ABSENT">Absent
                                     </td>     

    to

    <td id="present">
                                        <input type="radio" name="present[<? echo $rows['STUDENT_ID']; ?>]" checked="checked" value="PRESENT">Present            
                                     </td>
                                     <td id="absent">                                    
                                        <input type="radio" name="present[<? echo $rows['STUDENT_ID']; ?>]" value="ABSENT">Absent
                                     </td>     

    and in action page yo can do

    foreach(S_POST['present'] as $student_id => $value){ 
    //etc.
    }

  4. try

    <?php
    $test = array('key1'=>'test1', 'key2'=>'value2', 'key3'=>array('test','test1','test2'));
    
    function my_str_replace($srch, $replace, $subject){
        if(!is_array($subject)) return str_replace ($srch, $replace, $subject); 
        $out = array();
        foreach ($subject as $key => $value) $out[$key] = my_str_replace($srch, $replace, $value);
        return $out;    
    }
    $a  = my_str_replace('test', 'hello', $test);
    print_r($a);
    ?>

  5. change

     for ($col = 0; $col < 5; $col++)
        {
            if (isset($serenwilde[$rw][$col])) {
    		echo "<li>".$serenwilde[$rw][$col]."</li>";
    	}
    }

    to

     
            if (isset($serenwilde[$rw][0])) {
    		echo "<li>".$serenwilde[$rw][0l]."</li>";
    	}
    

  6. in your INSERT query

    mysql_query("INSERT INTO topics (managerId, equip, title, url_big, url_small, egroup1, egroup2, egroup3, egroup4, egroup5, egroup6)
      VALUES ('$userid','$wordquip', '$equip', '$bigpic', '$smallpic', '$egroup1', '$egroup2', '$egroup3', '$egroup4', '$egroup5', '$egroup6')") or die (mysql_error("error 1321"));

    in fields list equip is on the 2nd position and in value list is 3rd   

  7. change varijable $bgcolorplace to static

    try[/code]<?php

    function changebgcolor(){

        static $bgcolorplace = 0;

        if ($bgcolorplace=="0"){

            $bgcolorplace="1";

                      //$bgcolor="444444"

            echo("0 to 1<br/>".$bgcolorplace."<br/>");//display which part of code is executed 1 to 0 or 0 to 1(can never get the script to run this part), this line is temp/test code

        }else{

            $bgcolorplace="0";

                      //$bgcolor="ffffff"

            echo("1 to 0<br/>".$bgcolorplace."<br/>");  //display which part of code is executed 1 to 0 or 0 to 1(It works), this line is temp/test code

        }

    }

     

    for($i=0; $i<10; $i++){

        changebgcolor();

        echo "<hr />\n";

    }

    ?>[/code]

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