473,786 Members | 2,399 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

get query values but do not show them

18 New Member
One more question.
How can I get query values assign them to a variable, but not show them?
for example size, $f4 in the following: How can I pass that value $f4 to the form handle page to submit to the database. I can clearly see how to pass $f2 with quantity stuck on the end.

Basically, I need to pass 3 things: 1) item#, 2) item#quantity and 3) size to a new database.



Expand|Select|Wrap|Line Numbers
  1. mysql_select_db("inventory");
  2. $query="SELECT * FROM pecialtymaster where Dental='Y'";
  3. $result=mysql_query($query);
  4. $num=mysql_numrows($result);
  5. mysql_close();
  6. ?>
  7.  
  8. <form action="inventorymaster_form.php" method="post"
  9. name="inventorymaster_form" align="left" class="style3" bgcolor="#ffffff"
  10. onSubmit="return verifyForm(this);">
  11.  
  12. <table border="1" class="mainmenu" border="0" cellpadding="0"
  13. cellspacing="0">
  14. <?php
  15. echo "<table border='1'>
  16. <tr>
  17. <th>Item #</th>
  18. <th>Item Description</th>
  19. <th>Size</th>
  20. <th>Distribution Quantity</th>
  21. <th>Current Quantity</th>
  22. </tr>";
  23. ?>
  24. <?php
  25. $i=0;
  26. while ($i<$num) {
  27. $f2=mysql_result($result,$i,"item_number");
  28. $f3=mysql_result($result,$i,"item");
  29. $f4=mysql_result($result,$i,"size");
  30. $f5=mysql_result($result,$i,"distquantity");
  31. ?>
  32.  
  33. <tr>
  34. <td> &nbsp &nbsp <?php echo $f2;?>&nbsp &nbsp </td>
  35. <td> &nbsp &nbsp <?php echo $f3;?>&nbsp &nbsp </td>
  36.  
  37.  
  38. <td> &nbsp &nbsp <?php echo $f5;?>&nbsp &nbsp </td>
  39. <td align="center"> <input type='text' name="<?php echo $f2?>quantity"
  40. value="" onkeypress="return noenter()">
  41.  
  42. </tr>
  43. <?php
  44. $i++;
  45. }
  46. ?>
  47. </table>
Sep 29 '09 #1
3 2864
dlite922
1,584 Recognized Expert Top Contributor
Don't show them? so don't echo them.

If the other database is on the same host, you can even move the values via SQL. Else just while loop them like you have for the display but do an insert.



Dan
Sep 29 '09 #2
monion
18 New Member
Maybe I'm missing something. The preceding is part of a form. I want to import some values from 1 database table and pass them to a seperate one. The only way I know is to perform an <input...name=. ..> How can I also assign a name to a $variable? I'm new with PHP and mysql so please be patient.

Thanks,
MO
Sep 29 '09 #3
Dormilich
8,658 Recognized Expert Moderator Expert
you don't need a form for that. the job can be done on the server. basicly you do
Expand|Select|Wrap|Line Numbers
  1. // not real code
  2. R1 = connect MySQL-1
  3. R2 = connect MySQL-2
  4. R1 : SELECT ... FROM ...
  5. R2 : INSERT INTO ... VALUES R1
case 1: both database tables are on the same host, this can be done using a single SQL querz (as dlite mentioned)
case 2: there is a lot of code out there that can make this very easy to code. but this code is not as easy to understand as the standard PHP MySQL-functions.
Sep 29 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
2659
by: Orion | last post by:
Hi, This is kind of last minute, I have a day and a half left to figure this out. I'm working on a project using ms-sqlserver. We are creating a ticket sales system, as part of the system, I need to be able to do a search for specific tickets withing price ranges, different locations within the theaters, etc. etc. My problem is in the search one of the criteria is to search for a group of seats together. For example let's say...
2
3549
by: Pete | last post by:
Before I get started with the question, does anyone have a (single) good book recommendation for database design? Not an Access-specific book, but something geared toward helping me figure out *what the user wants*. I've had brief formal education about data flow diagramming, but I'm looking for ... more, now that I'm actually running into problems I think stem from the fact that my users can't explain what they need done, compounded by...
19
59977
by: bdt513 | last post by:
I am trying to extract the values from a query using VBA. Specifically, I want to concatenate all the values of the "rosEmail" field from query "qselRosterEmailList" into one string (strEmails). I can get one record's result by using the DLookup fuction, of course, but I want to get every record's value. To do this, I believe I need to build a recordset, but I do not know how. I've read about doing it using DAO in Access 97, but I am...
2
2255
by: a_munch | last post by:
Hello, I was wondering if there's any way to create a report that will show only rows from a query that meet certain criteria? I can't create a second query that will pull only the records I need for this reason -- I have a crosstab query that shows data by month, and in order to show the full 12 months for the year, I have created some dummy data that has 0 for January through December. I need to have all 12 months as column headings so...
9
23712
by: Mark | last post by:
I've run a few simple tests looking at how query string encoding/decoding gets handled in asp.net, and it seems like the situation is even messier than it was in asp... Can't say I think much of the "improvements", but maybe someone here can point me in the right direction... First, it looks like asp.net will automatically read and recognize query strings encoded in utf8 and 16-bit unicode, only the latter is some mutant, non-standard...
4
4503
by: Joe-Paul | last post by:
Hi: I'm running a simple query on an Access Table from VB6.0. The operator can make several different selections. Based on their selection, a different, specific SQL needs to be run. So, when the operator says... "Do it"...the click procedure goes to a Function (based on their selection)...the specific function builds the correct SQL and returns it...then it sends that query to the final procedure to run the sql, retrieve the data and...
12
2376
by: Tom | last post by:
Hello, I have a database of employee data in access and I am trying to create a form with combo boxes for criteria (ex. gender, office, position, etc.) that let the user select criteria from drop down menus (ex. they may select Male, New York, Manager) and those criteria will be used to run a query (ie Query by Form). I can do this with text boxes but when I tried to use combo boxes no records were returned in the query. Any idea what...
4
8757
by: John | last post by:
I run a query in VB that calculates an average and a count. Again in code I want to grab those 2 values from that query without having to write them first to a table and read the values from that table. How do I go about this? Thanks, john
2
2470
by: markcarroll | last post by:
I have a rather complicating query (the SQL is about a page long) so I hope I can solve this without needing to get into specifics. Basically, the database I am working on has information about investment firms, and what companies they hold shares of. I set up the query to find all the stocks that a specified company held for the most recent date. But we need to display data for the past dates as well. The way I got the most recent date...
0
9492
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10108
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8988
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7510
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6744
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5397
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5532
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3668
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.