Question

I want to retrun the column name from sql database in php after certain conditions. For...

I want to retrun the column name from sql database in php after certain conditions. For example the column is Z,H,Y,J and the value for each column is FFA,1,0,1. First I want to compare my input(array) with Z if my input is equal to Z I want to search any column with 1 and retun the column name by array.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer:

It should be noted that the primary_key member variable is only set to 1 if the primary key on the table is only on that 1 field. If you have a table that has a multiple column primary key, then you will not get what you might expect.

For example:
CREATE TABLE `line_item_table` (
`liForeignKey1` int(11) unsigned not null,
`liForeignKey2` int(11) unsigned not null,
PRIMARY KEY (`liForeignKey1`, `liForeignKey2`)
) ENGINE=MyISAM;

While you might expect that primary_key == 1 for both columns; var_dump() will show you that you get the following for both fields:
["primary_key"]=>int(0)

This is as of PHP 5.2.13 and MySQL 5.0.51

Add a comment
Know the answer?
Add Answer to:
I want to retrun the column name from sql database in php after certain conditions. For...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • How can I print the Database table in PHP please ? here I have form for name and email, also I have php code that allow...

    How can I print the Database table in PHP please ? here I have form for name and email, also I have php code that allow user to add his name and email to my database, all I need to print my final database when the user click on submit. <form action="" method="post"> <label>Name :</label> <input type="text" name="name" required="required" placeholder="Please Enter Name"/><br /><br /> <label>Email :</label> <input type="email" name="email" required="required" /><br/><br /> <input type="submit" value=" Submit " name="submit"/><br /> </form>...

  • Hi this is for SQL Use the AP database Vendor name from the vendor table Vendor...

    Hi this is for SQL Use the AP database Vendor name from the vendor table Vendor Contact First Name and Vendor Contact Last Name from the vendor table but I need them concatenated together with a space between the names Invoice Date from the invoice table Only the day of from the Invoice Date Invoice Number from the invoice table The third and fourth characters from the Invoice Number Line Item Amount from the invoice line items table Calculate the...

  • l want to insert statement inside the table student on My SQL program the latest version...

    l want to insert statement inside the table student on My SQL program the latest version but there is an error l am not able determine how to applied or insert a row as: Steps In each of these queries you’re shown the columns to display in your result. Make your column headers look exactly like the example shown. All these queries use the Starter database. 0. Even if you downloaded it for the previous assignment, to make sure you...

  • In this assignment you will combine HTML, PHP, and SQL in order to create a web...

    In this assignment you will combine HTML, PHP, and SQL in order to create a web form that allows a manager to add films to the sakila database. You will also create a method to allow the manager to view a list of all films along with their related information, and a list of actors in the movies. Task 1 Create an initial HTML page titled manager.html with 2 buttons. The first button will be labeled “View Films”, and the...

  • This is a website picture The html and css code is as follow And my problem is as follow use the php and mysql Northwind Customer Database Search List Records All Records CustomerName v CustomerName...

    This is a website picture The html and css code is as follow And my problem is as follow use the php and mysql Northwind Customer Database Search List Records All Records CustomerName v CustomerName ContactName Address City PostalCode Search O ASC DESC List All Records Insert Record Country List City CustomerName ContactName Address City PostalCode Country List City Find by IID Find Insert 1 <! DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN" "http:L 3-<head> 4 Kmeta http-equiv-"Content-Type" content-"text/html; charset-utf-8" />...

  • I need help showing the first column of the table to show up exactly with the...

    I need help showing the first column of the table to show up exactly with the mysql table into the php page. Is there a way to fix it ? So I created a php form where the user enters the information. sand.truman.edu/~jyl6557/assignment5/hw5-dataentry.php . it asks for name, hometown, gender(only male and female) and status (freshman, sophmore, junior, senior). once it checks and passes through those tests, it would say added successfully and then show the links to add another...

  • I just want the codes for visual basics for the curve length and the root mean...

    I just want the codes for visual basics for the curve length and the root mean square equation i provided above. This is for my visual basics class. Help!.......... Consider the databases (EEG signal data): EEG_Normal, and EEG_Seizure. Curve length. This equation is useful in predicting the stability of the values of a signal. If, in a given interval, the value of this feature is low, it is an indicative that the signal is stable, otherwise the signal is unstable....

  • I need a response in your opinion, from this answer Q1. Any user accessing the database is more i...

    I need a response in your opinion, from this answer Q1. Any user accessing the database is more interested in quick and correct result than how a database is designed. Hence if we introduce redundancy in the table and if the performance of the query increases, then we can ignore 3NF. This is known as denormalization. In this process, a normalized table will be rejoined to have the redundancy in the table to increase the performance of the query. Denormalization...

  • This problem is of moderate complexity and illustrates how a flow chart can be useful in making a working code. Write...

    This problem is of moderate complexity and illustrates how a flow chart can be useful in making a working code. Write a function called myFind that accepts two inputs M and key, where M is an array of any size and key is a scalar. The function uses nested for-loops to search M for all locations of key. The function returns two equally sized column vectors I and J, containing the rows and columns, respectively, of every occurrence of key...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT