Jump to content

Mufleeh

Members
  • Posts

    36
  • Joined

  • Last visited

Everything posted by Mufleeh

  1. Than darkfreaks, Let me check this...
  2. Hi, I sent you a PM thinking you would see it soon! Regards, Mufleeh
  3. Hi, I am using queries in PHP to search data from the database in my local pc. Below error is being repeated even after increasing the memory limit from 128M to 256M in PHP configure file. Please advice me the way to fix this? Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 39 bytes) in C:\Program Files\BitNami WAPPStack\apache2\htdocs\census\includes\school.php on line 1131 Regards, Mufleeh
  4. Hi DavidAM, Great it started working now! Thanks for your effort and really appreciated! Regards, Mufleeh
  5. Hi, I think it is being connected to the data base, because the welcome message appears with the user log in name. Next the $dbh is assigned as, $dbh = new PdoExt(); Actually the system was working perfectly before I upload few data for the database. Please check whether you can help me. Regards, Mufleeh
  6. Hi, I am receiving the below when I'm trying to log into my system.... Fatal error: Call to a member function fetchAll() on a non-object in C:\Program Files\BitNami WAPPStack\apache2\htdocs\census\.private\permission.php on line 87 Below are the codes in the line number 86 and 87, $result = $dbh->query($query); $rows = $result->fetchAll(); Is there any error in this code or suggestions to fix this? Regards, Mufleeh
  7. Hi, Thanks for the responses, I managed to fix it. Query I made in the beginning is, $query = $this->dbh->prepare("SELECT * FROM teachers,school_locations where teachers.nic = (SELECT nic FROM teacher_appointments where teacher_appointments.census_id =(SELECT census_id FROM school_locations where school_locations.division_id =(SELECT division_id FROM divisions WHERE divisions.division_name='$_POST[division_name]')))"); This works if there is only one field in the division, and locations table. But when I rewrite it as below it works properly. $query = $this->dbh->prepare("SELECT * FROM teachers,school_locations where teachers.nic IN (SELECT nic FROM teacher_appointments where teacher_appointments.census_id IN(SELECT census_id FROM school_locations where school_locations.division_id =(SELECT division_id FROM divisions WHERE divisions.division_name='$_POST[division_name]')))"); Thanks for your useful help. Cheers!
  8. Hi all, I am new to PHP as well as to this forum. Thanks in advance for you support. My problem is to retrieve data from multi tables. I mean contains Zones, Division, Schools and Teachers. In a single Zone there can be many divisions and in a single division there can be many schools. I need to make a query to find out all the teachers in a particular zone. I made the query like below, $query = $this->dbh->prepare("SELECT * FROM teachers,school_locations where teachers.nic=(SELECT nic FROM teacher_appointments where teacher_appointments.census_id =(SELECT census_id FROM school_locations where school_locations.division_id=(SELECT division_id FROM divisions WHERE divisions.division_name='$_POST[division_name]')))"); this works fine where there is only one zone, one division and one school, i mean when the field in the tables are one. I used foreach loop to view the data on this case. Can anyone please let me know how to display the data when there are many fields like many schools for a single division and many divisions for a single zone etc.? below the foreach loop I used, foreach ($teachers AS $row) { echo "<tr>"; $i = $i + 1; echo "<td>$i.</td> <td>" .$row[division_id]."</td> <td>" .$row[nic]."</td> <td>" .$row[name_initials]."</td> <td>" .$row[name_full]."</td> <td>". $row[date_of_birth]."</td> <td>". $row[sex]."</td> <td>". $row[address_permanent]."</td> <td>". $row[zone_id]."</td>"; }
  9. Thank you so much! Its great, it made the task easy. I really want to know how to retrieve the data, I mean all the teachers from a single zone. Even this code seem to work only if there is only one division and one school in a given zone. I hope the output of the query is a multidimensional array isn't it? I have done this using foreach loop...which works only if there is one field in every table as I said above. How can I make the foreach loop to get all the data? Thanks
  10. Hi, This is my complete query... $query = $this->dbh->prepare("SELECT * FROM teachers,school_locations where teachers.nic=(SELECT nic FROM teacher_appointments where teacher_appointments.census_id =(SELECT census_id FROM school_locations where school_locations.division_id=(SELECT division_id FROM divisions WHERE divisions.division_name='$_POST[division_name]')))"); Thank you
  11. Hi all, I am new to PHP as well as to this forum. Thanks in advance for you support. My problem is to retrieve data from multi tables. I mean contains Zones, Division, Schools and Teachers. In a single Zone there can be many divisions and in a single division there can be many schools. I need to make a query to find out all the teachers in a particular zone. I made the query like below, $query = $this->dbh->prepare("SELECT * FROM teachers,school_locations where teachers.nic=(SELECT nic FROM teacher_appointments where ............school_locations.division_id=(SELECT division_id FROM divisions WHERE divisions.division_name='$_POST[division_name]')))"); this works fine where there is only one zone, one division and one school. I used foreach loop to view the data on this case. Can anyone please let me know how to retrieve the data from multiple tables?
×
×
  • 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.