Jump to content

peter_anderson

Members
  • Posts

    150
  • Joined

  • Last visited

    Never

Everything posted by peter_anderson

  1. I'd like to request testing of my forum script. http://www.calicosoft.com/community (Validation: http://www.calicosoft.com/phpfreaks.txt) Thanks in advance.
  2. Here's a decent auto suggest tutorial: http://woork.blogspot.com/2008/03/php-components-autosuggest.html
  3. I have a database called "mp_users" with the following setup: CREATE TABLE IF NOT EXISTS `mp_users` ( `id` int(10) unsigned default NULL auto_increment, `uid` int(10) unsigned NOT NULL, `username` varchar(100) NOT NULL, `email` varchar(50) NOT NULL, `points` int(10) unsigned NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; When I try to run the following query, I get an error: Error: Fatal error: Call to a member function query() on a non-object in /home/user/public_html/marketplace-functions.php on line 52 Here is the code: <?php require_once "config.php"; $sql = new mysqli($db1['host'], $db1['user'], $db1['pass'], $db1['db']); function checkUserExists($uid){ // Query $q = "SELECT COUNT(id) AS user_exists FROM `mp_users` WHERE uid=$uid LIMIT 1;"; echo $q; $q = $sql->query($q); $r = $q->fetch_assoc(); // Any results? if($r['user_exists'] == 0){ // redirect to runonce... header('Location: marketplace.php?do=runonce&return='.urlencode($_SERVER['QUERY_STRING'])); exit(); } } ?> Line 52 is the $q query. I really cannot see what the problem is. The database exists, I've tried it in phpMyAdmin and it runs without trouble, but this wont! Can anyone help? Thanks in advance
×
×
  • 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.