Jump to content

gristoi

Members
  • Posts

    840
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by gristoi

  1. From briefly looking at what you are asking I think you should read up on design patterns, and in your case I think MVC ( Model, View, Controller) would best suit your needs. Using this approach allows you to logically separate the business logic (models) from the HTML ( view) by using a controller to request the data from the model and pass it to the view.
  2. Are you responsible for the world cities database? Or is it a remote resource ? If its yours then you need to ensure that the fields you are querying your autocomplete against are correctly indexed and that your search is specific
  3. When joining tables you will come across. Instances where a field in both tables have the same name. Because of this you cannot select just id, this would be an ambiguous field join. Instead you need to declare which table you wish to pull the Id from: SELECT notesnew.ID , content, owner, dp_time, profileimg FROM notesnew JOIN users on notesnew.owner = users.username A not to remember is that when you echo out the row it will just be ID and not notesnew.ID. If you wanted to pull the Id from both tables then you would be beat using an alias for each one: SELECT notesnew.ID AS 'notesId' , users.ID AS 'usersId'
  4. Ok, read up on the article posted by harries tweed, learning about table joins will help you a lot in the furture, a good rule of thumb that I personally use is that mysql queries should not go inside loops, joins should be used wherever possible. Looking at your table: SELECT content, owner, dp_time, profileimg FROM notesnew JOIN users on notesnew.owner = users.username Should do the trick
  5. Hi, what you will be best doing is writing one singe query use a table JOIN. Example: SELECT content, owner, do_time, profileimg FROM notesnew JOIN users on notesnew.owner = users.ownerid Without seeing your table structures I can't accurately guess the correct query, but hopefully this should point you in the right direction
  6. SELECT * FROM con WHERE category = '$select_category' ORDER BY category, date ASC
  7. you need to use the Jquery each() function http://api.jquery.com/jQuery.each/ this will seperate each of the unique instances of the same class into their own objects
  8. You need to use AND or OR in your statement. Example: SELECT a, b WHERE a !='b' AND b!= something
  9. You query is looking for records where the usename and password match the ones passed into it, so if you only have one record where the username and password match you will only return 1 row. Why were you expecting 3 rows to be returned?
  10. So, do you have three rows in your table with identical username and password ?
  11. Do you have a mail server installed on your localhost? If not your emails going nowhere .
  12. Your trying to insert the user_id into the id field $sql_insert = "INSERT into `jobs` (`id`,`job_title`,`description`,`type`,`date`,`remuneration`,`terms`,`start_date`) Needs to be $sql_insert = "INSERT into `jobs` (`user_id`,`job_title`,`description`,`type`,`date`,`remuneration`,`terms`,`start_date`) You do not need to insert the id field as it auto increments
  13. try changing var refreshId = setTimeout(refreshDiv2, 800); to var refreshId = setTimeout("refreshDiv2()", 800);
  14. Looks fine, it was only to give you a starting point and hopefully point you in the right direction.
  15. Hi, sorry i misread your problem, was not firing on all cylinders (too early) lol. You might want to try using a nested select query. But be aware that if you are using a nested query the nested select can only return 1 row. Have a look at the query below and see if this puts you on the right tracks SELECT pr.note, pr.updated_on, pr.created_on, CONCAT( u.firstname,' ', u.lastname) AS UpdatedBy, (SELECT CONCAT( u.firstname,' ', u.lastname) FROM prop_notes pr JOIN users u ON pr.created_by = u.user_id ) As createdBy FROM prop_notes pr JOIN users u ON pr.created_by = u.user_id WHERE pr.client_id = '".$_SESSION['client_id']."' AND pr.note_id = '".$page_note_id."' AND pr.deleteStatus = '0'
  16. You don't need to use a left join, your are trying to return data from both tables so remove the LEFT. Also, you could concatenate the usernames to make the query a bit easier to read: CONCAT(u.firstname,' ', u.lastname) As UserName
  17. try sending it through port 587 insted of port 25. Port 587 is only normally used for subbmission via authenticated users. but might be worth a try.
  18. You should never really put anything besides the index page and javascript, css etc into the public folder. you are in effect making the script accesible to the public domain. One of the main fundamentals of using a framework like Zend is that you application code is kept securely out of the public reach and all required code is passed to the view(index) through the controller. For the type of classes you are referring to (Authentication , access controll etc) you should think about moving the class into your default library folder. The library folder path is already included in the default zend framework structure. So below is an example of creating a plugins folder to house it. application/ docs/ library/ Plugins/ Auth/ MenuAcl.php so all you would need to add in your bootstrap would be: $resourceLoader = new Zend_Loader_Autoloader_Resource(array('basePath' => APPLICATION_PATH, 'namespace' => '')); $resourceLoader->addResourceType('plugins', 'library/plugins/','Plugins_'); and chage your class name to class Plugins_Auth_Acl extends Zend_Acl { // code here }
  19. this line tells the autoloader where the starting directory is situated , in this case the APPLICATION_PATH . so for this it starts at the application folder: application/ models/ MenuAcl.php for this example the autoloader would keep parsing through the model folders sub directories looking for any classes beginning with the Model_ namespace. So if you were to move this model into another folder i.e: application/ models/ Auth/ MenuAcl.php then you would have to amend the classes namespace to match : class Model_Auth_MenuAcl extends Zend_Acl { } have a look at the zend documentation : http://framework.zend.com/manual/en/zend.loader.autoloader.html
  20. Your are extending your class off Zend_Acl so instead of this->_acl->addRole($onerole); try this->addRole($onerole); you might want to google php class inheritence
  21. Apologies, I missed a part of code out . Let me run you through an example of one of my autoloaders. Basically the Zend_Loader_Autoloader_Resource() allows you to add and manage namespaces with the with the zend autoloader. Please see the correct example below: $resourceLoader = new Zend_Loader_Autoloader_Resource(array('basePath' => APPLICATION_PATH, 'namespace' => '')); $resourceLoader->addResourceType('form', 'forms/','Form_'); $resourceLoader->addResourceType('plugins', 'library/plugins/','Plugins_'); $resourceLoader->addResourceType('model','models/', 'Model_'); Firstly you need to set the base path for the loader, in this case it is set to the application path, the addresourceType then takes in the arguments $typeOfresource,$filePath,$namespace . So for the model you are instructing the loader to look for classes within the models/ folder with the namespace prefix of Model_. I hope this helps.
  22. in your bootstrap try adding this: protected function _initAutoload () { $resourceLoader = new Zend_Loader_Autoloader_Resource(); $resourceLoader->addResourceType('model', 'models/', 'Model_'); }
  23. have you declared the "Model_" namespace in your bootstrap
  24. You need to use the rand() function. Rand($minrange, $maxrange); // so for example Rand (0,10); // will generate a random number between 0 and 10
  25. Hi, if you are only using mktime() to generate a timestamp for today then you might want to change: $date = mktime(0,0,0,date("m"),date("d"),date("Y")); With: $date = time(); One of the benefits of this is that the mktime you were using would give u a timestamp for midnight today. time() wil log the exact time the user registered. Another option is to ensure your register_date datatype in the database is a DATETIME and just use $query = mysql_query("INSERT INTO members (member_id, username, firstname, lastname, password, register_date, ip) VALUES (0, '$_POST[username]','$_POST[firstname]','$_POST[lastname]','$_POST[password]',NOW(),'$ip')")
×
×
  • 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.