Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. Wow really? im about to try this.. thanks a bunch.. this will be epic our users will have alot of more free time to beable to use whatever they want do i have to have array? No.
  2. If your form is auto-validated then it's true you don't need them.
  3. I honestly don't know but yes that is quite possible. Personally I like to write it myself as then I know what is in it and how it works (as I know that it uses my kind of thinking and thus also inherits my assumptions). As you are using Dreamweaver it may be possible that your thinking differs from that of those who wrote Dreamweaver and thus the code it generates creating problems along the way. I have nor experience with Dreamweaver nor with AllWebMenus so it possible I'm not able to help you.
  4. $txt = (array) preg_replace('/\<(meta|script).+\>/', '', $txt);
  5. If you are already losing the will to live over this small problem you might aswell quit programming because you'll encounter problems later that will be a lot harder then this one. if(strlen($search)<3) Can also be written as: if (!isset($search[2])) -- echo ""; Is useless as it does nothing, remove it. $search_exploded = explode(" ",$search); If you want the words inside a string use: $search_exploded = str_word_count($search, 1); $where = array(); foreach ($search_exploded as $search_each) { $where[] = "company LIKE '%$search_each%'"; } $construct = 'SELECT * FROM members WHERE ' . implode(' OR ', $where); print $construct; And can you please explain which problem you are having?
  6. $securepass = crypt ($_POST['password']); $sql2 = "SELECT count(*) FROM Users WHERE userName='$_POST[username]' AND passWord='$securepass'"; $result2 = mysql_query($sql2) or trigger_error('Error: ' . mysql_error()); $Count = mysql_result ($result2,0);
  7. $sql="INSERT INTO photo (url)VALUES('$url')"; if (!mysql_query($sql,$con))
  8. <?php $genres = array(); $query="SELECT moj_id, moj_genre FROM genres INNER JOIN genrelinkcd ON genres.genre_id=genrelinkcd.genre_id WHERE genrelinkcd.moj_id='$id'"; //.. while ($row = mysql_fetch_row($result)) { $genres[$row[0]] = $row[1]; //.. ?> <input type="text" name="tag[<?php print $row[0]; ?>]" value="<?php print $row[1]; ?>"><!-- Tag:Rock --> <input type="text" name="tag[<?php print $row[0]; ?>]" value="<?php print $row[1]; ?>"><!-- Tag:Pop --> <input type="text" name="tag[<?php print $row[0]; ?>]" value="<?php print $row[1]; ?>"><!-- Tag:Soul --> <?php } if (isset($_POST['tag']) && is_array($_POST['tag'])) { $ids = array_keys($genres); foreach ($_POST['tag'] as $id => $value) { if (!in_array($id, $ids)) { //newly added tag Rock, Pop, Soul, [Jazz] } else if ($value !== $genres[$id]) { //modified a tag } } } ?>
  9. No I wasn't it just selects state as a default (when none was provided) you can change it to organization or even something else (not present in the $validBy). You are using Dreamweaver get used to it I've heard many people complain about the serious overhead Dreamweaver creates. I do think I used a different algorithm. I assumed something like: <table> <form action="search.php"> <tr> <td><input type="text" name="query"> <input type="hidden" name="order" value="DESC"></td> <td><select name="size"> <option value="10">10</option> .. <option value="100">100</option> </select> </td> </tr> <tr> <th><button type="submit" name="by" value="state">State</button></th> <th><button type="submit" name="by" value="region">Region</button></th> </tr> repeat region </form> </table>
  10. Please if you copy my code then copy it exactly: while ($row = mysql_fetch_assoc($result)) { $currentDate = '';//this will reset $currentDate on each loop if ($currentDate !== $row['dagstimi']) { Should be: $currentDate = ''; while ($row = mysql_fetch_assoc($result)) { if ($currentDate !== $row['dagstimi']) { As in: $query = '... ORDER BY date DESC';//!important $currentDate = ''; while ($row = mysql_fetch_assoc($result)) { if ($currentDate !== $row['date']) { echo $row['date'], '<br>'; $currentDate = $row['date']; } echo $row['cat'], ' ', $row['sometext_for_url'], '<br>'; }
  11. Please do realise: || 0 === $difference I'm not sure if you want this at all but this selects the key that has the same value as $number if present. And yes if you pass 56, 20 would win as it creates the lowest difference and is the highest number available in the array. Sorry if this is not what you were looking for but you must understand that the answer given is in direct correlation with the question asked.
  12. Do you print it like this? echo "<a href='http://www.fsddf.com/info.php?id=$id' style='text-decoration: none'>"; What does the url say when click on this link? does id have a value in the url?
  13. <a href="info.php?data=<?php print urlencode(base64_encode($info)); ?>"> You could ofcourse instead of passing $info also pass the id, like: <a href="info.php?id=<?php print $id; ?>">
  14. $number = 5; $nearestNumberKey = 0; $nearestDifference = PHP_INT_MAX; foreach ($numbers as $key => $value) { $difference = abs($number - $value); if ($difference < $nearestDifference || 0 === $difference) { $nearestDifference = $difference; $nearestNumberKey = $key; } } echo 'nearest number to ', $number, ' is ', $numbers[$nearestNumberKey];//Output: nearest number to 5 is 4 I realise that both 4 and 6 are candidates but as you specified key the first one he comes across wins.
  15. Instead of: $num_rows=mysql_num_rows($result); $count=1; while ($row = mysql_fetch_row($result)) { echo "$row[0]"; if ($count < $num_rows) { echo ', '; } $count++; } You could also do: $parts = array(); while ($row = mysql_fetch_row($result)) { $parts[] = $row[0]; } print implode(', ', $parts);
  16. <a href="info.php?data=<?php print base64_encode($info); ?>"> On info.php print base64_decode($_GET['data']);
  17. require_once('class.configuration.php'); class Database {
  18. $div_class = 'first_column_class : second_column_class : third_column_class'; If you print this directly into the class attribute then you may use something like: $div_class = 'column column-right'; .column { /*css rules for a column*/ } .column-right { /*css rules for the right column (reminder: css rules from .column are already applied)*/ }
  19. I need them in DIFFERENT files. No problemo. Create a file class.configuration.php and a file class.database.php. In your class.database.php add the line and in every other file you need the configuration constants: require_once('class.configuration.php');
  20. $words = str_word_count($text, 1); print_r($words);
  21. Wouldn't this work? $singleColumn = ''; $firstColumn = $secondColumn = ''; for ($b = 0; (($this->news_amount - ($b * $this->news_column)) > 0); $b++) { for ($c = 0; $c < $this->news_column; $c++) { if ($this->news_column == 1) { $div_class = 'single_column_class'; } elseif ($this->news_column == 2) { $div_class = ($c == 0) ? 'first_column_class' : 'second_column_class'; } elseif ($this->news_column == 3) { $dir_class = 'third_column_class'; } $column = ($b * $this->news_column) + $c;
  22. Well a table won't suffice as you'll need layers. Another great advantage is the ability to put objects into your game like trees, npc's, bushes, etc.. So you only need to provide a surface and fill it with those objects. You'll ofcourse also need JavaScript for collision-detection. You can't walk over a tree, can you? <style type="text/css"> .tree { display: block; width: 20px; height: 20px; background: url(gfx-tree.jpg) } .shrub { display: block width: 5px; height: 5px; background: url(gfx-shrub.jpg) } .t1 { position: absolute; top: 15px; left: 30px } .s1 { position: absolute; bottom: 30px; right: 5px } .character { z-index: 99 } .neo { background: url(gfx-char-neo.jpg) } #ground { display: block; position: relative } #player { display: block; position: absolute; top: $y; left: $x } /* $x and $y are start values */ </style> <div id="ground"> <div class="tree t1"></div> <div class="shrub s1"></div> <div id="player" class="character neo"></div> </div>
  23. Post your code. Edit: nevermind looking at it.
  24. The mess created is in correlation with the size of your head and it's contents whereby in some cases a vacuum cleaner will no longer fussice I think I know most of the PHP functions and what they do so if you need something you may always ask and I'll tell you if such a function exists (and it's name ofcourse)
×
×
  • 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.