Jump to content

sasa

Staff Alumni
  • Posts

    2,804
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by sasa

  1. sorry '/\[yt\]http:\/\/youtube.com\/watch\?v=(.*?)\[\/yt\]/' escape '?' too
  2. in your query you don't select news_body just news_id and news_title $query = "SELECT news_id, news_title, news_body FROM news ORDER BY news_id DESC LIMIT 0,3";
  3. are you try this[codeg<?php $a = 'Servers Lab,Servers Non_Standard,Servers Group,Servers Operations,Servers DEV,Servers TS,DEV,Servers RIB,Non_Standard,Servers Infrastructure,Servers CITRIX,Infrastructure,Servers CITRIX,DEV,Servers CITRIX,Operations,Servers CITRIX,Lab,Servers TS,Infrastructure,Servers TS,Operations,Servers TS,Lab,Servers Stage,Infrastructure,Servers'; $a = explode("\n",$a); foreach ($a as $v) { $b[] = implode('/',array_reverse(explode(',',$v))); } echo '<pre>'; print_r($b); echo '</pre>'; // or foreach ($a as $v) { if (strpos($v, ',')) $c[] = implode('/',array_reverse(explode(',',$v))); } echo '<pre>'; print_r($c); echo '</pre>'; ?>
  4. error is in line <li><a href="">latest posts</a></li>
  5. change $sql = "INSERT INTO topicstarter ('posttitle', 'postdate', 'poster', 'message') VALUES ('$posttitle','$postdate','$poster','$message')"; to $sql = "INSERT INTO topicstarter (posttitle, postdate, poster, message) VALUES ('$posttitle','$postdate','$poster','$message')"; or $sql = "INSERT INTO topicstarter (`posttitle`, `postdate`, `poster`, `message`) VALUES ('$posttitle','$postdate','$poster','$message')";
  6. or <?php $a ='*sasa*dfg*jkl*55555*6666'; preg_match_all('/\*([^\*]+)/',$a, $b); print_r($b[1]); ?>
  7. try <?php $var = " Servers; Lab,Servers; Non_Standard,Servers; Group,Servers; Operations,Servers; DEV,Servers; TS,DEV,Servers; RIB,Non_Standard,Servers; Infrastructure,Servers; CITRIX,Infrastructure,Servers; CITRIX,DEV,Servers; CITRIX,Operations,Servers; CITRIX,Lab,Servers; TS,Infrastructure,Servers; TS,Operations,Servers; TS,Lab,Servers; Stage,Infrastructure,Servers "; $var = str_replace("\n",'',$var); $var = explode(';',$var); foreach ($var as $str) { $str = explode(',',$str); $tmp1 = array(); $tmp2 = array(); if (count($str) > 1){ $tmp2[$str[1]] = $str[0]; for ($i = 2; $i < count($str); $i++) { $tmp1[$str[$i]] = $tmp2; $tmp2 = $tmp1; } } else $out[] = $str[0]; $out = array_merge_recursive($out,$tmp2); } print_r($out); ?>
  8. no it match that have character that is not one of this 'a-zA-Z0-9 ' ' ' is space you are right don't need both a-z and A-Z
  9. try <td colspan=4><input type=\"button\" onClick=\"parent.location='delete.php?view=delete'\"></td>
  10. try <?php $nicktrim = 's a s a 123+456'; if (eregi('[^a-zA-Z0-9 ]',$nicktrim)) echo 'NO'; else echo 'OK'; ?>
  11. try <?php function my_rand($a, $b, $c=3) { $a = floor($a) * (++$c) + ($a - floor($a)) * 10; $b = floor($b) * $c + ($b - floor($b)) * 10; $x = rand($a, $b); $out = floor($x / $c) * 10 + ($x % $c); return $out / 10; } $start = 14.1; $end = 16.2; echo my_rand($start, $end); ?>
  12. what numbe must be in lineal in 2nd row (tag no = 20000) BTW in header of your table say thet have 3 sizes but in table is just 2
  13. try <?php mysql_connect('localhost') or die('blek'); mysql_select_db('test'); $sql ="Select distinct size from invertory_size where TID=2 order by size asc"; $r = mysql_query($sql) or die('upš'); while ($row = mysql_fetch_array($r)){ $pos[$row['size']] = $i++; } $sql ="Select * from invertory_size where TID=2 order by tag_no asc, size asc"; $r = mysql_query($sql) or die('upš'); echo '<table border="3"> <tr> <td width="100">Tag No.</td>'; foreach ($pos as $key => $value) echo "<td bgcolor=\"034FFF\" width=\"50\" align=\"center\">",$key,'</td>'; echo'<td align="right" width="100">Pieces</td> <td align="right" width="100">Lineal</td> <td align="right" width="100">FBM</td></tr>'; $curent = ''; $start = true; while ($row = mysql_fetch_array($r)){ if($start) { echo '<tr><td>', $row['tag_no'],'</td>'; $i = 0; $start = false; } elseif ($row['tag_no']!=$curent) { $curent = $row['tag_no']; while ($i++ < count($pos)) { echo '<td> </td>'; //$i++; } echo '<td> </td><td> </td><td> </td></tr><tr><td>'.$row['tag_no'].'</td>'; $i = 0; } while ($i++ < $pos[$row['size']]) { echo '<td> </td>'; //$i++; } echo '<td>',$row['qty'],'</td>'; } while ($i++ < count($pos)) echo '<td> </td>'; echo '<td> </td><td> </td><td> </td></tr></table>'; ?>
  14. Index.php <?php //connect mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("directory") or die(mysql_error()); //select table $result = mysql_query ("SELECT * FROM countries"); //get entries //$row = mysql_fetch_array ($result); <--- remove this line //print result while ($row = mysql_fetch_array ($result)){ $id=$row["Id"]; $status=$row["Status"]; $country=$row["Country"]; echo "<a href=\"showlinks.php?id={$id}\">{$country}[/url] "; } ?> Showlinks.php <?php //connect mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("directory") or die(mysql_error()); $id = $_GET['id']; // <---- add this line if(!isset($id)) { die("Invalid ID"); } $id = $_GET["id"]; $query = mysql_query("SELECT * FROM links WHERE Id = '{$id}'") or die(mysql_error()); while($row = mysql_fetch_assoc($query)) { // Output... $id1=$row["id"]; echo "$id1"; } ?>
  15. try <?php require_once ('../mysql_connect.php'); // first update database if($_POST['Submit']){ foreach ($_POST['id'] as $key => $id){ $rate_a = $_POST['rate_a'][$key]; $rate_b = $_POST['rate_b'][$key]; $sql1="UPDATE tbl_shipping SET sh_us_overnight='$rate_a', sh_us_economy='$rate_b' WHERE id='$id'"; $result1 = mysql_query($sql1) or die(mysql_error()); } } $sql="SELECT * FROM tbl_shipping"; $result=mysql_query($sql); // Count table rows $count=mysql_num_rows($result); ?> <table width="500" border="0" cellspacing="1" cellpadding="0"> <form name="form1" method="post" action=""> <tr> <td> <table width="500" border="0" cellspacing="1" cellpadding="0"> <tr> <td align="center"><strong>Id</strong></td> <td align="center"><strong>Overnight</strong></td> <td align="center"><strong>Economy</strong></td> </tr> <?php while($rows=mysql_fetch_array($result)){ ?> <tr> <td align="center"><input type="hidden" name="id[]" value="<?php echo $rows['sh_us_id']; ?>"><?php echo $rows['sh_us_id']; ?></td> <td align="center"><input name="rate_a[]" type="text" id="name" value="<? echo $rows['sh_us_overnight']; ?>"></td> <td align="center"><input name="rate_b[]" type="text" id="lastname" value="<? echo $rows['sh_us_economy']; ?>"></td> </tr> <?php } ?> <tr> <td colspan="4" align="center"><input type="submit" name="Submit" value="Submit"></td> </tr> </table> </td> </tr> </form> </table> <?php // Check if button name "Submit" is active, do this if($result1){ header("location:index.php"); } mysql_close(); ?>
  16. No. Error is in part where you pool data from database. Can we see it?
  17. Try to change 1st foreach loop (ones with reference &$test) <?php $TextBoxData['TextBox1'] = Array ( 'name' => "TextBox1", 'value' => "Question1", 'show' => 1, 'required' => 1, 'text' => "Answer1" ); $TextBoxData['TextBox2'] = Array ( 'name' => "TextBox2", 'value' => "Question2", 'show' => 1, 'required' => 1, 'text' => "Answer2" ); $TextBoxData['TextBox3'] = Array ( 'name' => "TextBox3", 'value' => "Question3", 'show' => 1, 'required' => 1, 'text' => "Answer3" ); $TextBoxData['TextBox4'] = Array ( 'name' => "TextBox4", 'value' => "Question4", 'show' => 1, 'required' => 1, 'text' => "Answer4" ); echo "Vardump<br />"; var_dump($TextBoxData); echo "<hr>Before first loop<br />"; print_r($TextBoxData); //TextBoxes foreach($TextBoxData as $key => $text) { if($text['required'] == 1 && $text['text'] == "") { $TextBoxData[$key]['missing'] = 1; $missing++; } } echo "<hr>Before second loop<br />"; print_r($TextBoxData); $first = 1; foreach($TextBoxData as $text) { if($text['text'] != "") { if($first == 1) { $msg .= "<br />Has the following additional information to share<br /><br />"; $first = 0; } $msg .= "- In Response to: <br />"; $msg .= " {$text['value']} <br />"; $msg .= " - They said : <br />"; $msg .= " {$text['text']} <br />"; } } echo $msg; echo "<hr>After all loops<br />"; print_r($TextBoxData); echo "<hr>Vardump<br />"; var_dump($TextBoxData); ?>
  18. try <?php //Board Information $space = ' '; $ident_array = array('main' => 0, 'sub' => 1, 'subsub' => 2); $boards = array( array("main", "General Board", "forum.php?id=1", "This should go under the General Boad"), array("sub", "Sub Genderal", "forum.php?id=2", "This should go under the Sub general Board"), array("subsub", "Sub Sub Genderal", "forum.php?id=12", "This should go under the Sub sub general Board"), array("main", "Misc Board", "forum.php?id=3", "This should go under the Misc Board"), array("sub", "Sub Misc", "forum.php?id=4", "This Should go under the Sub Misc Board") ); foreach ($boards as $x) { echo str_repeat($space, $ident_array[$x[0]]),'<a href="',$x[2],'">',$x[1],'</a><br />',"\n"; echo str_repeat($space, $ident_array[$x[0]]),$x[3].'<br />'; } ?>
  19. are you star and end <table> tags I try <?php $cache = '<table border="3">'; //$dbtable = 'table_care'; //$depts = $db->Execute("SELECT * FROM $dbtable WHERE batch_nr='92'"); //while($row= $depts->FetchRow()){ //$h = $row['serial_value']; $h = '&=carand=1-2=3=1&=laptan=4-14=3=2'; $keywords = preg_split ("/[\=,\&]+/", "$h"); for ($i = 1; $i < count($keywords); $i += 4) { $cache .= '<tr>'; for ($j = 0; $j < 4; $j++) { if ($i + $j < count($keywords)) { $cache.='<td> '.$keywords[$i + $j].' </td>'."\n"; } else $cache .= '<td> </td>'."\n"; } $cache .= '</tr>'; } //} echo $cache, '</table>'; ?> and output is OK
  20. if you wont to grab all type of input, not just hidden, change line preg_match_all ('/<input[^>]+hidden[^>]+>/',$text,$b); to preg_match_all ('/<input[^>]+>/',$text,$b);
×
×
  • 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.