Hi I need some help with this..

I have tables in sql with the following values;

Tbl name - members
memberid - primary key
Username
Password

Tbl name -Orders

Orderid -primary key
memberid - foreign key
orderno


I want to be able to grab the order numbers by the specific member.

I have two members in the sql database.
I have two orders in the sql database.


Here is my sql i used to create the tables -
members -

CREATE TABLE `members` (
  `memberid` int(4) NOT NULL auto_increment,
  `Username` varchar(65) collate latin1_general_ci NOT NULL,
  `Password` varchar(65) collate latin1_general_ci NOT NULL,
  PRIMARY KEY  (`memberid`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1002 ;

--
-- Dumping data for table `members`
--

INSERT INTO `members` VALUES(1000, 'qprping', '1234');
INSERT INTO `members` VALUES(1001, 'xrated', 'password');

orders-

CREATE TABLE `Orders` (
  `Orderid` int(11) NOT NULL,
  `Orderno` int(11) NOT NULL,
  `memberid` int(11) default NULL,
  PRIMARY KEY  (`Orderid`),
  KEY `memberid` (`memberid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

--
-- Dumping data for table `Orders`
--

INSERT INTO `Orders` VALUES(1010, 5892584, 1000);
INSERT INTO `Orders` VALUES(1011, 1234567, 1001);

How do I do this using php?

I have not understood your question but I think you might need to check table joining, especially inner join. May be explaining what you want to accomplish might help!

If you look in the members sql the memberid is related to a specific order in the orders table

so I want to get that specific order number by the member id

what do you have in hand? memeber Id?

would you put sample data on table and ask your question based on minimal data? I have not catch well your question!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.