Jump to content

sasa

Staff Alumni
  • Posts

    2,804
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by sasa

  1. echo "<option value=\"" . $getSN['SiteName'] . "\">" . $getSN['SiteName'] . "</option>";
  2. can you insert print_r($_POST); and post the output i think thet you need somethin like this <? if ($page == "update") { for ($j=0; $j < count($recordid); $j++) { if (count($sports[$j]) == 0) $sportslist = "None"; else $sportslist = implode(';', $sports[$j]); // { // for ($i=0; $i < count($sports[$j]); $i++) // { // $sportslist .= $sports[$i].";"; // } // } echo $recordid[$j]; echo "<br>"; echo $sportslist; echo "<br>"; //$utpquery = "UPDATE user_sports SET sports='$sportslist' where urecord = $recordid[$j]"; //$utpresult = mysql_query($utpquery) or die("Query failed 1"); } //header("Location: sports.php"); //exit; } ?>
  3. just <?php $word ="s a s a"; //$word = "sasa+test"; // 2nd test if(preg_match("/ /", $word)){ echo "there are spaces"; }else{ echo "there are no spaces"; } ?> but the problem is different in string the regular characters is A-Z and a-z and 0-9 and ' ' (space) and '_' if string have any other character(s) then it is not regular <?php $word = 'sasa & angelina'; if (preg_match("/[^a-zA-Z0-9 _]+/", $word)) echo 'not regular'; else echo 'regular'; ?>
  4. 1st change your form <form name="frm1" method="post" action="sports.php?page=update"> <table cellspacing="0" cellpadding="0" border="0"> <? $squery = "select * from user_sports"; $sresult = mysql_query($squery) or die ("Query Failed"); $number = 0; while( $row = mysql_fetch_array( $sresult ) ) { $sports = explode(";",$row['sports']); ?> <tr> <td> <input name="recordid[$number]" type="hidden" value="<? echo $row['urecord'] ?>"> <input name="sports[$number][]" type="checkbox" id="sports[]" value="Football" <? if (is_array($sports) == TRUE) { if (in_array("Football", $sports)) echo "CHECKED"; } ?>> Football<br> <input name="sports[$number][]" type="checkbox" id="sports[]" value="Cricket" <? if (is_array($sports) == TRUE) { if (in_array("Cricket", $sports)) echo "CHECKED"; } ?>> Cricket <br> <input name="sports[$number][]" type="checkbox" id="sports[]" value="Basketball" <? if (is_array($sports) == TRUE) { if (in_array("Basketball", $sports)) echo "CHECKED"; } ?>> Basketball </td> </tr> <? $number++;} ?> </table> </form>
  5. redarrow, are you try this code try <?php $word ="s a s a"; //$word = "sasa+test"; // 2nd test if(preg_match("/[^a-zA-Z][][a-zA-Z][][a-zA-Z]/", $word, $s)){ echo " there are spaces"; }else{ echo "there are no spaces"; } ?>
  6. "/[^a-zA-Z0-9 _]+/" means one or more characters that is NOT in sets a-z or A-Z or ' ' or '_' the string 04595867&%ยค#"! have character that is not in set (& or % etc.) and preg_match is True, true or anything = true $_POST['key'] = 'sfasd3254djs45dkjd' and echo is no match
  7. her is 35 celsius (very hot) you are right implode(" AND ", $where) dont forget to add spaces
  8. something like this $where = array(); if ( $_GET['account'] !="" ) { $where[] = "account='". $_GET['account']."'";} if ( $_GET['password'] !="") {$where[] = "password='".$_GET['password']."' "} ... if(count($where) > 0) $where = ' WHERE '.implode("OR", $where); $sQuery = "Select * from account". $where;
  9. are you want field 'todo_done' is 1 or any value in one query you have where todo_done='1' and on another not make it same
  10. try if($cat_id == $no_cat) { // $sql .= " AND `cat_id`='$cat_id'"; } else { $sql .= " AND `cat_id`='$cat_id'"; }
  11. try <?php require_once "maincore.php"; include('functions2.php'); $a = array(); $blogsQuery = mysql_query("SELECT * FROM user_blogs ORDER BY date DESC") or die(mysql_error()); while($blogsRow = mysql_fetch_array($blogsQuery)){ $av = get_rating_avg($blogsRow['user_blogs_id'], 1); $avg = "<p>".$av."</p>"; //Bruger billede $image = get_useravatar($blogsRow['user_id']); if(empty($image)){ $image = "<img src='images/avatars/none.jpg' alt='".get_useravatar($blogsRow['user_id'])."' width='50' />"; }else{ $image = "<img src='images/avatars/".get_useravatar($blogsRow['user_id'])."' alt='".get_useravatar($blogsRow['user_id'])."' width='50' />"; } //Tekst $text = " <table> <tr> <td style='width: 500px; border: 1px solid #000000;'> <table> <tr> <td> <table> <tr> <td><div class='user_blogs_image'>".$image."</div></td> </tr> </table> </td> <td> <table> <tr> <td><p>".$blogsRow['headline']."</p></td> </tr> <tr> <td><div><p>".get_username($blogsRow['user_id'])." | ".showdate("longdate",$blogsRow['date'])." | Kommentarer (".get_comments($blogsRow['user_blogs_id']).") | <a href='user_view_blog.php?blog=".$blogsRow['user_blogs_id']."'>Lรฆs mere</a></p></div> <div><p>".substr($blogsRow['text'], 0, 100)."</p></div></td> </tr> </table> </td> </tr> </table> </td> <td> <table> <tr> <td> </td> </tr> </table> </td> </tr> </table> "; $a[] = array($av, $avg, $text); } array_multisort($a, SORT_DESC); foreach($a as $b){ echo $b[1],$b[2];} ?> not tested
  12. change your form to look like <tr> <td width="33%">Goalkeeper:</td> <td width="33%"><input name="r[Goalkeeper][name]" type="text"></td> <td width="33%"><input name="r[Goalkeeper][goals]" type="text" /></td> </tr> <tr> <td width="33%">Player Two</td> <td width="33%"><input name="r[Player_Two][name]" type="text" /></td> <td width="33%"><input name="r[Player_Two][goals]" type="text" /></td> </tr> etc, and your insert cide f(isset($_POST['Submit'])) { $match_id=mysql_insert_id(); if(!isset($_GET['match_id'])) { $match_id = $_GET['match_id']; foreach($_REQUEST['r'] as $position => $row) { $row = implode("', '",$row); $result = mysql_query("Insert into player_stats(position,name,goals,match_id) values('$position','$row','$match_id')"); } } } not tested
  13. try <?php $a = Array( '0' => Array( 'Field' => Array( 'Chemistry' => Array( 'Physical Chemistry' => Array ( 'Jason Stairs' => Array('time-of-flight mass spectrometry', 'omputer programming', '' ,'' ,'', '', '') ) ) ) ), '1' => Array( 'Field' => Array( 'Materials' => Array( 'Materials Chemistry' => Array( 'Roshan Shrestha' => Array('awesome', 'cool', 'super', 'Rock and roll', '', '', '') ) ) ) ), '2' => Array( 'Field' => Array( 'Physics' => Array( 'Nuclear Physics' => Array( 'Laura Stonehill' => Array('Dark matter', 'Neutrino', 'Low-background', 'Pulse-shape analysis', 'Detector development', '', '') ) ) ) ), '3' => Array( 'Field' => Array( 'Chemistry' => Array( 'Inorganic Chemistry' => Array( 'Robert Smith' => Array( 1, 2, 3, 4, '', '', '') ) ) ) ), '4' => Array( 'Field' => Array( 'Physics' => Array( 'Astronomy' => Array( 'Redding Ryan' => Array( '', '', '', '', '', '', '') ) ) ) ), '5' => Array( 'Field' => Array( 'Chemistry' => Array( 'Physical Chemistry' => Array( 'Tome Jones' => Array( '', '', '', '', '', '', '') ) ) ) ) ); $out = array(); foreach ($a as $field) { foreach ($field['Field'] as $dep => $subdep){ if (isset($out[$dep])) $out[$dep] = array_merge_recursive($out[$dep],$subdep) ; else $out[$dep] = $subdep; } } print_r($out); ?>
  14. are you try this <?php $a = array('free', 'basic', 'cool'); $b = array('program', 'free', 'open source'); $combined = array_unique(array_merge($a, $b)); print_r($combined); ?>
  15. SELECT * FROM creep_data WHERE minuserlvl < '$user[\'lvl\']' AND maxuserlvl > '$user[\'lvl\']' ORDER BY rand() LIMIT 1 no id field in order
  16. remove else $msg[] = ''; from your script or you never see quote_result.php
  17. change $do=explode(',',$_POST['no']); to $do=implode(',',$_POST['no']);
  18. try $products = fopen("lphearts.csv", "r"); while ($thisproduct = fgetcsv($products,1000,',')) $out[] = $thisproduct; $row = $_GET['item']; $thisproduct = $out[$row]; $item = $thisproduct[0]; $price = $thisproduct[1]; $stock = $thisproduct[2]; $description = $thisproduct[3]; fclose($products);
  19. can we see the form code?
  20. SELECT users.*, user_images.* FROM users LEFT JOIN user_images ON users.id = user_images.ownerID WHERE users.id = '$id' something like this
  21. try <?php $amount = "$52.99"; $n = preg_match('/([\$0-9]+)\.([0-9]+)/',$amount,$a); echo "<h2>" . $a[1] . " <sup>" .$a[2]. "</sup></h2>"; ?>
  22. try $list = GetFieldList($database, $table); $i = 1; foreach($list as $name) { echo "name of field$i is $name"; $i++; }
  23. sorry i made mistake 'foreach($answers ...' not '$answera'
  24. try function contest_extract_answers($answers_code){ $answers = explode("|",trim($answers_code,"|")); array_unshift($answers,""); unset($answers[0]); $out =''; foreach($answera as $v) {$out .= <img src='http://www.domain.com/photos/".$v.">";}; //return "<img src='http://www.domain.com/photos/".$answers.">"; return $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.