Jump to content

Ballam

New Members
  • Posts

    6
  • Joined

  • Last visited

Everything posted by Ballam

  1. Thank you, I did consider this but wasn't sure whether it was the best course of action. Implemented now and the error has gone. Thanks again
  2. Maybe the intval function will assist? it converts variables such as strings into integers. http://php.net/manual/en/function.intval.php Or if you are needing decimals then floatval() http://php.net/manual/en/function.floatval.php
  3. Sorry, I was completely wrong before. I've just noticed what is actually wrong with the code.... you appear to have a slight typo on your column name, you have wrote serviecid, rather than serviceid
  4. Good evening all! I have been working on a project for some time, and as it is now getting quite large I am now trying to extract the textual parts into an object called Lang so that it's easier to read the code, and edit the text. This works for more simple text sections, however the issue I am having is in text where I want to pull the users name from another object, i'm not sure how to do this without actually passing the user object to the lang object, however I don't want to do this as I don't feel it is correct? Below is an extract example to show how I am trying to implement this: /**** In the lang.php file ****/ class Lang { private static $lang = array(); function __construct() { $lang['WELCOME'] = "Hello " . $user->getRealname() . "<br /> <br />Welcome to the Control Panel.<br /><br /> Please pick an option from the menu on the left.<br /><br /> <a href='?action=logout'>Please click here to Logout</a>"; } public function getText($id) { return $this->lang[$id]; } /**** In the actual site code ****/ require('classes/user.php'); $user = new User($db); require('classes/lang.php'); $lang = new Lang(); $content = $lang->getText('WELCOME'); Obviously the above code is shortened to just show the key parts. The code is encountering a fatal error due to the $user->getRealName() method call, and i'm not sure of the easiest way to resolve this. Please could somebody provide their thoughts and advice? Error: Fatal error: Call to a member function getRealname() on a non-object in /public_html/dev/classes/lang.php on line 6 Thank you for reading! B
  5. Also, if the above post is correct, you will need to do it for all the other MYSQL statements too.
  6. I'm not sure if it is just the way I do it, but I thought the PHP variable/array should be outside of the quotes like below: $result= mysql_query("select * from service where serviecid='" . $_POST[serviceid] . "'");
×
×
  • 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.