Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

variant_and 2

Status
Not open for further replies.

drtom

Technical User
Feb 26, 2004
369
CA
Being absolutely new to php I have stumbled when trying to perform what is a very basic query

$query = 'SELECT question '
. ' FROM `master` '
. ' WHERE category = \'personal\', LIMIT 0, 150';
. ' WHERE area = \'tax\' LIMIT 0, 150';

// execute query

I want the agument to look at the category and then look at the area within that category and return an answer.
With the above I get the error "Parse error: parse error, unexpected '.' in /home/pencils/public_html/B1/qa_home/personal_q_tax.php on line 89"

From what I can tell I want to use the variant_and function but haven't been able to find how to write it properly.
Thanks
 
did you see the bit in the sample code saying
THIS ASSUMES YOU ARE ALREADY CONNECTED TO THE DB

;>

you need to put in your mysql_connect and mysql_select_db lines. i don't have your passcodes and parameters to do that.
 
just to be clear - it is the answer.php script that needs to be connected to the db.
 
OH no... I read the "THIS ASSUMES YOU ARE" and thought... YA!!
Duh...
it should have read THIS ASSUMES YOU "ARE A TOTAL GIT!!!"
I feel like the biggest dummy. I never even considered... I just thought it was looking for the answer from the questions page. Guess that's why they call it phprocessor.
Well, thank you both. I would star you guys to death but it might look a little too blatant so accept one and take a bow.
Hope I can return the favour someday.
 
no worries!

because your pop up box is of a fixed height you might want to add an overflow declaration to the second div. you would add
Code:
style="overflow:auto; height=80px;
inside the <div> that has the answer class in it. or you could shove the same directives into the style sheet. the height (80px) should be the height that you want the table cell to be so that the scrollers don't get lost below the windows' bottom.

you might also consider not using pop-up boxes (which I hate...). an alternative might be to place the answers to each question in line but to hide them from the user until the button is clicked. you could either pump all the answers in at the start (some performance issues) or you could use AJAX and pump each answer in as it is needed.
 
I'm so green. I explained to a college professor that I was looking for a course on web design a few months ago. He suggested that I should learn PHP. I remember thinking at the time, why, I just want to design pages...

"So Mr. Ford... why do you bother to line up all of those guys in a long line to build cars... seems like an awful lot of extra factory space if you ask me."

As to pop-ups, I not a fan either, and Jeffy suggested AJAX too, but we just didn't go there. At this point I am going to move forward with the pop-ups and revist the AJAX idea after the sie is compelte.
===========================================================
I am working away on the scrollbar issue. As soon as I place the
Code:
 style="overflow:auto; height=80px;
inside the <div> I loose the answer in the pop-up.

 
the 80px was just a place holder. if you assume you want to pop up to half the height of a typical screen (600px) then you want to make the second div about 200px, i'd guess. play with the number until you get something you like.

i'm working on some ajax stuff at the moment. if i have a time i'll try to post you some code that implements ajax on the first screen. can you send me the code of the first screen to justin {DOT} adie {AT} m-legal {dot} net? can't promise a delivery time...

 
Thanks
I'm off to the airport to deliver some lucky friends on their way to Florida and won't be back until later this afternoon.
I shall send you somthing this evening and report on the scroll issue.
Thanks again.
 
Good news that you've got everything back on track [smile]

If you do want to follow through on the AJAX side of things then it's probably best to start a thread in the Javascript forum216.

There have been some posts there recently on how to use this technique... so best to do a little research first - but having a popup version working already makes it really easy to explain what you want (and your server-side answers.php code won't change at all!).

Cheers,
Jeff

[tt]Jeff's Page @ Code Couch
[/tt]

What is Javascript? FAQ216-6094
 
Tom
did you get the mail i sent you? i got some curious responses from your server.
Justin
 
Yes thanks, I did get it. I took a very quick look at it on Monday and then have been side tracked by paperwork ever since.
What messages were you getting from the server?
 
Hmmm, never had anyone mention that before. I can't imagine why it would happen. Any ideas?

It will likely be the end of this week before I get the chance to return to the files you sent... but I will!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top