Adding multi dimensional arrays to different tables

[quote=“ahundiak, post:19, topic:361928”]
There is simply no reason to spend time and effort making sql INSERT strings when libraries such as DBAL are readily available and widely used.
[/quote] I am being opened up to a whole new height of development, and the way you structured the table, two errors i do mostly is that all my none interger columns are set to VARCHAR(255) and you used CHAR(8) for gender

I completely understand what you are saying regarding creating a new unique id for the student. I don’t have a problem with that at all. This however does not address when “Second Term” records are uploaded without a clear way of identifying if the student is in the database already. These “Second Term” students will again be given a new id that is different than the “First Term” upload.

you are very correct, but from the records the only thing that can differ from students is their firstname and last name, so if we are to check that we can do if SELECT where first = fffff AND last = ddd

and if returned query is not empty then user already exist but then possibility of having hundreds of persons with same firstname and lastname is very much possible, hence comes our unique id to save the students. unique id is the database primary key and must not have duplicate, so we can have 5 mary jane in the students database but their unique id will be different as to know which one her records is being accessed

impressive enough, there is so much automation in this DBSL, looks like so many hands are working on the insert function, i will like to know if i can enable this in my localhost or does it work together with MySQL database because that’s the one my live host uses

The Doctrine DBAL library is just a wrapper for PHP’s PDO class. Doctrine connects to a database and then offers a few convenience methods like insert and update.

$db = DriverManager::getConnection([
    'url' => 'mysql://user:password@localhost/schools'
]);

The ‘mysql’ part of the connection string indicates you want to connect to a mysql database.

1 Like

I will run this in my console to get composer compile the folder for me as to use it in my project.?

  1. then i will write a php code including the vendorautoload.php

  2. and then other codes to get it inserted.

please can u zip a compozed folder or project called school zip it and upload here so i can download and get testing immediately

It has become clear that I am confusing you far more than any help I might be providing. My apologies. I deleted my posts and won’t bother you again.

so sorry you misunderstood my request, you actually gave me a clue, the table structures and the looping was perfectly understood and i can replicate what you did using a normal mysql insertion query. but really love to start using DBAL library and my common hard nut is composer, i normal install compozer in my laptop and use console to compile any packagelist but if i have an already compozed library i will just unzip it in my project folder and point the autoload.php accordingly.

please return the post am making progress with it, i should have copied it out if i knew you were going to delete it.

I have restored @ahundiak’s posts.

1 Like

The student_id was never an increments number, the way the Api produces its data differs from the way we choose to interpret and store them. these students are not regular every day students, in term or course module they may have 10 students which they assigned an id student1 to student10. but once that term or course module has ended, they start a fresh registeration or onboarding for student who applied for term two or module two which they may not necessary be same students, even if a formal student applied for term two is likely his id for term two will change.

So we here are keeping records or all activities thats why the unique id has date plus the added number.

Most important thing is inserting into the database and we can take care of subsequent insertions without updating any records or having the issue to worry about student already exist, because a student can exist as many times as he took the course but in our storage he will be identified with a serial or unique number per course or entry.

Thanks a million times @Gandalf you are kind

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.