SitePoint Sponsor

User Tag List

Page 3 of 4 FirstFirst 1234 LastLast
Results 51 to 75 of 80
  1. #51
    SitePoint Enthusiast
    Join Date
    Oct 2008
    Location
    Pleasanton, CA
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    All,
    I went ahead and pointed my script to my practice db that I created yesterday, in which I copied my seven tables, with r937's big assist. I now have a duplicate db set-up, but with only 20 member records. Everything works there when I query using my form, but......I get the same error if I include a city in the search form: Unknown column 'city' in 'where clause'

    So, like last night, I tried querying directly from the SQL tab of phpMyAdmin.
    I can successfully query when I include a WHERE clause of ' WHERE city = 'Livermore'. I can query successfully when I include a WHERE clause of ' WHERE l_name LIKE 'B%' and city = 'Dublin'.

    I can successfully query with any combination of f_name, l_name, gender and city.

    So, does this prove that the db is fine, and that my problem lies buried somewhere in my form processing script?
    Curtis
    Was it summer when the river ran dry, or was it just another dam?

  2. #52
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,015
    Mentioned
    53 Post(s)
    Tagged
    2 Thread(s)
    yes, that's a reasonable conclusion

    if you wouldn't mind, just one more time, echo the query before you execute it, the one that's still giving you the "unknown city" column

    perhaps you aren't executing the same query you think you're building
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #53
    SitePoint Enthusiast
    Join Date
    Oct 2008
    Location
    Pleasanton, CA
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here's one.
    I entered a% in the last name field, and dublin in the city field of my form.
    I set up this echo statement:
    $sql2 = $sql.$whereClause.$orderBy; echo'Line 132: '.$sql2.'<br />';
    and I see this at the top of my web page:

    SELECT l_name, f_name, city, num, address
    FROM names
    LEFT OUTER JOIN idcity ON idcity.mem_id = names.mem_id
    LEFT OUTER JOIN cities ON cities.city_id = idcity.city_id
    LEFT OUTER JOIN idphone ON idphone.mem_id = names.mem_id
    LEFT OUTER JOIN phone ON phone.phone_id = idphone.phone_id
    LEFT OUTER JOIN idemail ON idemail.mem_id = names.mem_id
    LEFT OUTER JOIN email ON email.email_id = idemail.email_id
    WHERE l_name LIKE 'A%' AND city = 'Dublin'
    ORDER BY l_name, f_name
    Unknown column 'city' in 'where clause'
    Curtis
    Was it summer when the river ran dry, or was it just another dam?

  4. #54
    SitePoint Enthusiast
    Join Date
    Oct 2008
    Location
    Pleasanton, CA
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The thing is, that query (appears to be) built perfectly. The spacing between words is all single space. All VARCHAR types are wrapped in single quotes.

    We know (or have strong reason to believe) that the DB is not at fault.

    I just don't get this.
    Curtis
    Was it summer when the river ran dry, or was it just another dam?

  5. #55
    SitePoint Enthusiast
    Join Date
    Oct 2008
    Location
    Pleasanton, CA
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Also, I've set up echo statements throughout the script wherever my $city value travels, that echo the script line number and a short message relaying where in the script that echo statement is. When I enter form data and press Submit, I can then read the cookie crumb trail of echo statements that describe exactly what blocks of logic the program is executing.

    No matter how I enter form data, the cookie crumb trail echoed to my monitor is exactly as it should be - I see no fault with the logic. No loop or array or if() or else() or any construct that I can see is ever skipped or used improperly when it shouldn't be.
    Curtis
    Was it summer when the river ran dry, or was it just another dam?

  6. #56
    SitePoint Enthusiast
    Join Date
    Oct 2008
    Location
    Pleasanton, CA
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What if:
    I change the column name in the table to something else, like "town".
    then, one at a time, I update the word "city" in the script to "town" and enter form data and press Submit to read he error message.
    Might that trouble shoot a bit?
    Curtis
    Was it summer when the river ran dry, or was it just another dam?

  7. #57
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The issue is your php code. Variables will have different values at different points in your script(obviously). It looked like you were trying to echo the query out at a different point in your script than where you were trying to execute the query. I didn't really bother to read your code, but it seems a bit messy(uses the global scope a lot). This often leads to these types of problems. That query which you echo out may very well be different that the query you actually execute, and would totally explain your issue.


    PHP Code:
    mysql_query($the_query) or die("tried to execute: '$the_query'"); 
    always right click>view html source. you browser will render the html and sometimes hide stuff from you. view the raw text.

    you can debug your script. use var_dump() to inspect the values of you variables. you wrote the script, and you should be able to go through it line by line and say "i know the value of this variable should be xxx here, lets see if im right". Same for conditional statements. " i know that since this variable has this value, that this IF() statement whould be true". test it. discover what the code is doing. you will chop down to the problem in minutes.

  8. #58
    SitePoint Enthusiast
    Join Date
    Oct 2008
    Location
    Pleasanton, CA
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    crmalibu, thank you for your advice.
    I'd like to point out that my code is indented neatly and is commented well. If it's messy, it's only a reflection of my inexperience in arranging and configuring script logic. I would think it's not bad considering how little time I've been doing this, and considering that it worked flawlessly for many weeks, until I redesigned the db. You would do well to refrain from criticizing someone's level of experience or calling their code messy. Particularly when we are unable to view samples of yours when you were starting out. My guess is that it was rather shoddy, wouldn't you agree?

    I don't know where your Global comment came from. I don't use the key word once in the script. Nor do I ever try to reference a global-scope variable from within a function.

    The script worked great until I redesigned my db with more normalized tables a couple weeks ago. Of course I had to change a few things in the script. Apparently I messed something up during that process.

    I don't know how to use var_dump(), but I will investigate, as it sounds like a useful tool. Do I need to place it in several strategic locations so that it dumps several times, or...?

    If you had read my recent posts you would know that I did place echo statements throughout the script where the $city variable or related blocks of code reside, so that I could follow the city value through the script's execution. Yes, it's a valuable troubleshooting technique. It also uncovered no irregularities in the logic. Likewise, using my eyes and knowledge of the scripts construction, I followed the logic from $_POST variable receipt to final query building, and I cannot see any flaws there. Doesn't mean the flaw isn't there, of course, but I can't find it :-)

    Thank you for your time and advice. I will look into var_dump() in the online manual and see how it can help me.
    Curtis
    Was it summer when the river ran dry, or was it just another dam?

  9. #59
    SitePoint Wizard guelphdad's Avatar
    Join Date
    Oct 2003
    Location
    St. Catharines, ON Canada
    Posts
    1,706
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Simplest thing to do is start over. The error is somewhere in your php code. Strip it down to the absolute basics. Attach to your database and then use mysql_array to step through the values on output. Look at the manual if you need an example of using it.

    Don't do any other checks or types of output.

    Once that works, then you can add other pieces of code.

    I'd suggest this thread move to the PHP forum as someone there more familiar with PHP might find the error. we know the error isn't in the mysql query.

  10. #60
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,015
    Mentioned
    53 Post(s)
    Tagged
    2 Thread(s)
    one more question...

    i don't normally read php (i don't write it at all, ever), but this time i gave it a try

    as you are building your WHERE clause, i don't see you using the WHERE 1=1 technique which i suggested (and there is an even easier method, the implode)

    instead, take city for example

    in order to decide how to append a condition for city onto the WHERE clause that you are building, you have some logic to determine whether to say AND city = something or whether to say just city = something without the AND, based on whether there was a condition for either last name or first name ahead of it -- i.e. whether this condition on city happens to be the first one that comes after the WHERE keyword or not, which is already present in the SQL statement

    all that code is unnecessary

    anyhow, my question ...

    i notice that while you are building the portion of the WHERE clause dealing with city, you have this code --
    Code:
    $thisCity = checkCity($city); //checkCity() function near line 248
        if(!($thisCity)) {
          $msg = "Our records indicate that no current club member lives in
                   ".$city.". Carefully check your spelling and adjust your search
                    accordingly."; //I'll use the message later
        }
    what exactly happens in that checkcity function? how would you know that you don't have a member in that city, without looking in the database to find any members in that city?

    is this where the "unknown city" error message is being created? does the checkcity function make a bad call to the database?

    i'm guessing you did SELECT stuff FROM names WHERE city = something, and, of course, city isn't in the names table anymore, you moved it out into a many-to-many table

    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  11. #61
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I said your code is messy in the sense that it uses the global scope a lot. That's different from using the global keyword(which imports a global variable into a local function scope). Yes your code is consitantly indented, commented, and you used descriptive variable names. I wasn't trying to put you down, I was just pointing this out because this style of coding espescially becomes more and more difficult to maintain and debug as it grows. This is opposed to using more functions and classes to seperate logic and prevent variable name clashes.

    Anyway, you want to start from a known problem point and work backwards through the code. We know that your call to mysql_query() is failing, so this is the spot where you should start doing your sanity checking. mysql_query() is complaining saying you gave it a bad sql query. You used a variable to give it this query, so you should inspect the value of the variable at this point in your script.

    Using the code you posted when you posted the entire script
    PHP Code:
      $_SESSION['sql'] = $sql $_SESSION['whereClause'] . $orderBy $limit;
      
    // you MUST check it right at the known problem point, because it's value may have changed.
      // we don't (yet) care what the value of this variable is in a different part of the script
      
    $sql_result mysql_query($_SESSION['sql'], $conn) or die("failed query: '$_SESSION[sql]'   " mysql_error());
      
    $num_rows mysql_num_rows($sql_result); 
    I realize you have checked the value in your other posts. But I think you checked the value at a different point in the script, which isn't useful. That only tells us that at some point in the script, it has a suitable value. You need it to have a suitable value at the point where you actually use it. I bet you're going to get some half doubled up query, which i'll explain why you got it.

    post the result here. right click> view html source and copy from the raw text output.

  12. #62
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by r937 View Post
    what exactly happens in that checkcity function? how would you know that you don't have a member in that city, without looking in the database to find any members in that city?
    Heh, I get to answer one of rudys questions for once
    He hardcoded an array of city names, and just checks to see if its present.
    PHP Code:
      function checkCity($cityIn) {
        
    $cityIn ucwords(strtolower($cityIn));
        
    $cities = array('Alamo''Antioch''Atascadero', ... about fifty cities here);
        if(!(
    in_array($cityIn$cities))) {
          return 
    false;
        }
      } 
    But the function itself has a logic error. The function will only return boolean false, or null. When the return value of the function is later evaluated
    PHP Code:
    if(!($thisCity)) {
          
    $msg "Our records indicate that no current club member lives in
                   "
    .$city.". Carefully check your spelling and adjust your search
                    accordingly."
    //I'll use the message later
        

    The if() conditon will always be false. This is a seperate, unrelated problem though that doesn't affect the query construction.

  13. #63
    SitePoint Enthusiast
    Join Date
    Oct 2008
    Location
    Pleasanton, CA
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I wake up every morning, check my email, and am constantly amazed that there's a message saying someone has replied to this post. I very much appreciate all of you trying so hard to help me solve this thing. Really.

    to address guelphdad:
    1. I'm open to someone moving the thread; do that if it's proper.
    2. I told my wife this morning why I've been going to bed each night so sullen, that I'm trying to solve this puzzle and cannot do it. So, I decided to (sort of) start over...it's more like taking a single large step backward. I'm going to move 'city' back into my main names table, where l_name, f_name and gender live. If that works well, then perhaps I'll again try to break city out into its own table. I think guelphdad suggested a slightly less normalized arrangement a couple days ago in the interest of a simpler design. So, perhaps I'll give that a go and see what shakes out.

    r937:
    1. I *think* you are suggesting that my default WHERE clause, near the top of my script and included at the tail end of my initial $sql statement, should say " WHERE 1=1 " Is that right? OK, I can do that easily enough.

    2. I'm a smart guy and can read the manual to learn how to employ the implode() function, I think. Or, is it asking too much to ask someone to post here how I might adapt it to my needs?

    3.
    In order to decide how to append a condition for city onto the WHERE clause that you are building, you have some logic to determine whether to say AND city = something or whether to say just city = something without the AND, based on whether there was a condition for either last name or first name ahead of it -- i.e. whether this condition on city happens to be the first one that comes after the WHERE keyword or not, which is already present in the SQL statement

    all that code is unnecessary
    I thought it was quite clever, building the WHERE clause piece by piece in the early parts of the script as I step through the four if() constructs to check to see if the visitor input a l_name, f_name, city or gender. As you noticed, the second, third and fourth if() blocks check to see if any of the preceding if() blocks evaluated true for its form input value (and, therefore, added something to the WHERE clause) If so, then the block appends ' AND city = ...' with a space before the AND. If the WHERE clause has nothing in it yet, then the logic appends "city = ...'

    If that code is unnecessary, as you say, then how do I construct the WHERE clause?

    4. As crmailbu points out, checkCity compares the input city value against a hard-coded array of cities down near the bottom of my script (where I keep all the functions). That array contains all the cities represented by members of our club. It's not an elegant solution :-) but it demonstrates where I was as a developer a couple months ago. When I rewrite/update the script I will instead pull values from the db to check against the input city value, and echo some message when the visitor tries to search by a city in which none of our club members reside.

    As it turns out, last night I commented out that function, and the call to it. :-) Still got the error message, of course...

    crmalibu:
    1. I have not yet learned to implement classes in Web site design, so I'm stuck with what more gifted and snobbish developers might call spaghetti code. Like lots of things in my scripts, it reflects where I am right now as a developer. I read a very interesting devshed thread a few months back on OOP vs. Procedural development. Is it better to use classes, etc, or is it more appropriate to do it the way I do. In the end, after lots of posts, the people who contributed to the thread couldn't decide. Both styles have pros and cons. I am *very* interested in learning to develop using OOP, because I believe it to be more "modern" (or some such nonsense :-))

    2. I know I need to work backward, I just wasn't sure where to begin. Thank you for explaining very well that the mysql_query() is the place to start. This I can do.
    I bet you're going to get some half doubled up query, which i'll explain why you got it. Post the result here. right click> view html source and copy from the raw text output.
    I don't know what "half doubled up query" means. And I'm sorry, but I'm unclear on what you're asking me to do -- post what results here? What do you want me to do prior to viewing the source and posting it here? While waiting for your return post I'll echo the value of $_SESSION['sql'], which is the variable query I pass into mysql_query(). I'll set up that echo one line ahead of $sql_result = mysql_query($_SESSION['sql'], $conn) or die("failed query: '$_SESSION[sql]' " . mysql_error());

    3. Yeah, I hard-coded the cities into an array. And, yes, it *did* have a logic error, but a couple days ago I reworded that function to return true, else false. And, no, fixing it didn't help a damm bit ;-)
    Curtis
    Was it summer when the river ran dry, or was it just another dam?

  14. #64
    SitePoint Enthusiast
    Join Date
    Oct 2008
    Location
    Pleasanton, CA
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK, my query now looks like this:
    Code:
    $_SESSION['sql']=$sql.$_SESSION['whereClause'].$orderBy.$limit;
    $sql_result=mysql_query($_SESSION['sql'], $conn) or die("failed query: '$_SESSION[sql]' ".mysql_error());
    
    //$sql_result=mysql_query($_SESSION['sql'], $conn) or die(mysql_error());
    $num_rows = mysql_num_rows($sql_result);
    I entered a city name of 'Dublin' in my search form, and got the usual message:
    Unknown column 'city' in 'where clause'

    When I add the echo statement: echo $_SESSION['sql'];
    one line ahead of the $sql_result=.... and submit a city name through my form, I get the same message.

    So...should I start moving that echo statement farther and farther up my script to see when it begins returning a value? I'll try that...
    Curtis
    Was it summer when the river ran dry, or was it just another dam?

  15. #65
    Guru in training bronze trophy SoulScratch's Avatar
    Join Date
    Apr 2006
    Location
    Maryland
    Posts
    1,838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Edit: I didn't see your SQL join on page 2 so I was testing the wrong query ;p

    If you're still using:

    SELECT l_name, f_name, city, num, address FROM names LEFT OUTER JOIN...
    city is no longer in the names table ( i think Rudy addressed this ) and you'd have to refer to it by cities.city when doing your JOINs.
    Last edited by SoulScratch; Feb 8, 2009 at 14:25.
    Cross browser css bugs

    Dan Schulz you will be missed

  16. #66
    SitePoint Enthusiast
    Join Date
    Oct 2008
    Location
    Pleasanton, CA
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    But I don't have to refer to num as phone.num, or address as email.address. Why would the db engine want me to specify table.column for city? What's so special about *that* column name?

    I added crmalibu's modified mysql_query():
    $sql_result = mysql_query($_SESSION['sql'], $conn) or die("failed query: '$_SESSION[sql]' " . mysql_error());
    but with some modification of my own. In my script I commented out *all* references to SESSION variables. I commented out entire blocks of code that do the pagination, or set SESSION[city] and other stuff... and then I rewrote that mysql_query() like this:
    $sql_result = mysql_query($sql, $conn) or die("failed query: '$sql'" . mysql_error());
    When I query by f_name, l_name city or gender now, I get this print out at the top of my browser window:
    failed query: 'SELECT l_name, f_name, city, num, address
    FROM names LEFT JOIN idcity ON idcity.mem_id = names.mem_id
    LEFT JOIN cities ON cities.city_id = idcity.city_id
    LEFT JOIN idphone ON idphone.mem_id = names.mem_id
    LEFT JOIN phone ON phone.phone_id = idphone.phone_id
    LEFT JOIN idemail ON idemail.mem_id = names.mem_id
    LEFT JOIN email ON email.email_id = idemail.email_id
    WHERE 'You have an error in your SQL syntax;
    check the manual that corresponds to your MySQL server version
    for the right syntax to use near '' at line 1

    Does that help any of you see what's happening?
    Curtis
    Was it summer when the river ran dry, or was it just another dam?

  17. #67
    Guru in training bronze trophy SoulScratch's Avatar
    Join Date
    Apr 2006
    Location
    Maryland
    Posts
    1,838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by cstallins View Post
    But I don't have to refer to num as phone.num, or address as email.address. Why would the db engine want me to specify table.column for city? What's so special about *that* column name?
    Well.. considering the error

    Unknown column 'city' in 'where clause'
    It makes perfect sense in my opinion, that you shouldn't be trying to do a SELECT city from NAMES because this is happening BEFORE a join, and the column does NOT exist prior so how can it SELECT if it's not there? I could be wrong, but it just makes sense to me.
    Cross browser css bugs

    Dan Schulz you will be missed

  18. #68
    Guru in training bronze trophy SoulScratch's Avatar
    Join Date
    Apr 2006
    Location
    Maryland
    Posts
    1,838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually

    $query = "SELECT l_name, f_name, city, num, address
    FROM names LEFT JOIN idcity ON idcity.mem_id = names.mem_id
    LEFT JOIN cities ON cities.city_id = idcity.city_id
    LEFT JOIN idphone ON idphone.mem_id = names.mem_id
    LEFT JOIN phone ON phone.phone_id = idphone.phone_id
    LEFT JOIN idemail ON idemail.mem_id = names.mem_id
    LEFT JOIN email ON email.email_id = idemail.email_id
    WHERE city = 'Dublin'
    ORDER BY l_name, f_name;";
    This returned a result fine for me, so scratch that prior comment out ;p
    Cross browser css bugs

    Dan Schulz you will be missed

  19. #69
    SitePoint Enthusiast
    Join Date
    Oct 2008
    Location
    Pleasanton, CA
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    SoulScratch, thank you for your tenacity.
    I assume that, when you say you ran that query with the WHERE name = 'Dublin' you mean that you ran it directly in the db, using phpMyAdmin or similar tool. Because we determined yesterday that querying with any combination of l_name, f_name, city or gender directly in the db (without using my web site form) works great -- the query will return names, cities and genders for all of my club members that satisfy the query criteria. So, the people contributing to this thread believe that we've pretty much absolved the db and tables. The db apparently is free of blame for this issue, and the problem must be with the PHP script that handles my form input.
    Curtis
    Was it summer when the river ran dry, or was it just another dam?

  20. #70
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by cstallins View Post
    Does that help any of you see what's happening?
    Not really. Changing the code by commenting out variables changes its behavior. You aren't yet trying to change the code. You need to discover the problem with your code before you should attempt to fix it. The problem at hand right now is with the sql query you are executing.

    Don't comment anything out. You shouldn't make changes until you know why you're making those changes or you're going to change the behavior of your code and make things more difficult. We don't know what changes you have really made when you do this.

  21. #71
    SitePoint Enthusiast
    Join Date
    Oct 2008
    Location
    Pleasanton, CA
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK, cr, I'll bring all the commented code back into play.
    I'm sorry that I need so much hand holding, but I'm not terribly good at reading between the lines or interpreting gray area. If you have the time, can you tell me exactly what I should do next: What query do I run, in what location of the script do I insert it, and when do I View Source to copy 'n paste the output here?
    Curtis
    Was it summer when the river ran dry, or was it just another dam?

  22. #72
    SitePoint Enthusiast
    Join Date
    Oct 2008
    Location
    Pleasanton, CA
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK, I think I finally clued it to what some of you have been saying.
    I hard-coded my SELECT query at line 144 (using no SESSION b.s.), execute the mysql_query, and get perfectly good results. The two lines of code look like this:
    Code:
    $sql = "SELECT l_name, f_name, city, num, address 
    FROM names 
    LEFT JOIN idcity ON idcity.mem_id = names.mem_id 
    LEFT JOIN cities ON cities.city_id = idcity.city_id 
    LEFT JOIN idphone ON idphone.mem_id = names.mem_id 
    LEFT JOIN phone ON phone.phone_id = idphone.phone_id 
    LEFT JOIN idemail ON idemail.mem_id = names.mem_id 
    LEFT JOIN email ON email.email_id = idemail.email_id 
    WHERE city = 'Dublin' OR f_name = 'Jan' 
    ORDER BY l_name, f_name";
    
    $sql_result = mysql_query($sql, $conn) or die(mysql_error());
    Everything works great, no matter what I add to the WHERE clause, or how I order the results, or...

    So, now I have a place from which I can work backward. I know the query works when hard coded, so now I have to determine where it is breaking when the WHERE clause is assembled piece by piece.

    Does that sound like a solid strategy?
    Curtis
    Was it summer when the river ran dry, or was it just another dam?

  23. #73
    SitePoint Enthusiast
    Join Date
    Oct 2008
    Location
    Pleasanton, CA
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Right now I've reverted to commenting out some questionable code (all the stuff with $_SESSION['whereClause'] for example) and I have got the script working perfectly!

    I'm gradually uncommenting short blocks of code and hope to nail this sucker to the wall before this new week is too old.

    Got to go to work tomorrow. Darn! ;-)
    Curtis
    Was it summer when the river ran dry, or was it just another dam?

  24. #74
    SitePoint Enthusiast
    Join Date
    Oct 2008
    Location
    Pleasanton, CA
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    When I uncomment the $_SESSION['whereClause'] stuff -- just uncomment it - don't even include it in the mysql_query -- the query breaks and I get the Unknown column 'city' in 'where clause'

    digging more...
    Curtis
    Was it summer when the river ran dry, or was it just another dam?

  25. #75
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes your issue may be in the construction of the where caluse, but maybe not. You're getting ahead of yourself. You're trying to blindly fix it.

    Why don't you just look at the query being executed? You're making this so hard on yourself...

    Use the code I posted. You copy and paste the "failed query" message.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •