Jump to content

witham

Members
  • Posts

    86
  • Joined

  • Last visited

    Never

Everything posted by witham

  1. Barand thanks so very much for your help I have learned a great deal from this problem, hopefully one day I will be able to give to this forum instead of merely taking. Thanks again
  2. Barand another question please what does this mean? Manufacturer No Database Selected Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in C:\Program Files\xampp\htdocs\baaSelect.php on line 283 Product No Database Selected Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in C:\Program Files\xampp\htdocs\baaSelect.php on line 283 ?>
  3. barand thank you very much for your help, I am sorry if the questions I asked seemed stupid but sometimes to learn you have to ask someone with greater knowledge than yourself. Once again thanks for your help.
  4. sorry for my lack of knowledge but how do I do that please?
  5. thanks very much but being a newie I need a little more assistance, I copied and pasted the code you kindly sent but got an error message Warning: main(baaSelect.php) [function.main]: failed to open stream: No such file or directory in C:\Program Files\xampp\htdocs\delprod.php on line 32 Warning: main() [function.include]: Failed opening 'baaSelect.php' for inclusion (include_path='.;C:\Program Files\xampp\php\pear\') in C:\Program Files\xampp\htdocs\delprod.php on line 32 Fatal error: Class 'baaSelect' not found in C:\Program Files\xampp\htdocs\delprod.php on line 34 The actual code as it stands currently is: Could you please, please tell me where I am going wrong? <?php //prevents caching header("Expires: Sat, 01 Jan 2000 00:00:00 GMT"); header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); header("Cache-Control: post-check=0, pre-check=0",false); session_cache_limiter(); session_start(); require('C:\Program Files\xampp\htdocs\config.php'); require('C:\Program Files\xampp\htdocs\functions.php'); //this is group name or username of the group or person that you wish to allow access to // - please be advise that the Administrators Groups has access to all pages. if (allow_access(Administrators) != "yes") { include ('C:\Program Files\xampp\htdocs\no_access.html'); exit; } ?> <? $dbuser  = ''; // your database server user name $dbhost  = 'localhost'; // name of the sql server $dbpass  = ''; // your database server password $dbname  = 'weld'; // the name of the database to connect to include 'baaSelect.php'; $sel = new baaSelect(); $sel->addSelect('manufacturer', 'man', 'manid', 'manname', '', 1, '- manufacturer -'); $sel->addSelect('product', 'prodname', 'prodno', 'proddesc', 'manno', 1, '- product -'); ?> <html> <head> <meta name="generator" content="PhpED Version 4.5 (Build 4513)"> <title>baaSelect Sample</title> <meta name="author" content="Barand"> <?php $sel->makeScript() ?> </head> <body>     <form>   <table>   <tr>       <td>         Manufacturer       </td>       <td>         <?php $sel->makeSelect('manufacturer'); ?>       </td>   </tr>   <tr>       <td>         Product       </td>       <td>         <?php $sel->makeSelect('product'); ?>       </td>   </tr> </table> <input type="submit" name="submit" value="Submit"> </form> ?> </body> </html>
  6. [quote author=Barand link=topic=100227.msg395416#msg395416 date=1152651455] If you use the baaSelect class, all you need is [code] <?php include 'baaSelect.php'; $sel = new baaSelect(); $sel->addSelect('manufacturer', 'man', 'manid', 'manname', '', 1, '- manufacturer -'); $sel->addSelect('product', 'prodname', 'prodno', 'proddesc', 'manno', 1, '- product -'); ?> <html> <head> <meta name="generator" content="PhpED Version 4.5 (Build 4513)"> <title>baaSelect Sample</title> <meta name="author" content="Barand"> <?php $sel->makeScript() ?> </head> <body>     <form>   <table>   <tr>       <td>         Manufacturer       </td>       <td>         <?php $sel->makeSelect('manufacturer'); ?>       </td>   </tr>   <tr>       <td>         Product       </td>       <td>         <?php $sel->makeSelect('product'); ?>       </td>   </tr> </table> <input type="submit" name="submit" value="Submit"> </form> ?> </body> </html>[/code] [/quote]
  7. Thank you very much for your reply This is the code but I don't know what to add to the sqlPRODNAME to only show the data for that particular manufacturer. // the sql query to select the data for displaying later $sqlMANUFACTURERS = "SELECT MANID, MANNAME FROM man order by MANNAME"; $sqlPRODNAME = "SELECT manid, manno, manname,  prodno, proddesc from prodname, man where manno = manid order by proddesc;"; <form action="weld2.php" method="get"> <hr> <tr><td colspan = 3><h3 align = "center"><i><b>PRODUCT DELETION</b></i></h3></td><tr> <br> <br> <br> <br <tr><td colspan = 2><h2 align=center><i>This screen allows users to add products to W.E.L.D.</h2></td></tr> <tr><td><b>Manufacturer:</b></td> <? //initiate the $result variable and populate it with the data from the $sqlMANUFACTURERS table $result  = mysql_query($sqlMANUFACTURERS, $dblink) or die("<p>Error Processing Query</p><hr /><p>".mysql_error()."</p>\n"); // mysql_fetch_array fetches the results from the query a row at a time each time it's called // the result is returned as an array that can be referenced either by field name or by it's index // this data is then put into a drop down box popualted by the updated manufacturers list echo '<td><select name="Manufacturer">'; while ($row = mysql_fetch_array ($result)) // loop through the rows outputing them as html table rows   { echo '<option value="' . $row["MANID"] . '">' . $row["MANNAME"] . "</option>";   } echo '</select></td></tr>'; ?> <tr><td><b>Product Name:</b></td> <? //initiate the $result variable and populate it with the data from the $sqlPRODNAME table $result  = mysql_query($sqlPRODNAME, $dblink) or die("<p>Error Processing Query</p><hr /><p>".mysql_error()."</p>\n"); // mysql_fetch_array fetches the results from the query a row at a time each time it's called // the result is returned as an array that can be referenced either by field name or by it's index // this data is then put into a drop down box popualted by the updated manufacturers list echo '<td><select name="Product Name">'; while ($row = mysql_fetch_array ($result)) // loop through the rows outputing them as html table rows   { echo '<option value="' . $row["prodno"] . '">' . $row["proddesc"] . "</option>";   } echo '</select></td></tr>'; ?>
  8. Can anyone help I need to select data from a database using two drop down boxes I want the first selection which is for a manufacturer to show all the option but only show the products made by them in the second drop down box instead of all products?
×
×
  • 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.