Jump to content

Recommended Posts

Can you help me with this?

When i run this SQL command in phpMyAdmin:

select student, count(student) from incoming group by student;

 

Some kids names are counted correctly, others are shown twice. For example:

2 Angel Cesar

3 Angel Cesar

 

Why would I not get:

5 Angel Cesar

 

All the names are fed to Mysql from a php web form drop-down list, so there isn't any possibility of the names being spelled differently.

 

Thanks, Mike

Link to comment
https://forums.phpfreaks.com/topic/133342-mysql-count-doesnt-add-all-names/
Share on other sites

You probably have some white-space before or after the names. You would need to dump the data and examine it or check what the length is.

 

If you do have some white-space, it is probably due to a coding error when the names were entered or when they are being put into the form.

This is what's going on:

 

The teachers submit tardies with a php/html web form.

The data is sent to mysql.

 

I'm trying to make a form that will tell the teachers who is getting the most tardies.

 

the web form they see looks something like this:

 

 

tardies    student

4            campa myrea

4            delgado juan

3          anguiano maria

1          gerardo jose

1          archuletta david

 

 

kids are ordered by tardies.

So campa myrea has 4 tardies, and so on. And the teacher can see her individual tardies with dates, etc. on another form.

the form works fine for MOST kids

 

but some kids names look like this:

 

2          ramirez jennifer

2          ramirez jennifer

 

and her name should be

 

4        ramirez jennifer

 

 

I'm in the process of dumping data and submitting it again to see what happens.

 

This is an intranet. I host everything from my computer.

Thanks, Mike

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.