Jump to content


  • Posts

  • Joined

  • Last visited


About Gaia

  • Birthday 03/26/1987

Contact Methods

  • AIM
  • MSN
  • Website URL
  • Yahoo

Profile Information

  • Gender
  • Location

Gaia's Achievements


Member (2/5)



  1. I'm a noob. I searched everywhere but the PHP docs . Thanks for the link, worked like a charm.
  2. Nice to see surpasshosting.com on the list. They are an amazing company.
  3. For Windows I use SmartFTP, great program. For my Mac I use Cyberduck. Has been working so far without any difficulties.
  4. Hi, I'm trying to extract data from an Atom feed using PHP. I can get the title and published/updated date, but am having a hard time figuring out the path to the link="href" section of the Atom feed. I have $xml->entry->link, but when I try to go any further it results in an empty result. How do I finish the query to extract the link data? Here is a print_r of $xml->entry->link SimpleXMLElement Object ( [@attributes] => Array ( [href] => /p/doulx ) ) I've never tried to extract data from an Atom feed before and am finding it difficult. Any tips would be great. thanks.
  5. I think the issues I am having are due to the following code: $sql = "SELECT COUNT(*) FROM entries WHERE nickname LIKE '%$nickname%' OR ip LIKE '$partial_ip%' AND deleted = 0"; if ($res = $db->query($sql)) { if ($res->fetchColumn() > 0) { $is_dup = 1; } else { $is_dup = 0; } } When I attempt to re-build it using the example from PHP.NET docs, I get an error: $sql = "SELECT COUNT(*) FROM entries WHERE nickname LIKE '%$nickname%' OR ip LIKE '$partial_ip%' AND deleted = 0"; if ($res = $db->query($sql)) { // Check the number of rows that match the SELECT statement if ($res->fetchSingle() > 0) { echo 'Entries found'; } // No rows matched -- do something else else { print "No rows matched the query."; } } Error: Fatal error: Call to undefined method PDOStatement::fetchSingle() in /home/gaia/public_html/xx/classes/class.manage.php on line 55 I am taking this directly from the PHP docs, so why would it not work?
  6. Hmm, still getting the same error message. I really don't know why this is being so problematic.
  7. Couldn't locate the edit button: However, I think it is saying this query was not complete, or closed? $sql = "SELECT COUNT(*) FROM entries WHERE nickname LIKE '%$nickname%' OR ip LIKE '$partial_ip%' AND deleted = 0"; if ($res = $db->query($sql)) { if ($res->fetchColumn() > 0) { $is_dup = 1; } else { $is_dup = 0; } }
  8. Hmm, I am getting this error from PDO. As far as i know,no other queries are active... I have a common.php that initiates the class, and at the end i include footer.php that nulls out $db ( $db=NULL; ).
  9. But doesn't that defeat the purpose of assigning it to $query? Wouldn't I just do the following and it be the same then? $db->prepare("INSERT INTO entries VALUES ('0','$admin', '$admin_ip', '$nickname', '$nick_ip', '$date', '$reason', '$action','','','0','','','','$is_dup')"); $db->execute();
  10. I think I corrected the problem. The $config array is in a file called class.config.php. The config vars are in another file called config.php. Hopefully you guys can help me with another issue now, with the same script. I have a form where you can add things to a database, which uses a class called manage::add which is located in class.manage.php. manage::add also uses a var named $db which initiates a PDO connection. $db is declared in a file called common.php. common.php: // // Initiate the database connection // $db = new PDO('mysql:host=localhost;dbname=xx', 'xx', 'xx'); // // Get the class that contains the config info // require_once("classes/class.config.php"); $config = new config(); // // Get the class that controls entries // require_once("classes/class.entries.php"); $entries = new entries(); // // Class the manages deleting, editing, etc // require_once("classes/class.manage.php"); $manage = new manage(); // // Get the session class & start it // require_once("classes/class.session.php"); $session = new session; $session->start(); // // Set default timezone ( PHP 5+ only ) // date_default_timezone_set('GMT'); class.manage.php: class manage extends entries { public $edit_form; // // Add an entry // public function add($post_info=array()) { global $db; // // Make sure there are no blank fields // if ( in_array("",$post_info) ) { echo '<div class="entry">You left a field blank!</div>'; } else { $admin = $post_info['admin']; $admin_ip = $post_info['admin_ip']; $nickname = $post_info['name']; $nick_ip = $post_info['ip']; $date = $post_info['date']; $reason = $post_info['reason']; $action = $post_info['action']; $partial_ip = manage::break_ip($nick_ip); $partial_ip = $partial_ip[0].'.'.$partial_ip[1]; $sql = "SELECT COUNT(*) FROM entries WHERE nickname LIKE '%$nickname%' OR ip LIKE '$partial_ip%' AND deleted = 0"; if ($res = $db->query($sql)) { if ($res->fetchColumn() > 0) { $is_dup = 1; } else { $is_dup = 0; } } $query = $db->prepare("INSERT INTO entries VALUES ('0','$admin', '$admin_ip', '$nickname', '$nick_ip', '$date', '$reason', '$action','','','0','','','','$is_dup')"); $query->execute(); //Send to home page $host = $_SERVER['HTTP_HOST']; $uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\'); $extra = 'index.php'; header("Location: http://$host$uri/$extra"); exit(); } } ....... some more below, but only concerns the above method When I attempt to submit the form, I get the following error saying that $db is non-object: I figured setting it as a global $db would allow the use of $db in another file?
  11. The path seems to exist, when I do the following, it works: class config { private $config_path; // // Get a configuration value from the config file // public function get_config($config_name) { require( '/home/gaia/public_html/ae/includes/config.php'); $value = $config[$config_name]; return $value; } } I tried the previous code on another server, and got the following error: So, it looks like the var isn't being passed into the module for some reason.
  12. I am still learning OOP, so I am bound to make noobish mistakes. See below: class config { private $config_path = '/home/gaia/public_html/xx/includes/config.php'; // // Get a configuration value from the config file // public function get_config($config_name) { require($this->config_path); $value = $config[$config_name]; return $value; } } I think the private $config_path may be wrong or I need to declare it differently?
  13. Yes, however, I was hoping there might be some general suggestions/thoughts of the issue. It is a couple pages of code, so I wasn't sure that posting it all here would be efficient. I will go through it and try to copy/paste the main area's that I think are causing the issues. I am at work so I don't have the code handy. I will update once I have the exact code. Until then, is it possible to initiate a class, within a class? For example, if i have class.one.php and class.two.php. Can I run an 'include' function to include class.one.php in class.two.php and initiate it without problems? I am currently doing that right now, and it works in my environment, but not the other. Was another reason I was curious if there were any PHP updates that perhaps restricted that kind of coding for some reason. I'm not the best at explaining things . Hopefully my code will be of more help.
  14. Hi, Not really sure how to direct this certain issue I am having. I built a PHP script that uses OOP on a PHP 5.2.3 environment. It is working fine in that environment. However, once I copied it over a PHP 5.2.5 enviromnet, it doesn't seem to like it. It comes up in IE as Programming Error or Unavailable Page. Does not show any error messages at all either, I even tried setting the error reporting to E_ALL and still no luck. Just hoping for some suggestions on how to pin-point the exact issue. I have been commenting out small pieces of code but it just does not seem to be parsing the classes correctly. Are their any major updates from 5.2.3 to 5.2.5 that may cause issues? Like restrictions on how classes can be used? Thanks in advanced for any info or suggestions anyone has.
  • 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.