Jump to content

Viewing only certain type of Inventory from inventory.php


gamerzfuse

Recommended Posts

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])

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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;
	}
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.