Jump to content
Larry Ullman's Book Forums


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by Edward

  1. Yes you are quite right two heads usually are better than one. If i have the time i will offer my help when possible.
  2. Yes, the whole of Asia would be great especially China huge market there. I thought you were in Ohio now or am I wrong?
  3. You can do both ASC and DESC according to the mysql manual. http://dev.mysql.com/doc/refman/5.5/en/create-index.html Ah well may be not An index_col_name specification can end with ASC or DESC. These keywords are permitted for future extensions for specifying ascending or descending index value storage. Currently, they are parsed but ignored; index values are always stored in ascending order.
  4. Thanks for sharing your solution, these threads are certainly useful for others that will possibly run into the same situation.
  5. I'm sorry i am confused with what is going on here, it only works in my model if the relationship is BELONGS_TO. Its hard to look at your tables because even with the relationships you have given i don't understand fully what the data is you need to manipulate. The structure of the tables and the data they contain is also important to getting things correct. Well good luck this!
  6. Well if you think about this more carefully you can't display the 5 or 10 in your current CGridView results as this is HAS_MANY data and not BELONGS_TO in which you could bring up the relational data for. So the point being you can only display the data in a particular column for data that BELONGS_TO if you wish to get data for HAS_MANY you will need to loop through the array of objects with a foreach loop that is after checking that the returned array is not empty (which you can use the array function count() to test this). Therefore the "Trying to get property of non-object" is not coming from the dropdownmenu but the code below. 'value' => '$data->course->ects_points', You are saying that a course could have a 5 and a 10 or am i confused with something here.
  7. I just checked over your model relations i can confirm they are correct. I will try implementing this type of drop down filter into one of my CGridView's and see if i can get it working now. Update: I managed to get the dropdownlist working and now i have it working the same as you did with that same error coming up "Trying to get property of non-object". Okay i will figure this out!
  8. If you are getting the 'property of non-object' error you need to take a look at your model relations make sure they are correct. Is the relationship HAS_ONE or HAS_MANY? If this is a non-object it could be an empty array or an array of objects, just have a look into Ralational Active Record (RAR) in more detail. http://www.yiiframework.com/doc/guide/1.1/en/database.arr If you show your models and relations it is easy to work out what is wrong if you need more help?
  9. What you are trying to validate is tabular data, yii does not provide a way to validate this kind of data and therefore it will require you to write your own validation code to loop through each record of the tabular data you need to validate and save. This thread helped me to fix my tabular data problem and get the validation working. http://www.yiiframework.com/doc/guide/1.1/en/form.table
  10. When i run the method below twice the grid ajax update then works 100% but its takes a bit longer, hmm... I guess this solution works when a website is newly starting up and its slow. $('#my-grid-id').yiiGridView('update');
  11. Lucky for you then, well i really think at some point i am going to have to fully investigate the matter but for now my website runs well enough even though it has a buggy grid. I will definitely post back here when i figure out what it is. Thanks for help. Edward.
  12. Hello Jonathon, i wanted to ask you have you had issues with the CGridView not updating sometimes when you do an Ajax update to say remove an item you have from the Grid? For me it seems to work on and off, the changes in the database were correct indicating code was correct, even my counters updated but the grid sadly did not.
  13. So it was the mysqli_oop_connect.php script, awesome good you got it figured out.
  14. I just used the same script to connect to one of my databases to test it and i didn't get that mysqli object displaying. I really have no idea why that is showing either, it must be a local problem. I see you are using MAMP 2.1.3, i am using MAMP PRO 2.1.4, why don't you try upgrading, i really can't think of anything else.
  15. I think there is some kind of php error, can you try turning on PHP error handling and see if you get another message coming up. ini_set('display_errors',1); error_reporting(E_ALL);
  16. $this->render('index', array( 'graph' => $graph)); This statement is correct for passing standard, variables and objects. Just one thing i want to say though is all that database access code in the controller is a no no anyway you need to be pushing this into some kind of model or a separate file. It looks like some kind of connection was lost with the variable when you pasted it to the views file. I think what you need to do is create a model function and then access this directly from the views file, rather than passing the $graph object from the controller to the views file. Any way this was just a suggestion i haven't used those extensions you are using there so i can't give you the correct answer but something to try, hope it will help in reaching your solution.
  17. Found the book and realize now its not that one but the normal PHP Dynamic websites book, okay i think that message is being printed because in the mysqli_oop_connect.php script contains the code if ($mysqli->connect_error) { echo $mysqli->connect_error; unset($mysqli); cont.... You could just comment out that line to test the difference if ($mysqli->connect_error) { // echo $mysqli->connect_error; unset($mysqli); cont.... Its says connect_error will return a null value of there was no error message. So it may not be this, i did check online and did not find any information on this problem, so i don't know myself if its not this, i never saw this come up on my scripts before. I checked phpinfo() also and did not see any thing related.
  18. I lost my Larry's PHP Object Orientated book in my house some where i will go to look for it now. I need to see what that script does mysqli_oop_connect.php.
  19. The NAME is printed out by $row->name and the DATE REGISTERED is printed out by $row->dr. http://php.net/manual/en/mysqli.query.php 1. $r = $mysqli->query($q); returns a mysql object to $r. 2. $num = $r->num_rows; the num_rows property in the mysql object $r returns the number of rows 3. while ($row = $r->fetch_object()) We then use the while loop to loop through each row of data obtaining $row->name and $row->dr (Name and Date Registered).
  20. Well you are looping through the object you have their and printing out each row of results, that's why... // Fetch and print all the records while ($row = $r->fetch_object()) { echo '<tr><td align="left">' . $row->name . '</td><td align="left">' . $row->dr . '</td></tr> '; }
  21. Yes the 'on' function is very useful indeed it can bind the events you have to newly formed elements of the page. If you don't use that you will have to add the event handlers again to each of the elements you added events to at your initial page setup.
  22. For me i thought the combination of the Larry Ullman books did the job even though all of the editions weren't published in one book.
  23. I have bitten a little more than i can chew today, run into some major database query frustration, and also found a Yii bug relating to SQL IN and the addInCondition() which was not fixed. But the bug can be fixed by placing addInCondition() after params in the CdbCriteria array. I will get this sorted out tomorrow its time to have a read on joins and stuff, i know the solution to this problem is to use to make the standard SQL solution then convert it into Yii. The problem also is you can't feed CGridView with CActiveRecords directly the CActiveDataProvider is made from CActiveRecord but sometimes you need to make CActiveRecords from the start using queries. I don't want to use CdbCriteria i just want to do my work this time from CActiveRecord, arrrgggghhhh! if you get what i mean! The good news though is i have multiple active shopping carts working for a single users buying from mulitiple sellers, it took a bit of array work but i got it done in the end.
  24. Thanks for getting back to me on that, mine does unfortunately, i just wanted to know how you got on with it if you did do it. Its quite a tricky situation but i will figure it out shortly. My project will take to end of next year there is just too much stuff to do and its getting more and more complex the more code that is written. Sometimes i forget i already have functions that do stuff that i think i need to code, its spaghetti junction now, hahaha.
  • Create New...