Jump to content

sasa

Staff Alumni
  • Posts

    2,804
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by sasa

  1. try <?php $result = mysql_query($sql) or die(mysql_error()); $ceil_in_row = 3; echo "<table>\n"; while ($row = mysql_fetch_array($result)){ echo "<tr>\n"; echo "\t<td>",$row['name'],"</td>\n"; for ($i = 1; $i < $ceil_in_row; $i++){ if ($row = mysql_fetch_array($result)) echo "\t<td>",$row['name'],"</td>\n"; else echo "\t<td> </td>\n"; } echo "</tr>\n"; } echo "</table>"; ?>
  2. try <?php $page = file_get_contents('http://kish89.pondi.hr/auction.htm'); $page = html_entity_decode($page); preg_match_all('|Auction:.*?<font[^>]+>([^<]*).*?<font[^>]+>([^<]*).*?<tr.*?<tr.*?<span><[^>]+>([^<\s]*).*?mailto:([^"\']+).*?<font[^>]+>\s*([0-9,]*).*?<font[^>]+>\s*([0-9,]*)|s', $page, $out); //print_r($out); foreach ($out[0] as $k => $v){ echo 'Aukcija: ', $out[1][$k], "<br />\n"; echo 'ID: ', $out[2][$k], "<br />\n"; echo 'Ime: ', $out[3][$k], "<br />\n"; echo 'E-mail: ', $out[4][$k], "<br />\n"; echo 'Cijena: ', $out[5][$k], "<br />\n"; echo 'Kolicina: ', $out[6][$k], "<hr />\n"; } ?>
  3. try <?php $aaa = array( array('id'=>1,'name'=>'aaa','pld'=>1), array('id'=>1,'name'=>'aaa','pld'=>2), array('id'=>3,'name'=>'ccc','pld'=>1), array('id'=>2,'name'=>'bbb','pld'=>1), array('id'=>1,'name'=>'aaa','pld'=>3), array('id'=>3,'name'=>'ccc','pld'=>2), array('id'=>2,'name'=>'bbb','pld'=>2), array('id'=>3,'name'=>'ccc','pld'=>3), array('id'=>2,'name'=>'bbb','pld'=>3) ); $out = array(); foreach ($aaa as $a){ $out[$a['id']][$a['name']] = isset($out[$a['id']][$a['name']]) ? $out[$a['id']][$a['name']] + $a['pld'] : $a['pld']; } $aaa = array(); foreach ($out as $id => $a){ foreach ($a as $name => $pld) $aaa[] = array('id' => $id, 'name' => $name, 'pld' => $pld); } sort($aaa); print_r($aaa); ?>
  4. try to change line $oFCKeditor = new FCKeditor('blog_content[]') ; to $oFCKeditor = new FCKeditor('blog_content['.$i.']') ;
  5. $sql ="INSERT INTO table_name (one,two,three,four,five,six) VALUES (" . implode(',',$numbers) . ")";
  6. [code]somethin like this <?php $test ='1:113:13'; $add = '50S'; $test = explode(':',$test); $number = ($test[0]-1)*499*15+($test[1]-1)*15+($test[2]-1); $t = substr($add, -1); switch ($t){ case 'G': $add *= 499; case 'S': $add *= 15; case 'P' : $add *= 1; } $new_number = $number+$add; $sql = "SELECT * FROM table_name WHERE ((G-1)*499*15+(S-1)*15+P-1) BETWEEN $number AND $new_number"; ?>[/code]
  7. are you look page source code or browser window?
  8. merge this two line mysql_query("INSERT INTO gradcoll (u_course) VALUES ('$course')"); mysql_query("INSERT INTO gradcoll (u_id) VALUES ('$id')"); to mysql_query("INSERT INTO gradcoll (u_course, u_id) VALUES ('$course', '$id')"); and next two to
  9. look <?php $a = '001020.300'; echo $a + 0; ?>
  10. just before 2nd while loop insert lint mysql_data_seek($acc_skr_r, 0);
  11. if (($key = array_search($sku,$inventory_sku))!==false)
  12. sasa

    preg_replace()

    try[code=php:0]$content = preg_replace('/(\[CAL\=([0-9]*\/[0-9]*)\])/ie', "getJobs('$2', 'CAL')", $content); not tested
  13. in implode you create variable $offerings and in 2nd part you use $offering_sql
  14. ara you try this test.php <?php $array = parse_ini_file('test2.php',1); print_r($array); ?> and test2.php [prop_1] prop_code = GN110 sqft = 1520 txt = Very nice property pica = picb = picc = picd = pice = picf = picg = [prop_2] prop_code = GN110 sqft = fdbg h h n gg txt = Very nice property pica = picb = picc = picd = pice = picf = picg =
  15. try <?php //... $this->sortState = isset($_GET[$name . 'Sort']) ? $_GET[$name . 'Sort'] : self::DEFAULTSORT; //... ?>
  16. try $where = array(); if ($offerings != '') { $where[] = "offering IN ($offering_sql)"; } if ($some_field != '') { $where[] = "some_field IN ($some_field_sql)"; } //etc. $where = count($where) ? implode(' AND ', $where) : 1; $sql = "SELECT fice FROM characteristics WHERE $where";
  17. try <?php $test = '(npc (name 1) (index 1) (country 252) (race 0) (level 1) (ai 1) (range 20) (sight 160 240) (exp 2) (itemgroup 1 2) (str 21) (hth 1) (int 10) (wis 10) (dex 2) (hp 1) (mp 70) (aspeed 2400) (hit 0) (dodge 0) (attack 0 7 7) (magic 0 0) (defense 0 0) (absorb 0) (mspeed 1600 800) (quest (2 1 901 1) (3 1 902 1) (54 1 1025 1) (8001 1 933 1))) (npc (name 2) (index 2) (country 252) (race 0) (level 3) (ai 1) (range 16) (sight 160 240) (exp 4) (itemgroup 2 2) (str 27) (hth 2) (int 10) (wis 10) (dex 4) (hp 1) (mp 70) (aspeed 2400) (hit 0) (dodge 0) (attack 0 8 (magic 0 0) (defense 1 1) (absorb 0) (mspeed 1600 800) (resist 0 0 1 1 1) (quest (2 1 901 1) (3 1 902 1) (55 1 1026 1) (8001 1 933 1)))'; $test = preg_split('/(\n|\r|\n\r){2,2}/',$test); $test = array_chunk($test,5); foreach ($test as $k => $v) $test[$k] = implode($v); print_r($test); ?> is it OK now
  18. change mysql_query("INSERT INTO news (`title`, `body`, `date`) VALUES ( $title, $body, now())") or die(mysql_error()); to mysql_query("INSERT INTO news (`title`, `body`, `date`) VALUES ( '$title', '$body', now())") or die(mysql_error());
  19. it's somethin wrong with 1st split can you try just first part of code <?php $test = '(npc (name 1) (index 1) (country 252) (race 0) (level 1) (ai 1) (range 20) (sight 160 240) (exp 2) (itemgroup 1 2) (str 21) (hth 1) (int 10) (wis 10) (dex 2) (hp 1) (mp 70) (aspeed 2400) (hit 0) (dodge 0) (attack 0 7 7) (magic 0 0) (defense 0 0) (absorb 0) (mspeed 1600 800) (quest (2 1 901 1) (3 1 902 1) (54 1 1025 1) (8001 1 933 1))) (npc (name 2) (index 2) (country 252) (race 0) (level 3) (ai 1) (range 16) (sight 160 240) (exp 4) (itemgroup 2 2) (str 27) (hth 2) (int 10) (wis 10) (dex 4) (hp 1) (mp 70) (aspeed 2400) (hit 0) (dodge 0) (attack 0 8 (magic 0 0) (defense 1 1) (absorb 0) (mspeed 1600 800) (resist 0 0 1 1 1) (quest (2 1 901 1) (3 1 902 1) (55 1 1026 1) (8001 1 933 1)))'; $test = preg_split('/(\n|\r|\n\r){2,2}/',$test); print_r($test); ?> and post output is it Array ( [0] => (npc (name 1) (index 1) (country 252) (race 0) (level 1) (ai 1) (range 20) (sight 160 240) (exp 2) (itemgroup 1 2) (str 21) (hth 1) (int 10) (wis 10) (dex 2) (hp 1) (mp 70) (aspeed 2400) (hit 0) (dodge 0) (attack 0 7 7) (magic 0 0) (defense 0 0) (absorb 0) (mspeed 1600 800) (quest (2 1 901 1) (3 1 902 1) (54 1 1025 1) (8001 1 933 1))) [1] => (npc (name 2) (index 2) (country 252) (race 0) (level 3) (ai 1) (range 16) (sight 160 240) (exp 4) (itemgroup 2 2) (str 27) (hth 2) (int 10) (wis 10) (dex 4) (hp 1) (mp 70) (aspeed 2400) (hit 0) (dodge 0) (attack 0 8 (magic 0 0) (defense 1 1) (absorb 0) (mspeed 1600 800) (resist 0 0 1 1 1) (quest (2 1 901 1) (3 1 902 1) (55 1 1026 1) (8001 1 933 1))) )
  20. can you post exactly string for input i try code for input (npc (name 1) (index 1) (country 252) (race 0) (level 1) (ai 1) (range 20) (sight 160 240) (exp 2) (itemgroup 1 2) (str 21) (hth 1) (int 10) (wis 10) (dex 2) (hp 1) (mp 70) (aspeed 2400) (hit 0) (dodge 0) (attack 0 7 7) (magic 0 0) (defense 0 0) (absorb 0) (mspeed 1600 800) (quest (2 1 901 1) (3 1 902 1) (54 1 1025 1) (8001 1 933 1))) (npc (name 2) (index 2) (country 252) (race 0) (level 3) (ai 1) (range 16) (sight 160 240) (exp 4) (itemgroup 2 2) (str 27) (hth 2) (int 10) (wis 10) (dex 4) (hp 1) (mp 70) (aspeed 2400) (hit 0) (dodge 0) (attack 0 8 (magic 0 0) (defense 1 1) (absorb 0) (mspeed 1600 800) (resist 0 0 1 1 1) (quest (2 1 901 1) (3 1 902 1) (55 1 1026 1) (8001 1 933 1))) end it output is INSERT INTO npc (`name`,`index`,`country`,`race`,`level`,`ai`,`range`,`sight`,`exp`,`itemgroup`,`str`,`hth`,`int`,`wis`,`dex`,`hp`,`mp`,`aspeed`,`hit`,`dodge`,`attack`,`magic`,`defense`,`absorb`,`mspeed`,`quest`) VALUES ('1','1','252','0','1','1','20','160 240','2','1 2','21','1','10','10','2','1','70','2400','0','0','0 7 7','0 0','0 0','0','1600 800','(2 1 901 1) (3 1 902 1) (54 1 1025 1) (8001 1 933 1)') INSERT INTO npc (`name`,`index`,`country`,`race`,`level`,`ai`,`range`,`sight`,`exp`,`itemgroup`,`str`,`hth`,`int`,`wis`,`dex`,`hp`,`mp`,`aspeed`,`hit`,`dodge`,`attack`,`magic`,`defense`,`absorb`,`mspeed`,`resist`,`quest`) VALUES ('2','2','252','0','3','1','16','160 240','4','2 2','27','2','10','10','4','1','70','2400','0','0','0 8 8','0 0','1 1','0','1600 800','0 0 1 1 1','(2 1 901 1) (3 1 902 1) (55 1 1026 1) (8001 1 933 1)') time is 0.037781 s
  21. tryto change $test = preg_split('/\n\n/',$test); to $test = preg_split('/(\n|\r|\n\r){2,2}/',$test);
  22. it's mean that 1st split didn't pass OK have you empty line betvin ?
  23. try <?php $test = '(npc (name 1) (index 1) (country 252) (race 0) (level 1) (ai 1) (range 20) (sight 160 240) (exp 2) (itemgroup 1 2) (str 21) (hth 1) (int 10) (wis 10) (dex 2) (hp 1) (mp 70) (aspeed 2400) (hit 0) (dodge 0) (attack 0 7 7) (magic 0 0) (defense 0 0) (absorb 0) (mspeed 1600 800) (quest (2 1 901 1) (3 1 902 1) (54 1 1025 1) (8001 1 933 1))) (npc (name 2) (index 2) (country 252) (race 0) (level 3) (ai 1) (range 16) (sight 160 240) (exp 4) (itemgroup 2 2) (str 27) (hth 2) (int 10) (wis 10) (dex 4) (hp 1) (mp 70) (aspeed 2400) (hit 0) (dodge 0) (attack 0 8 (magic 0 0) (defense 1 1) (absorb 0) (mspeed 1600 800) (resist 0 0 1 1 1) (quest (2 1 901 1) (3 1 902 1) (55 1 1026 1) (8001 1 933 1)))'; $test = preg_split('/\n\n/',$test); foreach ($test as $line){ $line = trim($line); // find table name $start = 0; for ($i = 0; $line[$i] !== ' '; $i++); $table = substr($line,1, $i - 1); // remove table name and last ) $lin = substr($line, $i + 1, strlen($line) - $i - 1); $count = 0; $key = array(); $value =array(); $part = ''; for ($i = 0; $i < strlen($lin); $i++){ $chr = $lin[$i]; if ($chr == '(') $count++; if ($chr == ')') $count--; if ($count > 0) { $part .= $chr; } elseif ($part) { $part = explode(' ', trim($part, '('), 2); $key[]= $part[0]; $value[]= $part[1]; $part = ''; } } $key = '(`'.implode('`,`', $key).'`)'; $value = "('".implode("','",$value). "')"; $sql = 'INSERT INTO '. $table.' '. $key. ' VALUES '. $value; echo $sql, "\n";//for testing // do query } ?>
  24. is evry line start with '(npc ' or it can be something diferent is one npc in one or multipli lines how you want to insert (mspeed 1600 800) or (quest (2 1 901 1) (3 1 902 1) (55 1 1026 1) (8001 1 933 1)) in db table
  25. try <?php $test = 'search.php?pagenumber=2&param0=a'; $test = parse_url($test); parse_str($test[query], $out); print_r($out); ?>
×
×
  • 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.