Does it exist in table
Is there a built in command that exists to search tables and outputs TRUE or FALSE?
Or what would be the most consise way.
Example:
Let's say a table called "people" has "firstname" and an enum variable of "redshoes" (yes or no)
Sarah, Jeffrey and Tim are three values for firstnames and they all have yes for the value in redshoes except for Tim (because Sarah and Jeffrey own red shoes :) ).
I would like to create or know of a function that inputs redshoes
and in the case above would output TRUE because there exists a person in the table "people" that has redshoes.
$query="SELECT redshoes FROM people";
$result=mysqli_query($cxn,$query) or die ("Couldn't execute query for investigating redshoes existence.");
Then I could see if there is a yes.
Or...
$query="SELECT redshoes FROM people WHERE redshoes='yes'";
$result=mysqli_query($cxn,$query) or die ("Couldn't execute query for investigating redshoes existence.");
How do you test a query that might be empty?
I guess that is the biggest thing I need to understand, is working with a query that results in no values from the table.
Edited 2 time(s). Last edit at 01/11/2011 01:10PM by Karl Warnke.
Subject
Written By
Posted
Does it exist in table
January 11, 2011 01:07PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.