Jump to content


  • Posts

  • Joined

  • Last visited


Everything posted by Oldiesmann

  1. If you want to enclose variables in single quotes, then you either need to use double quotes for the query string or escape the single quotes. Also, <head> cannot come after <body>. Try this: [code]<html> <head> <link href="resultcss.css" rel="stylesheet" type="text/css" /> </head> <body> <?php include('config/file.php'); if($_POST['platform'] == ''){   $platform = $_GET['platform']; $developer = $_GET['developer']; $publisher = $_GET['publisher']; $fletter = $_GET['fletter']; $sortby = $_GET['sort']; $perpage = $_GET['perpage']; $order = $_GET['order']; }else{ $platform = $_POST['platform']; $developer = $_POST['developer']; $publisher = $_POST['publisher']; $fletter = $_POST['fletter']; $sortby = $_POST['sort']; $perpage = $_POST['perpage']; $order = $_POST['order']; } if (!$link = mysql_connect($sqlserver, $sqlusername, $sqlpassword)) {   echo 'Could not connect to mysql';   exit; } if (!mysql_select_db($sqldatabase, $link)) {   echo 'Could not select database';   exit; } ////////////////////////////////////////////////////////// if($fletter == '%'){ $resource1 = mysql_query("SELECT * FROM nuke_seccont WHERE secid LIKE '$platform' AND developer LIKE '$developer' AND publisher LIKE '$publisher' ORDER BY " . $sortby . " " . $order) or die(mysql_error()); }ELSE{ $resource1 = mysql_query("SELECT * FROM nuke_seccont WHERE secid LIKE '$platform' AND developer LIKE '$developer' AND publisher LIKE '$publisher' AND fletter='$fletter' ORDER BY " . $sortby . " " . $order) or die(mysql_error()); } $total_results = mysql_result($resource1, 0, 0); $total_pages = ceil($total_results / $perpage); $current_page = (isset($_GET['page'])) ? $_GET['page'] : 1; $current_offset = ($current_page - 1) * $per_page; echo "total pages: $total_pages<br>current page: $current_page<br>current offset: $current_offset"; } ?> </body> </html>[/code] The rest of the code that you have after that should be fine.
  2. If you use [tt]global $user, $pass;[/tt] at the beginning of display_vars() now (after including config.php), it should work.
  3. Can you post the exact code for the query? It looks like MATCH() and AGAINST() aren't being passed the appropriate parameters. See one of the following pages in the MySQL manual for more info (depending on which version of MySQL you're using): 4.1 and lower: http://dev.mysql.com/doc/refman/4.1/en/fulltext-search.html 5.0: http://dev.mysql.com/doc/refman/5.0/en/fulltext-search.html 5.1: http://dev.mysql.com/doc/refman/5.1/en/fulltext-search.html
  4. All email sent by the board is sent "from" the webmaster address. Go to Admin -> Server Settings to change this. There's also an option to enable PM reporting - Admin -> Features and Options - it's near the bottom of the page.
  5. Depending on what I'm doing and how much of a hurry I'm in, I use Wordpad, EditPlus or PHP Designer 2006. PHP Designer is the best free editor out there in my opinion, at least for Windows...
  6. http://www.phpfreaks.com/forums/index.php/topic,99076.0.html http://www.phpfreaks.com/forums/index.php/topic,100124.0.html
  7. Try this instead: [code]require_once("/home/ipetresc/public_html/arts/config.php"); include($CONFIG['script_path'] . '/news.php'); require_once($CONFIG['script_path'] . '/functions/functions.php'); require_once($CONFIG['script_path'] . '/functions/mysql.php'); require_once($CONFIG['script_path'] . '/functions/template.php');[/code] $CONFIG['script_path'] won't be defined until after you include the config file, and since it's the path to the FNews directory (I think), you don't need to append it to the full server path.
  8. You do have to download the smarty library, but you can put the smarty files in whatever directory you want, and you shouldn't have to modify your PHP config file as long as you tell your script where to find the smarty files (or smarty.class.php is in the same directory as the script). You can also use ini_set() to change the include_path if you want.
  9. That's part of the Smarty Template Engine. Check out http://smarty.php.net for more info.
  10. http://www.phpit.net/article/ten-different-php-frameworks/ should help you decide, although I'd recommend taking the time to learn the actual PHP code instead of relying on frameworks to do all the code for you.
  11. [code]$sql = "SELECT u.*, p.* FROM users AS u, people AS p"; if($_GET['name'] != "") { $sql .= "WHERE u.show = '1' OR p.show = '1'"; } $sql .= " LIMIT $from, $mr";[/code] When looking at the results, remember that columns from users will be prefixed with a "u." and columns from people will be prefixed with a "p.".
  12. You want \"add()\" or 'add()', not /"add()/".
  13. I understand what you want to do, but don't understand why you need a PHP script to do that. It doesn't take that long to look up an IP address on that site.
  14. "HTTP request failed" most likely means it couldn't load the website. Besides - file_get_contents loads the contents into a string, not an array, so print_r wouldn't work (either use echo or print). What problem are you trying to solve here? It doesn't take that long to look that info up.
  15. [quote author=Barand link=topic=100564.msg397043#msg397043 date=1152890441] [quote author=Oldiesmann link=topic=100564.msg397037#msg397037 date=1152890124] Almost there :) [code]<?php $Course = array('blah1', 'blah2', 'blah3'); $Coursearray = implode("','", $Course);      // <-- inner quotes     $SqlQueryA = "SELECT Course_Name                   FROM tblMeeting                   WHERE Course_Name IN ($Coursearray)"; // <-- No quotes needed here... ?> [/code] Since the query statement is already in double quotes, you don't need single quotes around $Coursearray. [/quote] If you you remove those quotes the query becomes ....WHERE Course_Name IN ( blah1','blah2','blah3) "; which is now clearly wrong [/quote] For some reason I was thinking that implode("', '") would put the ' at the beginning and end as well... Not trying to cause any problems :)
  16. That's definitly more complicated than it needs to be in my opinion. Using a switch statement should simplify things tremendously: [code]<?php /* sample.php */ require_once('functions.php'); $valid = TRUE; if(isset($_POST['submit'])) {     foreach(array_keys($_POST) AS $key)     {         switch ($key) {             case "id":                 $valid &= LettersAndDigits($_POST['id']);                 break;             case "item_title": case "item_type": case "city": case "state": case "country": case "item_description": case "hit_counter":                 $valid &= Variable($_POST[$key]);                 break;             case "quantity_available": case "duration": case "end_time":                 $valid &= isDigits($_POST[$key]);                 break;             case "starting_bid":                 $valid &= Dollars($_POST['starting_bid']);                 break;             case "bid_increment":                 $valid &= BidIncrement($_POST['bid_increment']);                 break;             case "reserve_price":                 $valid &= ReservePrice($_POST['reserve_price']);                 break;             case "auto_relist":                 $valid &= isLetters($_POST['auto_relist']);                 break;             case "paypal_id":                 $valid &= EmailorEmpty($_POST['paypal_id']);                 break;             case "submit":                 break;         }     }     if($valid)     {         header("Location: uploadformconfirmation.html");         exit;     } } ?>[/code] Still probably not the best way of doing things, but it's a lot simpler (note the minor change to header - you have to tell PHP that this is a location header or it won't work).
  17. Almost there :) [code]<?php $Course = array('blah1', 'blah2', 'blah3'); $Coursearray = implode("','", $Course);      // <-- inner quotes     $SqlQueryA = "SELECT Course_Name                   FROM tblMeeting                   WHERE Course_Name IN ($Coursearray)"; // <-- No quotes needed here... ?> [/code] Since the query statement is already in double quotes, you don't need single quotes around $Coursearray.
  18. Here's a slightly simpler version: [code]<?php // Connect to the database server... $connect = mysql_connect('localhost', 'username', 'password') or die("Could not connect to server!"); // Tell MySQL which database we're working with $db = mysql_select_db('database', $connect) or die("Couldn't select database!"); // Execute the query $query = mysql_query(" SELECT COUNT(member.Name) AS counter, account.Name FROM member INNER JOIN account act ON act.Name = member.Name GROUP BY member.Name ") or die("Error executing query! MySQL said: " . mysql_error()); // Display the result echo 'Result: ' . mysql_result($query, 0); ?>[/code]
  19. That's what I get for not reading the entire topic before responding...
  20. I use PHP Designer 2006. I stumbled across this software through php-editors.com, and haven't looked back. PHP Designer 2005 was nice, but 2006 has some improvements. My favorite part is that it actually uses proper syntax highlighting colors, which many free editors don't seem to support for some reason.
  21. [quote author=ober link=topic=99076.msg395384#msg395384 date=1152647294] I wonder if anyone from the SMF team is reading this...... [/quote] I am... There are a couple of different mods that will do what akitchin has requested: http://mods.simplemachines.org/index.php?mod=192 - Karma description mod. This one allows the user to add a reason for each karma action, which is then displayed to the recipient of that action http://mods.simplemachines.org/index.php?mod=192 - Karma Log. This one logs all the karma actions. Currently doesn't work with this version of SMF, but I can always update it for you if you're interested in it. There's also the "Karma Wait Time" option. This lets you specify how many minutes a user must wait between consecutive karma actions. This will prevent people from sitting there smiting and/or applauding the same user over and over again.
  22. [quote author=moberemk link=topic=99052.msg391975#msg391975 date=1152112676] Aah. Okay, that explains that. Thanks for clearing that up for me. Now the only thing I don't get is why every time I post, it brings me back to the parent forum. Couldn't that maybe become some sort of option for those of us whom it merely annoys? It's a useful feature for some, but because I always browse the forum in tabs, I just don't need it around, and I'm used to being able to look over my post and make sure that I said what I meant. [/quote] Profile -> Look and Layout Preferences Check the box next to "Return to topics after posting by default" There's also a quick reply box available (in the same section - set "Use quick reply on topic display" to "Show, on by default")
  • 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.