Jump to content

HuggieBear

Members
  • Posts

    1,899
  • Joined

  • Last visited

Everything posted by HuggieBear

  1. Take a look at the [url=http://uk.php.net/manual/en/ref.curl.php]CURL[/url] library Regards Huggie
  2. [quote author=Cep link=topic=123969.msg513089#msg513089 date=1169722662] [quote author=jumpenjuhosaphat link=topic=123969.msg513084#msg513084 date=1169722081] No, I'm using the get method.  It needs to be the get method so that the pages can be bookmarked.  If I use the post method, it'll hide the underlying variables and the page won't be markable.[/quote] I'm a little lost by this but if you say so. [/quote] Cep, Your understanding of HTML forms is slightly off the mark.  When you submit a form, you can use either the POST or the GET method.  The OP clearly has GET in his/her form method and so the parameters will be passed in the URL. Regards Huggie
  3. [quote author=jagguy link=topic=123965.msg513090#msg513090 date=1169722904] You wouldn't run the file on its own as it expects a value and returns a value. [/quote] I'm fully aware of that, but by adding the line I suggested and running the code again, you'll be doing some debugging.  Identifying if the value that actually gets passed to the php script from Flash is actually what you expect. Regards Huggie
  4. OK, my advice would be to a) separate the parts of the if statement for readability, b) change the short <? tags for <?php and c) check that your variable names are consistent, as identified by Tyche. [code]<?php if(($user['wilderness'] == 1) && ($ir['posX'] == $users['posX']) && ($ir['posY'] == $users['posY'])){   echo $user['username']; } ?>[/code] Also, check the case sensitivity. If all this fails then we may need a little bit more of the code. Regards Huggie
  5. OK, my advice would be to add this line to the top of your script, just below include("dbconnect.php"); [code=php:0]echo $_GET['alName'];[/code] Does it output the value you're expecting? Huggie
  6. Do a search on these forums and google, for the term CAPTCHA. Regards Huggie
  7. If you echo each of the variables before hand, do they show the correct data? That should be the first thing you do, if they aren't then it's likely to be variable assignment at fault, if they are then it's the if statement. Regards Huggie
  8. You should read up about [url=http://uk.php.net/manual/en/ref.errorfunc.php]error reporting[/url] within php. Also the [url=http://uk.php.net/manual/en/function.error-reporting.php]error_reporting()[/url] function Regards Huggie
  9. [quote author=chriscloyd link=topic=123806.msg513032#msg513032 date=1169718183] $_SESSION['member'] or $_SESSION['nonmember'] [/quote] Chris, This is a good point, I had assumed that as the OP had only posted a snippet of code that they had already assigned the session variables to $member or $nonmember. Huggie
  10. Maybe you need to use something like [url=http://uk.php.net/manual/en/function.imagecreatefromstring.php]imagecreatefromstring()[/url] Regards Huggie
  11. OK, you were on the right track with strtotime(); Here's some sample code I just knocked up, you could even put it into a function if you wanted. [code]<?php // Test data (unordered) $folders = array('01-01-1970-first', '05-01-1970-second', '10-06-2000-fifth', '05-03-1985-third', '19-12-1993-fourth'); // Loop through each folder foreach ($folders as $name){   preg_match('/^(\d{2})-(\d{2})-(\d{4})/', $name, $segments); // match each segment of the date   $gnu_date_format = $segments[3].$segments[2].$segments[1]; // put date in gnu format (yyyymmdd) for passing to strtotime()   $timestamp = strtotime($gnu_date_format); // change the date format to a unix timestamp   $newlist[$timestamp] = $name; // new array keyed on timestamp } // Sort the new list ksort($newlist); // Echo the folder names foreach ($newlist as $folder){   echo "$folder<br>\n"; } ?>[/code] Regards Huggie
  12. Fair comment, I wasn't saying that what you'd posted was incorrect.  I think it's good that people are prepared to make posts regarding additional methods. Regards Huggie
  13. The code you have looks fine, and if you view the source and get the result that you've pasted then the only conclusion is that the 'processing' you've cut out is causing an issue of some kind. Regards Huggie
  14. [quote author=mjdamato link=topic=123806.msg512326#msg512326 date=1169651760] I would assume that both of those can't be true at the same time. Thus, your test will always pass. [/quote] Hence, the change to AND instead of OR :) Huggie
  15. You must output a header in imagecreator.php, like this: [code=php:0]header("Content-type: image/jpg");[/code] Of course this will change depending on the type of image you're outputting. Regards Huggie
  16. In that case you need AND, not OR. [code]<?php if ((!$member) && (!$nonmember)){   // do whatever } ?>[/code] With OR, only one of the sides needs to be true for the whole statement to be true, with AND, both sides need to be true, which is what you're after. Regards Huggie
  17. OK, what are you trying to achieve? It maybe that !$member isn't actually doing what you think it is. Regards Huggie
  18. Try putting a '$' symbol in front of nonmember... You've missed it out :) Regards Huggie
  19. Well, I think that you have the answer right there! Have you tried what they suggested, or have you asked your host to do it? Regards Huggie
  20. Have you read the manual, as this makes it pretty clear! [b]mysql_fetch_array()[/b] [quote]Fetch a result row as an associative array, a numeric array, or both[/quote] [b]mysql_fetch_assoc()[/b] [quote]Fetch a result row as an associative array[/quote] Regards Huggie
  21. I'd go with [url=http://uk.php.net/manual/en/function.mysql-real-escape-string.php]mysql_real_escape_string()[/url]. Regards Huggie
  22. Another alternative, if you want to use it in multiple places, you could create the image like you are and save it. Depending on the type of image you're creating, you'll have a line that looks something like this, that outputs the image to the browser: [code=php:0]imagejpeg($im);[/code] or [code=php:0]imagejpeg($im, null, 100);[/code] By changing, or adding the second parameter, you can save the image. [code=php:0]$filename = '/home/domains/domain.co.uk/images/dynamic.jpg'; imagejpeg($im, $filename, 100);[/code] Regards Huggie
  23. [quote author=bqallover link=topic=123799.msg512139#msg512139 date=1169632344] Have a look at using [url=http://uk.php.net/manual/en/function.mysql-fetch-assoc.php]mysql_fetch_assoc[/url] instead of mysql_fetch_array. [/quote] No need, mysql_fetch_array() returns both numeric and associative arrays.  Just change the constant... Change this code: [code=php:0]while ($row = mysql_fetch_array($result)){[/code] To this: [code=php:0]while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){[/code] Regards Huggie
  24. This is a bit scrappy, as I've cobbled it together in about 10 mins, but it should give you an idea as to what's going on. [code]<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="GET"> <input type="text" name="country"> Country<br> <input type="submit" name="search" value="Search"><br /><br /> <?php include_once('*****'); // If page number is set then use it, if not, set one! $page = !isset($_GET['page']) ? '1' : $_GET['page']; // Define the number of results per page $max_results = 5; // Figure out the limit for the query based on the current page number. $from = (($page * $max_results) - $max_results); // Specify the default SQL query $sql = "SELECT countries_name FROM countries WHERE 1=1"; // Amend the serach parameters if there are any if (isset($_GET['country'])){   $sql .= " AND countries_name LIKE '{$_GET['country']}%'"; } // Run the query to get the total number of results. $result = mysql_query($sql) or die(mysql_error()); $total_results = mysql_num_rows($result); // Amend the limit and order by parameters and re-query $sql .= " ORDER BY countries_name LIMIT $from, $max_results"; // Re-run the query with additional constraints $result = mysql_query($sql) or die(mysql_error()); if ($total_results < 1){   echo "Sorry, your search produced no results"; } else {   echo "Your search produced $total_results results<br><br>\n"; while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){   echo "{$row['countries_name']}<br>\n"; } // Figure out the total number of pages. Always round up using ceil() $total_pages = ceil($total_results / $max_results); // Construct the base link... $href = $_SERVER['PHP_SELF']."?"; foreach ($_GET as $k => $v){   if ($k != "page"){       $href .= "$k=$v&";   } } //Previous and next links $plink = "&lt;&lt; Previous"; $nlink = "Next &gt;&gt;"; echo "<center>"; // Build Previous Link if($page > 1){   $prev = ($page - 1);   echo "<a href=\"{$href}page={$prev}\">{$plink}</a> "; } for($i = 1; $i <= $total_pages; $i++){   if(($page) == $i){       echo "$i ";   }   else {       echo "<a href=\"{$href}page={$i}\">{$i}</a> ";   } } // Build Next Link if($page < $total_pages){   $next = ($page + 1);   echo "<a href=\"{$href}page={$next}\">{$nlink}</a> "; } echo "</center>"; } ?>[/code] You can see the code in action here... http://dizzie.co.uk/php/daviboy.php try it with no search data, an empty field, a full coutry, e.g sweden, and just the first letter e.g. S Regards Huggie
  25. Sorry, haven't had a chance to post it yet, really busy at work, but I'll try to get on it now. Regards Huggie
×
×
  • 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.