|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Showing results for Mysql Query multiple results for each name
Hi,
This is a bit hard to explain but basically I have a form which has a load of tick box's and it posts to my reports page then queries the database for the correct results this sort of works: PHP Code:
If you look at the bottom of the code you will see $a1[Details] this part works but doesn't show everything I want it to, it should show all the details which are linked to the name but it only shows 1 detail. For example if I search for Cheese and Cow if the name was in the database with cheese as the details and was in the database again with cow as the details the $a1['Details'] bit it should show Cheese & Cow but it only shows Cheese. I also want to count the amount of Details associated it each name for example if it was just cheese it would say 1 if it was cheese and cow it would show 2. Hope some 1 can help! Thanks!!1 |
|
#2
|
|||
|
|||
|
The code that you've shown doesn't have very good syntax.
PHP Code:
Missing the ";" after the $n PHP Code:
the "<?php" tag is in the middle of a bunch of PHP code (it's above and below). But assuming all of this is fixed: Can you echo out your $criteria variable and post the HTML source? Also, you can use mysql_num_rows() to count the rows.
__________________
Sir, a desire of knowledge is the natural feeling of mankind; and every human being, whose mind is not debauched, will be willing to give all that he has to get knowledge. |
|
#3
|
|||
|
|||
|
Ok ignore that this is a bit less messy can you help this:
PHP Code:
So name will only appear once for each result, details should have all the details linked, details is basically the criteria we posted from the form. Hope that helps you understand more what I am trying to do? Thanks Last edited by drewj2k : August 20th, 2008 at 02:37 PM. |
|
#4
|
|||
|
|||
|
Can you echo out your $criteria variable and post the HTML source?
Or upload your relevant files in a ZIP file? |
|
#5
|
|||
|
|||
|
James,
Sorry if you saw the original post... I found what you were saying and agree Also, not to hijack... but I was just in Cleveland last week. West lake actually at a Hyland Software training. Not a bad little town ya got there Matt Last edited by MatthewJ : August 20th, 2008 at 02:22 PM. Reason: stupididty |
|
#6
|
|||
|
|||
|
ahhh sorry it would appear like
Criteria = Cheese Or Criteria = Cow Or Criteria = Poo And it what I want it to show is data like this Cheese Factory (2): Cheese Cow Cow Field (2): Cow Poo Cow Factory (1): Cow Shop (1): Cheese -------------------------------------- At the moment it shows: Cheese Factory (): Cheese Cow Field (): Cheese Cow Factory (): Cheese Shop (): Cheese --------------------------------------- In the data base it would appear like this 1: Name:Cheese Factory | Criteria = Cheese 2: Name:Cheese Factory | Criteria = Cow I hope that helps! Last edited by drewj2k : August 20th, 2008 at 02:40 PM. |
|
#7
|
|||
|
|||
|
Quote:
haha cool- yeah it's not too bad here. The science center is okay and the science center's omni-max theater is always cool. We also have a lot of bars (haha). All kinds of restaurants. Browns stadium, Progressive stadium. |
|
#8
|
|||
|
|||
|
Any ideas??
|
|
#9
|
|||
|
|||
|
Can you post the entire form page and the entire processing page (the one you posted code from already?) I'm going to try to test it out on my server.
|
|
#10
|
|||
|
|||
|
Well this is it really at the moment the page previous to this is just a form that post's multiple criteria's to this page:
PHP Code:
|
|
#11
|
|||
|
|||
|
I'd like to see the form page- so I have an idea of the values that are being passed.
|
|
#12
|
|||
|
|||
|
Also- what are all of the different column names in the table you are using?
|
|
#13
|
|||
|
|||
|
The form page bit works heres an example form :
PHP Code:
The fields I Need are Name And Details and we are searching by Criteria. thanks |
|
#14
|
|||
|
|||
|
From what you have given me- it doesn't look like any of this works at all. Please paste actual working code. Right now I can only make your idea work by rewriting the entire thing. You can post the actual complete code, or post working code at least.
|
|
#15
|
|||
|
|||
|
PHP Code:
|
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > Showing results for Mysql Query multiple results for each name |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|