Jump to content

sasa

Staff Alumni
  • Posts

    2,804
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by sasa

  1. try <?php $ROWCOUBNT = 1; for ($i = 1; $i < 10; $i ++){ if ($ROWCOUNT %2 ==0){echo 'red';}else {echo 'white';} $ROWCOUNT=$ROWCOUNT + 1; echo "<br />\n"; } ?> it's work look line $ROWCOUNT=$ROWCOUBNT + 1;
  2. ups i don'i see comment mark online //$totalplus = 1; are you shure that your query return 20 lines? try to echo mysql_num_rows($result);
  3. $pageprev = $page-1; not $pageprev = $page--; and $pagenext = $page+1; not $pagenext = $page++;
  4. try <?php $ref[0] = "gen 1:12"; $ref[1] = "exo 2:31"; //foreach($ref as $value){ $value = implode(';',$ref); echo '<a href=www.findthepower.net/CP/BibleSuperSearch/bible_supersearch.php?submit=true&version=kjv&searchtype=All+Words&search=&wholeword=Whole+words+only.&table_display=true&lookup='.$value.'">'.$value.'</a>'; //}; ?>
  5. look mysql_num_rows() function
  6. in start $totalall = ($totalplus + $stoponfive); is 2 = 1 + 1, but your first index of $productname is one
  7. try <?php $columns = 2; $sql = "SELECT * FROM jos_classifieds_providers WHERE published=1"; $result = mysql_query($sql) or die("Couldn't execute query."); $num_rows = mysql_num_rows($result); $rows = ceil($num_rows / $columns); while($row = mysql_fetch_array($result)) { $data[] = $row['name']; $data1[] = $row['address']; $data2[] = $row['postalcode']; } echo "<table border='0'>\n"; for($i = 0; $i < $rows; $i++) { echo "<tr>\n"; for($j = 0; $j < $columns; $j++) { if(isset($data[$i + ($j * $rows)])) { echo "<td><img src=\"" . $data[$i + ($j * $rows)] . "\"></td>\n"; echo "<td valign=\"top\">" . $data1[$i + ($j * $rows)] . "<br>" . $data2[$i + ($j * $rows)] . "</td>\n"; } } echo "</tr>\n"; } echo "</table>\n"; ?>
  8. is_numeric()
  9. ad ; on the end of line 25
  10. trx <?php $a = '$url = "/a_page_name/" . $ref . "/";'; $ref = 123; eval($a); echo $url, "<br />\n"; $ref = 'abcd'; eval($a); echo $url, "<br />\n"; ?>
  11. try <?php if (isset($_GET['id'])) { $id = $_GET['id']; } else { $id = '1'; } $id = 's/adr/index'; //for testing if (preg_match('/^[a-z0-9_-]+[\/a-z0-9_-]+[a-z0-9_-]+$/i', $id)) { //require('./' . $id . '.php'); echo 'OK'; } else { die('Invalid Input'); } ?>
  12. try <?php include("../include/session.php"); if($session->logged_in){ $name = $_GET['name']; $ID_CAT = $_GET['ID_CAT']; $navi = $_GET['navi']; $body = $_GET['body']; $order = $navi + 1; $Update = ">=$order"; //$query = "SELECT `order` FROM `pages`"; //$result = mysql_query($query) or die(mysql_error()); //while($row = mysql_fetch_array($result)){ mysql_query("UPDATE `pages` SET `order`= (`order`+ 1) WHERE `order` $Update") or die(mysql_error()); //} mysql_query("INSERT INTO `pages` (`name`, `ID_CAT`, `order`, `body`) VALUES('$name', '$ID_CAT', '$order', '$body')") or die(mysql_error()); echo "Your page has been successfully uploaded into the database and will now appear on the site."; } ?>
  13. try <?php $input ='"I read an article called \"How To Use Regex\" it was very good"'; echo $input; preg_match_all("/([\"'])(.*?[^\\\])\\1/", $input, $strings); print_r($strings); ?>
  14. try <? session_start(); require_once("conn.php"); //check the user ??? $q1 = "select * from dd_rating where ItemID = '$_POST[itemID]' and username = '$_SESSION[username]' "; $r1 = mysql_query($q1) or die(mysql_error()); if(mysql_num_rows($r1) == '0') { // update db $q2 = "insert into dd_rating set ItemID = '$_POST[itemID]', Rating = '$_POST[rr]', username = '$_SESSION[username]' "; mysql_query($q2) or die(mysql_error()); echo 'rating updated'; } else echo 'You can not vote for ',$_POST['ItemID']; $q3 = "select count(*) as count, sum(Rating) as total, avg(Rating) AS av_rate from dd_items where ItemID = '$_POST[itemID]' "; $r3 = mysql_query($q3); $rating = mysql_fetch_array($r3); if (mysql_num_rows($rating) == 0) echo $_POST['ItemID'] , 'has no votes'; else { echo ' voting for ', $_POST['ItemID'],'<br />', 'total points: ', $rating['total'], '<br />', 'num of vaters: ', $rating['count'], '<br />', 'average: ', $rating['av_rate']; } ?>
  15. name must have [] on end then can have more then one value you need to select values what you want to form pass try <HTML> <HEAD> <TITLE>Form</TITLE> <SCRIPT LANGUAGE="JavaScript"> // ------------------------------------------------------------------- // moveSelectedOptions(select_object_From,select_object_To) // This function moves options between select boxes. Works best with // multi-select boxes to create the common Windows control effect. // Passes all selected values from the first object to the second // object. // You can also put this into the <SELECT> object as follows: // onDblClick="moveSelectedOptions(this,this.form.target) // This way, when the user double-clicks on a value in one box, it // will be transferred to the other (in browsers that support the // onDblClick() event handler). // ------------------------------------------------------------------- function moveSelectedOptions(from,to) { // Move them over if (!hasOptions(from)) { return; } for (var i=0; i<from.options.length; i++) { var o = from.options[i]; if (o.selected) { if (!hasOptions(to)) { var index = 0; } else { var index=to.options.length; } to.options[index] = new Option( o.text, o.value, false, false); } } // Delete them from original for (var i=(from.options.length-1); i>=0; i--) { var o = from.options[i]; if (o.selected) { from.options[i] = null; } } from.selectedIndex = -1; to.selectedIndex = -1; } // ------------------------------------------------------------------- // moveOptionUp(select_object) // Move selected option in a select list up one // ------------------------------------------------------------------- function moveOptionUp(obj) { if (!hasOptions(obj)) { return; } for (i=0; i<obj.options.length; i++) { if (obj.options[i].selected) { if (i != 0 && !obj.options[i-1].selected) { swapOptions(obj,i,i-1); obj.options[i-1].selected = true; } } } } // ------------------------------------------------------------------- // moveOptionDown(select_object) // Move selected option in a select list down one // ------------------------------------------------------------------- function moveOptionDown(obj) { if (!hasOptions(obj)) { return; } for (i=obj.options.length-1; i>=0; i--) { if (obj.options[i].selected) { if (i != (obj.options.length-1) && ! obj.options[i+1].selected) { swapOptions(obj,i,i+1); obj.options[i+1].selected = true; } } } } // ------------------------------------------------------------------- // selectAllOptions(select_object) // This function takes a select box and selects all options (in a // multiple select object). This is used when passing values between // two select boxes. Select all options in the right box before // submitting the form so the values will be sent to the server. // ------------------------------------------------------------------- function selectAllOptions(obj) { if (!hasOptions(obj)) { return; } for (var i=0; i<obj.options.length; i++) { obj.options[i].selected = true; } } // ------------------------------------------------------------------- // moveAllOptions(select_object,select_object[,autosort(true/false)[,regex]]) // Move all options from one select box to another. // ------------------------------------------------------------------- function moveAllOptions(from,to) { selectAllOptions(from); moveSelectedOptions(from,to); } // ------------------------------------------------------------------- // hasOptions(obj) // Utility function to determine if a select object has an options array // ------------------------------------------------------------------- function hasOptions(obj) { if (obj!=null && obj.options!=null) { return true; } return false; } // ------------------------------------------------------------------- // swapOptions(select_object,option1,option2) // Swap positions of two options in a select list // ------------------------------------------------------------------- function swapOptions(obj,i,j) { var o = obj.options; var i_selected = o[i].selected; var j_selected = o[j].selected; var temp = new Option(o[i].text, o[i].value, o[i].defaultSelected, o[i].selected); var temp2= new Option(o[j].text, o[j].value, o[j].defaultSelected, o[j].selected); o[i] = temp2; o[j] = temp; o[i].selected = j_selected; o[j].selected = i_selected; } </SCRIPT> </HEAD> <BODY> <style type="text/css"> #list { width: 200px;} #button {width: 100px;} </style> <br/> <h1>Field Selection</h1> <form name="fieldselectionform" method="POST" onsubmit="selectAllOptions(document.forms[0] ['selectedFields[]'])"> <table width="100%"> <tr> <td nowrap>Available Fields</td> <td> </td> <td nowrap>Selected Fields</td> <td> </td> <td rowspan=2 align="center" valign="bottom"> <input type="submit"><br /> <input type="button" id="button" value="Clear Form" onClick="moveAllOptions(document.forms[0] ['selectedFields[]'],document.forms[0]['availableFields[]']); "> </td> </tr> <tr> <td width="20%"> <select size="20" id="list" multiple name="availableFields[]" onDblClick="moveSelectedOptions(this.form ['availableFields[]'],this.form['selectedFields[]'])"> <option value="item_1">Item 1</option> <option value="item_2">Item 2</option> <option value="item_3">Item 3</option> <option value="item_4">Item 4</option></select> </td> <td width="20%" align="center" valign="center" nowrap> <input type="button" id="button" name="add" value=">>" onClick="moveSelectedOptions(document.forms[0] ['availableFields[]'],document.forms[0]['selectedFields[]']);"> <br><br> <input type="button" id="button" name="remove" value="<<" onClick="moveSelectedOptions(document.forms [0]['selectedFields[]'],document.forms[0]['availableFields[]']);"> </td> <td width="20%"> <select size="20" multiple id="list" name="selectedFields[]" onDblClick="moveSelectedOptions(this.form ['selectedFields[]'],this.form['availableFields[]'])"> </select> </td> <td width="20%" align="center" valign="center" nowrap> <INPUT TYPE="button" id="button" VALUE="Move Up" onClick="moveOptionUp(this.form ['selectedFields[]'])"> <BR><BR> <INPUT TYPE="button" id="button" VALUE="Move Down" onClick="moveOptionDown(this.form ['selectedFields[]'])"> </td> </tr> </table> </form> <?php if ($_POST) { echo 'You select: '; echo implode($_POST['selectedFields'],', '); } else echo 'nothing selected' ?> </BODY> </HTML>
  16. try <?php $page_name = "Home"; $left_column_Home = "0"; if (${'left_column_' . $page_name} == 0) echo "is 0"; else echo 'no 0'; //include_once ("left_column.php"); ?>
  17. can one user vote multiple time for same item?
  18. 2nd line of your code must be foreach ($_POST['ticketDetId'] as $key => $check){ don't forget key
  19. try if(count($_POST['selectedFields'])) $fields = implode(', ', $_POST['selectedFields']); $sql =" SELECT $fields FROM table1"; and change part of form to <select size="20" id="list" multiple name="availableFields[]" onDblClick="moveSelectedOptions(this.form ['availableFields'],this.form['selectedFields'])"> <option value="item_1">Item 1</option> <option value="item_2">Item 2</option> <option value="item_3">Item 3</option> <option value="item_4">Item 4</option></select>
  20. try foreach ($_POST['ticketDetId'] as $key => $check){ $values = explode(".", $check); $ticketDetid = $values[0]; $projId = $values[1]; $amt = $_POST['amtUS'][$key] //some check $amt }[code] [/code]
  21. try $insertGoTo .= "?" . "ticket_nbr=".$max_ticket[0];
  22. try <?php $file = '<?xml version="1.0" encoding="UTF-8"?> <webservices ver="1.0"> <status code="1.0"/> <markets> <market weight="10"> <name>Boston</name> </market> <market weight="10"> <name>Washington DC</name> </market>'; preg_match_all('/<name>(.+?)<\/name>/', $file, $m); $names = $m[1]; print_r($names); ?>
  23. try <?php $string = "hello world 4 3 56 hi"; echo $string1 = preg_replace('/[\s]+/',' ',$string); //remove spaces, tabs new line //or echo "<br />\n"; echo $string2 = preg_replace('/[ ]+/',' ',$string); // remove just spaces ?>
  24. you wont to add comma if is not new cat_name and before 1st part of creator name try <?php $creatorQuery = mysql_query("SELECT * FROM ComicCreators, Creators, CreatorCat WHERE ComicCreators.issueID = '".$ComicIssues['ID']."' AND ComicCreators.creatorID = Creators.ID AND ComicCreators.creatorCatID = CreatorCat.ID ORDER BY CreatorCat.ID"); $creatorNumRows = mysql_num_rows($creatorQuery); if($creatorNumRows > 0) { while($row = mysql_fetch_array($creatorQuery)){ $creators[$row['catName']][] = $row;} foreach($creators as $creatorCat => $creators) { echo "<p><strong>".$creatorCat.":</strong>"; $is_new_cat = true; foreach($creators as $creator){ $first_part_of_creator_name = true; if($creator['Fname'] !=Null){ if ($first_part_of_creator_name and !$is_new_cat) echo ','; $first_part_of_creator_name = false; $is_new_cat = false; echo " ".$creator['Fname'].""; } if($creator['Lname'] !=Null){ if ($first_part_of_creator_name and !$is_new_cat) echo ','; $first_part_of_creator_name = false; $is_new_cat = false; echo " ".$creator['Lname'].""; } if($creator['suffix'] !=Null){ if ($first_part_of_creator_name and !$is_new_cat) echo ','; $first_part_of_creator_name = false; $is_new_cat = false; echo " ".$creator['suffix'].""; } } echo "</p>\n"; } } else { echo "\t\t\t\t\t<p>No creative team information available.</p>\n";} ?>
  25. try <?php $file = 'poik <img src="sasa.jpg" po"src="e v>poejkr e <img blah src=\'pic1.gif\' "koklo > po pmoj <img src="pict.php?id=44">'; function my_find_pict($body){ $out = array(); preg_match_all('/<img ([^?]+?)>/',$body,$b); // find <img> tags foreach ($b[1] as $c) { preg_match('/src=["\'](.+?)["\']/',$c,$d);// find src atribute $out[] = $d[1]; } return $out; } $out = my_find_pict($file); 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.