Jump to content

Recommended Posts

I have a drop down that shows all categories in a database.

 

I have a drop down that shows headerid and appid based off of the catagories.

 

What I need to do is show only the categories that headerid and appid do not match.

 

I've tried this

$formex = "SELECT headerid,appid FROM appforms WHERE headerid NOT LIKE '{$row->catid}%' AND appid NOT LIKE '$appid%'";

and this

$formex = "SELECT headerid,appid FROM appforms WHERE headerid != {$row->catid} AND appid != $appid";

 

and it's still showing every category.

 

I need to exclude the rows that headerid and appid are equal too.

 

Can someone let me know what I'm doing wrong?

 

Thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/260027-not-like/
Share on other sites

Maybe I need more clarification

 

The entire code is like so:

include($_SERVER['DOCUMENT_ROOT']."/inc/config.db.php");
$appid = '44';
$sql="SELECT t1.*,t2.category FROM app_categories as t1 INNER JOIN categories as t2 on t1.catid=t2.id WHERE t1.appid=$appid ORDER BY t1.display_order ASC";
$rs = mysql_query($sql);
if($rs && mysql_num_rows($rs) > 0){
	while ($row = mysql_fetch_object($rs))
	{
		$forms="SELECT headerid,appid FROM appforms WHERE 'headerid' != '{$row->catid}' AND 'appid' != '$appid'";
                $exis = mysql_query($forms);
            $title = empty($row->custom_title) ? stripslashes($row->category) : stripslashes($row->custom_title);
		echo "<option value='http://www.localfreeapps.com/panel/testing/connectors/sample/projects/contactform.php?id=$appid&headerid={$row->catid}'>$title</option>";
	}
}

 

So, with this, I need to show in the drop-down every header from the categories table, unless that headerid and appid match in the appforms table.

 

I hope this makes sense.

Link to comment
https://forums.phpfreaks.com/topic/260027-not-like/#findComment-1332826
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.