Jump to content

jcbones

Staff Alumni
  • Posts

    2,653
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by jcbones

  1. Using the OP table: $sql = "SELECT rank FROM rank WHERE post<='$user_post' ORDER BY post DESC LIMIT 1"; $query_rank=mysql_query($sql) or die ("Error");
  2. You should be checking mysql_num_rows(), as even an unsuccessful (returned 0 rows) query will return a result resource.
  3. According to the manual, you may use the SET clause in an INSERT query. Although, this query would always fail, as the comma before the 'year' column is omitted.
  4. You should be coding with error_reporting and display errors set to full, and all possible de-bugging in place. For queries, you should have. <?php error_reporting(-1); ini_set('display_errors',1); $default_query="SELECT * from user where userid='$userid'"; $user_query=mysql_query($default_query) or trigger_error($default_query . ' has an error<br />' . mysql_error());
  5. If you read the manual it will tell you that preg_replace will accept an array of strings as a pattern, and an array of strings as replacement.
  6. Good programmers always cover all of the bases (pun intended) whether they have a specific base of user they expect or not.
  7. Yep, Top of script, right after <?php tag. error_reporting(-1); ini_set('display_errors',1);
  8. A class that is a few years old, but handles this kind of stuff with ease (especially to the user), is called SimpleImage. I have used it in the past, and have recommended it before. I think it might could help you do what you are trying to do.
  9. That must be one HUGE multi-dem array. Also, you should be using empty() for this, as a variable could be set, but not have any value.
  10. $password = (!empty($_POST['pass'])) ? trim($_POST["pass"] : NULL; //<- trim() is missing the closing parenthesis.
  11. @ is bad coding practice in my opinion. Do it right, and save yourself some trouble in the long run. @$username = trim($_POST["user"]); @$password = trim($_POST["pass"]); @$login = trim($_GET["login"]); Should be: $username = (!emtpy($_POST['user'])) ? trim($_POST["user"]) : NULL; $password = (!empty($_POST['pass'])) ? trim($_POST["pass"] : NULL; $login = (isset($_GET['login'])) ? trim($_GET["login"]) : NULL;
  12. On the first page load, $_GET['page'] is probably NOT defined, proper de-bugging would reveal that. You should be setting NEXT to a default value, before setting the URL. $page = (isset($_GET['page']) && $_GET['page'] >= 10) ? $_GET['page'] : 10;
  13. The code I provided could be retrofitted to help you reduce the handcoding needed. Just change all references to $categories to $infl.
  14. Sure: <?php $array['query']['row']['0']['title'] = 'Bob'; $array['query']['row']['1']['title'] = 'Andy'; $array['query']['row']['2']['title'] = 'Tom'; foreach($array['query']['row'] as $k=>$v) { $sort[] = $k['title']; } array_multisort($sort,SORT_ASC,$array['query']['row']); echo '<pre>' . print_r($array,true) . '</pre>'; ?>
  15. Your image and your pasted code doesn't match. Which is true, which isn't. The pasted code will fail to parse. public static function exec( $sql, $values=array() ) { return self::secureExec(function($sql, $values')' { <-HERE, remove the quotes from around the closing argument parenthesis. return R::$adapter->exec( $sql, $values ); }, NULL, $sql, $values); }
  16. Is your category names held in the database? It would make it much easier for you to code, because you could reduce a lot of the hand coding. <?php include "array2.php"; $break_ad_selection = array(1=>'Public Ads',7=>'Event Sponsorship',12=>'Online Ads'); //<-lines where you want your new columns. $categories = array(1=>'Bill Boards',2=>'Transportation',3=>'Shopping Centers',4=>'Posters / Signs',5=>'Bus Stops',6=>'Other-Public', //<-From database. 7=>'Concerts',8=>'Fairs',9=>'Trade Shows',10=>'Sports',11=>'Other-Event',12=>'Banner Space',13=>'Social Media', 14=>'Email Lists',15=>'Blog Articles',16=>'Ezine Articles',17=>'Other-Online'); $sql = "SELECT category, COUNT(category) AS cnt FROM postlisting GROUP BY category"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { while ($row = mysql_fetch_assoc($result)) { $c = $row['category'] ; $t = $row['cnt']; if(array_key_exists($c,$break_ad_selection)) { // if we want a new column in the current line: echo ($c > 1) ? '</td>' : NULL; //if number is greater than 1, we need to end the previous column. echo '<td><h4>' . $break_ad_selection[$c] . '</h4><br />'; //print out column title. } if(array_key_exists($c,$categories)) { //if there is a name for the category. echo '<a href="browse1.php?cat=' . $c . '">' . $categories[$c] . "<a/>($t)<br />\n"; //print it. } } echo '</td></tr>'; //end our column, and our row. } }
  17. I'm lost? Why do you have to cURL your own server? This data should be available in a host of other ways, that would be faster and easier to maintain.
  18. You "return" it in the while loops!
  19. Your problem explained better than I could!!!
  20. So are you wanting to screen scrape the info, or parse the info from Excel format? Screen Scrape XLS to PHP
  21. Well, it could be something in the code that is the problem. You don't have to post it, but you won't get any help. I would bet overwriting is the problem.
  22. There are two ways to attacking a problem of "is it faster to do...". 1. You can believe someone when they tell you it is, and believe it is. 2. You can test it for yourself, and know it is. If it were me, I would just call the function, as it is bound to be faster to call a function, vs. calling a function that calls a function.
  23. There is most likely a simple solution as to why your script isn't working. Post it up, and we could help out, as there is no reason a script has to reside in the root directory to work. GoDaddy is horrible (IMHO), but even they wouldn't do that.
  24. To better clarify, MySQL is smart, and it will only update columns that CHANGE.
  25. And $i-- or --$i de-increments a variable by the number specified.
×
×
  • 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.