Having problems with WHERE parameters in StackApps


(Michael Martinez) #1

I have a StackApps Datagrid on a page that works fine…until I try to add a WHERE condition, and then things go wonky.

The database field that I am searching is: 'Contract’
It contains a string value, like ‘AEBSD’

So I want to use something like: WHERE: Contract = "AEBSD"
But there must be something wrong with my Syntax…please help


(Anne Bourdon) #2

try Contract LIKE “AEBSD”


(Michael Martinez) #3

Thanks for the suggest, but that does not work. I still get no records returned.


(Anne Bourdon) #4

and Contract LIKE “%AEBSD%” ?


(kris ) #5

This post was flagged by the community and is temporarily hidden.


(Michael Martinez) #6

I now know that something weird is going in inside of StackApps…

I say this because I have been so frustrated by not being able to get this to work, that I hand coded a page in PHP to connect to the same table, and run the query that I want, which works fine and pulls all the correct values.

It does not look as nice as it would in StackApps, and it is not as easy to use, but IT WORKS!

So I really do not understand why StackApps will not work…and I am not sure where to go from here, other than to hand code everything, which while being a learning experience, is not what I really want.

I wish that there were a well documented and complete SQL solution for RapidWeaver out there, but there does not seem to be one at this time.

If anyone has a suggestion, I would really like to figure this out.

In my hand coding “WHERE Contract = ‘AEBSD’” works fine…but I get 0 records returned when I us that in StackApps.

Kris --> Contract is not a key value, it is just a text value that is populated in the database. If I could get everything working, I would do the following:

??Maybe if I made it an index…I will have to try that.

1st - limit the TableGrid to all records with a particular project set in the ‘Contract’ field
2nd - provide a search to limit further by location or ‘Site’

But nothing works if I can not create a functional WHERE clause.

Very frustrating!


(Michael Martinez) #7

Funny…it worked once! Then I changed the parameter and it broke, changed it back, still no go.

I uninstalled and reinstalled StackApps and will be trying again in the morning. But if it works, it should work all the time…and with every option!


(kris ) #8

This post was flagged by the community and is temporarily hidden.


(Jon Norris) #9

Stackapps is wonderful but the are frustrations. In the end, by copying and pasting the WHERE bit into the Search tab in phpMyAdmin (part of the Ampps local server setup) it showed me that somehow smart quotes had got in there. Not straight quotes. Turned them off on my Mac and all is well. Just one thought.


(Michael Martinez) #10

jnorris235, THAT WAS IT!!!

Thanks so much! I was going crazy trying different things until I ready your response to my post. Then I highlighted the where clause, clicked on ‘Clear Formatting’ and then ‘Ignore Formatting’…and everything works!

One more thing to add to my notes!

Thanks again,

Michael


(kris ) #11

This post was flagged by the community and is temporarily hidden.