Jump to content

ben.matthews18

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Everything posted by ben.matthews18

  1. By the way, i've just tried the code you edited and it doesn't echo anything at all.
  2. Thanks for the code. that is what i'm trying to do, i've been unable to write a php script that does this.. i'm trying to do that with the script I posted for you. thanks
  3. Here is the sql i used to create 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, 'flour', '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); here is my php code i'm using on the page to get the orders - <?php $host="host"; // Host name $username="user"; // Mysql username $password="password"; // Mysql password $db_name="db_name"; // Database name $tbl_name="Orders"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $Orderid=$_GET['Orderid']; $sql="SELECT * FROM $tbl_name WHERE Orderid='$Orderid'"; $rows=mysql_fetch_array($result); ?> <table width="50%" border="0" align="center" style="margin-top:100px;"> <tr> <td width="23%">Order ID -</td> <td width="77%">Echo Order ID</td> </tr> <tr> <td><? echo $rows['orderid']; ?></td> <td><? echo $rows['orderno']; ?></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> </tr> </table> <?php mysql_close(); ?>
  4. Hi this is what I have set up - SQL tables - Members - memberid - primary key Username Password Orders - Orderid - primary key memberid - foreign key orderno In my sql table there are two members and two orders. 1 order is assigned to 1 member and the other order to the other member. After each member logs in I need to 'echo' that order on the page. I've not been able to write any succesful php code that 'gets' the specific order that is related to the member that has signed in. I would appreciate help on this! Thanks
  5. Ok here is the situatation, I have three tables set up; 'Users' 'Profile' 'Linkingtbl' The 'Users' table holds the following data; Email (PK) Password The 'Profile' table holds the following data; ProfileID (PK) Firstname Lastname DOB The 'Linkingtbl' table holds the following data; ID (PK) Email (FK) Password ProfileID (FK) I have a login system setup and want to be able to show the users 'ProfileID'. The problem that I have is that I also have a select system setup and it is just selecting the first 'ProfileID' in the table and not the 'ProfileID' that is related to the user. How can I do this? Do I need to use a 'WHERE' statement? Thanks
×
×
  • 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.