I mean…
You need a * and a COUNT(*)... SELECT *, count(*) AS child_count
I mean…
You need a * and a COUNT(*)... SELECT *, count(*) AS child_count
Like this ?
This is what i have
$sql = "SELECT *, count(*) AS child_count FROM people GROUP BY Name ORDER BY child_count DESC";
That query will select all Name’s. Grouping all data for each together. Meaning, it will give you DISTINCT names. So, if Ernie is in that list four times, like for four kids, it will only show one entry for Ernie.
And, it will count the entries for each name. so, it really counts rows. It shows the count for every row in the table for each name and orders the list from largest child_count to the lowest child_count.
Understand the query?
Sorry not sure if i understand what you are trying to explain,
If you are saying that the query will give the following result
Ernie 4
That is what i want just cannot get it to work
If that is not what you are explaining it is the wrong query
No, that would be correct! 100%
Then, using WHILE, you would run a second query. The second one would loop thru the four Ernie’s child list and display those using the name in the WHERE.
So that seems to be the right code just won’t work no idea why.
But someone else on here asked for a running version of the package i use.
Which i managed to do and also set up another database table for it to be run on for them.
So there is a fully working test version online for testing.
the persons reply to that is that there are too many errors in the PHP files which makes it impossible to add other features.
All the standard features work perfectly.
Well, my guess it is because you must use the library calls instead of just plain old PHP and MySQL.
So, why are you needing to use their database? I don’t remember if this was a class or not. ( ? )
You could just back up their database to your computer and use more standard ways to access the data.
The code for that is not too complicated.
Anyway, why don’t you ask the people who gave the pages to you about all this? They should be able to explain how to do with it using their class-calls…
Oh, I do not mind helping still. Just not sure why standard queries are not working!
ErnieAlex, sorry i just feel like i am wasting everybodys time
I suppose it’s possible that the whole package is the problem but i have not enough knowledge of PHP to find out what’s happening.
Something is wrong somewhere because code that should work doesn’t.
Ok have to use their database because of the program on my computer that updates the database it needs Remote access to work.
I have my own hosting with databases but no remote access, if i use them i have to update everyday manually with a CSV file.
Anyway, why don’t you ask the people who gave the pages to you about all this? They should be able to explain how to do with it using their class-calls…
Because they will reply if something is not working but won’t reply if you suggest adding things or anything else.
Okay, so you should be able to connect to the database on your computer locally. You are using Wamp, correct? You have their database on your computer. Did you install their database on your system?
If so, you can use a more normal connection string and just do your own coding. More standard ones!
No the database is on a remote server that the software installed on my computer uses to connect to and update. I can tell you more but only by PM
Well, I thought this was a PM…
Anyway, if you connect to their remote database, then, you can run queries locally.
This means that you can still handle it all. It just means that you have to use their conventions.
Send me a private message showing some of their code. Like where it displays some data that is working now.
I have to work on some other things for awhile, but, will study your code and see what I can come up with.
We can do it in small steps so that we both can understand how it should be done using their system.
ErnieAlex, not sure if you are getting the private messages, sent you four already and they don’t appear as sent??