Jump to content

sasa

Staff Alumni
  • Posts

    2,804
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by sasa

  1. try

    <?php
    function get_cat_selectlist($current_cat_id = 0) {
    mysql_connect('localhost','root','root');
    mysql_select_db('sre');
    $sql =  'SELECT cat_id, parent ,cat_name from `tblcatagory1` where parent =  '.$current_cat_id;	
    $get_options = mysql_query($sql);
    $num_options = mysql_num_rows($get_options);
    $out = '';
    if ($num_options > 0) { // start ul tag
    	$out = "<ul>\n";
    	while (list($cat_id, $parent, $cat_name) = mysql_fetch_row($get_options)) {
    		$out .= '<li>'. $cat_name.'</li>'."\n";
    		$out .= get_cat_selectlist($cat_id);
    	}
    	$out .= "</ul>\n";
    }//if greter the zero
    return $out;	
    }//function 
    echo get_cat_selectlist();
    ?>

  2. try

    <?php
    $teststring = "2010-03-14,74527,645,New,7417417,Toll,2,74527417,32,202,7452741741,ghtgbwt,gtgwtgwtfgwtrg,2010-03-14,857527527,645,New,7417418,Toll,7,74527418,32,202,527527,hjm,djmdmdjmdjmdgjm,2010-03-14,85285,645,New,7417419,Toll,2,74527419,32,202,750757,jryjkryjkfryk,yjmyjyjtyjhm";
    //$teststring1 =  preg_replace("/([a-zA-Z0-9_\-]+?),/" , "\"$1\",",$teststring);
    //$teststring2 =  preg_replace("/\,{13}/" , "],[",$teststring1);
    $a = array_chunk(explode(',',$teststring),13);
    foreach ($a as $k => $b) $a[$k] = '"'.implode('","', $b).'"';
    $teststring2 = implode('],[',$a);
    var_dump($teststring2);
    ?>

  3. try

    <html>
    <head>
    	<title>Halo Custom Edition BC Kill Log</title>
    </head>
    <body>
    	<?php
    		$lines = file('halo.log');
    		$teams = array();
    		foreach($lines as $line) {
    			if(preg_match('/PCR_PLAYER/',$line)) {
    				$teams[] = $line;
    			}
    		}
    
    		//$teamnames = array();
    		$teamscore = array();
    
    		foreach($teams as $team) {
    			$teamarr = split(chr(9),$team);
    			if(trim($teamarr[1]) == 'PCR_PLAYER' && preg_match("/»ßÇ«/", $teamarr[3], $matches)) {
    				$name = $teamarr[3];
    				$name = preg_replace("/Player [0-9]*/", "", $name);
    				$name = str_replace('"', '', $name);
    				if (isset($teamscore[$name])) $teamscore[$name] += $teamarr[5]; else $teamscore[$name] = $teamarr[5];
    			}
    		}
    	?>
    
    	<table>
    		<tr>
    			<th>team</th>
    			<th>score</th>
    		</tr>
    		<?php
    			foreach($teamscore as $name => $score) {
    				echo '<tr><td>'.$name.'</td><td>'.$score.'</td></tr>';
    			}
    		?>
    	</table>
    </body>
    </html>

  4. try

    <?php
    $test = "Along with the tutorials, the developers on the forum will be able to help you ... This covers updating your Dev server to recent versions of PHP and MySQL, ...";
    $srch = "php mysql forum";
    $srch = trim($srch);
    $srch = preg_replace('/\s+/','|',$srch); //replace spaces with |
    $test = preg_replace('/('.$srch.')/i', '<b>$1</b>', $test);
    echo $test;
    ?>

  5. try to change your data array

    <script>  
            function addRow() {  
              var tbl = document.getElementById('thetable');  
              var lastRow = tbl.rows.length;  
              var row = tbl.insertRow(lastRow);  
                
              var cell1 = row.insertCell(0);  
              var input = document.createElement('input');  
              input.name = 'data[' + lastRow + '][date]';  
              input.id = 'date' + lastRow;  
              cell1.appendChild(input);  
                
              var cell2 = row.insertCell(1);  
              input = document.createElement('input');  
              input.name = 'data[' + lastRow + '][am]';  
              input.id = 'am' + lastRow;  
              cell2.appendChild(input);  
                
              var cell3 = row.insertCell(2);  
              input = document.createElement('input');  
              input.name = 'data[' + lastRow + '][pm]';  
              input.id = 'pm' + lastRow;  
              cell3.appendChild(input);  
                
              var cell4 = row.insertCell(3);  
              input = document.createElement('input');  
              input.name = 'data[' + lastRow + '][comment]';  
              input.id = 'comment' + lastRow;  
              cell4.appendChild(input);  
            }  
              
            function delRow() {  
              var tbl = document.getElementById('thetable');  
              var lastRow = tbl.rows.length;  
              if (lastRow > 2) tbl.deleteRow(lastRow - 1);  
            }  
        </script>  
    
    <form action="javascript:get(document.getElementById('myform'));" name="myform" id="myform"> 
    <table style="WIDTH: 100%; BORDER-COLLAPSE: collapse" id="thetable">  
       <tbody>  
         <tr>  
           <td>  
             <p align="center">Date</p></td>  
           <td>  
             <p align="center">Am</p></td>  
           <td>  
             <p align="center">Pm</p></td>  
           <td>  
             <p align="center">Comment</p></td>  
        </tr>  
         <tr>  
           <td>  
            <input name="data[1][date]" /> </td>  
           <td>  
            <input name="data[1][am]" /> </td>  
           <td>  
            <input name="data[1][pm]" /></td>  
           <td>  
            <input name="data[1][comment]" /></td>  
        </tr>  
      </tbody>  
    </table>  
    <table style="WIDTH: 100%; BORDER-COLLAPSE: collapse">  
         <tr>  
           <td>  
           <p align="center">  
              <input type="button" value="Add Row" onclick="addRow()" />  
              <input type="button" value="Subtract Row" onclick="delRow()" />
                    </p>  
           </td>  
        </tr>  
    </table>

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