Ken2k7 Posted May 11, 2009 Share Posted May 11, 2009 Instead of isset, use empty. Quote Link to comment https://forums.phpfreaks.com/topic/157681-viewing-only-certain-type-of-inventory-from-inventoryphp/page/2/#findComment-831642 Share on other sites More sharing options...
Adam Posted May 11, 2009 Share Posted May 11, 2009 Yeah after a quick look on Google, seems isset() can be a little undependable for certain situations. Quote Link to comment https://forums.phpfreaks.com/topic/157681-viewing-only-certain-type-of-inventory-from-inventoryphp/page/2/#findComment-831646 Share on other sites More sharing options...
gamerzfuse Posted May 11, 2009 Author Share Posted May 11, 2009 Unfortunately I think I'm missing something. http://craighooghiem.com/goodwills/final/inventory.php?order=type&ordertype=DESC&type=car still flags an issue with the code. Am I missing something? I have the code supplied in my inventory.php file, but I when I type in the URL I get those errors. I used to type that URL in and just get no results.. so I feel like I'm getting closer. Anything wrong with: $sSql = ($_GET['type']) ? $vehicles->SQL() . " WHERE type = '" . mysql_real_escape_string($_GET['type']) . "'" : $vehicles->SQL(); (tried with isset() and empty(), but both just gave me errors the same as this [while empty() gave me errors even on just inventory.php without any extras in the URL]) Quote Link to comment https://forums.phpfreaks.com/topic/157681-viewing-only-certain-type-of-inventory-from-inventoryphp/page/2/#findComment-831655 Share on other sites More sharing options...
Ken2k7 Posted May 11, 2009 Share Posted May 11, 2009 It's supposed to be: $sSql = (!empty($_GET['type'])) ? $vehicles->SQL() . " WHERE type = '" . mysql_real_escape_string($_GET['type']) . "'" : $vehicles->SQL(); Quote Link to comment https://forums.phpfreaks.com/topic/157681-viewing-only-certain-type-of-inventory-from-inventoryphp/page/2/#findComment-831665 Share on other sites More sharing options...
gamerzfuse Posted May 11, 2009 Author Share Posted May 11, 2009 I'm still getting the same error. right syntax to use near 'WHERE type = 'car' LIMIT 0, 46' at line 1 Does this mean that type=car is the function that is not working? Quote Link to comment https://forums.phpfreaks.com/topic/157681-viewing-only-certain-type-of-inventory-from-inventoryphp/page/2/#findComment-831672 Share on other sites More sharing options...
Ken2k7 Posted May 11, 2009 Share Posted May 11, 2009 Can you var_dump($sSql) for me? Quote Link to comment https://forums.phpfreaks.com/topic/157681-viewing-only-certain-type-of-inventory-from-inventoryphp/page/2/#findComment-831674 Share on other sites More sharing options...
gamerzfuse Posted May 11, 2009 Author Share Posted May 11, 2009 Can you var_dump($sSql) for me? Does it make sense that I got: NULL when var_dump($sSql) was output? Quote Link to comment https://forums.phpfreaks.com/topic/157681-viewing-only-certain-type-of-inventory-from-inventoryphp/page/2/#findComment-831681 Share on other sites More sharing options...
Ken2k7 Posted May 11, 2009 Share Posted May 11, 2009 No. Where did you put that var_dump($sSql) line? Right after $sSql? Quote Link to comment https://forums.phpfreaks.com/topic/157681-viewing-only-certain-type-of-inventory-from-inventoryphp/page/2/#findComment-831682 Share on other sites More sharing options...
jutaro Posted May 11, 2009 Share Posted May 11, 2009 Look at your actual database to see what is in the "type" field (if that field exists?). Perhaps it is using a number system 1= truck, 2= car, 3=bus ... etc.. Rather then "car" "truck" You can't select something that isn't there. Sorry if I missed something, but I don't have time to read through everything posted right now. Good luck! Quote Link to comment https://forums.phpfreaks.com/topic/157681-viewing-only-certain-type-of-inventory-from-inventoryphp/page/2/#findComment-831707 Share on other sites More sharing options...
Ken2k7 Posted May 11, 2009 Share Posted May 11, 2009 Look at your actual database to see what is in the "type" field (if that field exists?). Perhaps it is using a number system 1= truck, 2= car, 3=bus ... etc.. Rather then "car" "truck" You can't select something that isn't there. Sorry if I missed something, but I don't have time to read through everything posted right now. Good luck! That's not a syntax error. Quote Link to comment https://forums.phpfreaks.com/topic/157681-viewing-only-certain-type-of-inventory-from-inventoryphp/page/2/#findComment-831712 Share on other sites More sharing options...
gamerzfuse Posted May 11, 2009 Author Share Posted May 11, 2009 Look at your actual database to see what is in the "type" field (if that field exists?). Perhaps it is using a number system 1= truck, 2= car, 3=bus ... etc.. Rather then "car" "truck" It's definitely not. If it was only that simple, they are stored as Car SUV etc Quote Link to comment https://forums.phpfreaks.com/topic/157681-viewing-only-certain-type-of-inventory-from-inventoryphp/page/2/#findComment-831713 Share on other sites More sharing options...
Ken2k7 Posted May 11, 2009 Share Posted May 11, 2009 No. Where did you put that var_dump($sSql) line? Right after $sSql? What's the status? Quote Link to comment https://forums.phpfreaks.com/topic/157681-viewing-only-certain-type-of-inventory-from-inventoryphp/page/2/#findComment-831718 Share on other sites More sharing options...
gamerzfuse Posted May 11, 2009 Author Share Posted May 11, 2009 I couldn't get it to output, but string(44) "SELECT * FROM `vehicles` ORDER BY `year` ASC" echo nl2br("\n\n").$sSql.nl2br("\n\n"); Gave me: SELECT * FROM `vehicles` ORDER BY `year` ASC Does that help? The related Function is: // Table SQL function SQL() { $sFilter = $this->CurrentFilter; $sSort = $this->getSessionOrderBy(); return ew_BuildSelectSql($this->SqlSelect(), $this->SqlWhere(), $this->SqlGroupBy(), $this->SqlHaving(), $this->SqlOrderBy(), $sFilter, $sSort); } (as far as I can gather) EDIT: Finally fixed this mother F*er. Don't ask why, but by commenting out $sFilter = $this->CurrentFilter; //$sSort = $this->getSessionOrderBy(); In the above function, it solved my problem! Unfortunately now my sort won't work? Quote Link to comment https://forums.phpfreaks.com/topic/157681-viewing-only-certain-type-of-inventory-from-inventoryphp/page/2/#findComment-831721 Share on other sites More sharing options...
gamerzfuse Posted May 11, 2009 Author Share Posted May 11, 2009 I now have a working http://www.craighooghiem.com/goodwills/final/inventory.php?type=car But, as soon as you sort a column on this page, it reverts back to a URL without type. Can i edit this function to include the GET _type ? // Sort Url function SortUrl(&$fld) { if ($this->CurrentAction <> "" || $this->Export <> "" || ($fld->FldType == 205)) { // Unsortable data type return ""; } else { $sUrlParm = $this->UrlParm("order=" . urlencode($fld->FldName) . "&ordertype=" . $fld->ReverseSort()); return ew_CurrentPage() . "?" . $sUrlParm; } } Quote Link to comment https://forums.phpfreaks.com/topic/157681-viewing-only-certain-type-of-inventory-from-inventoryphp/page/2/#findComment-831733 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.