472,960 Members | 2,067 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,960 software developers and data experts.

get query values but do not show them

18
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 2826
dlite922
1,584 Expert 1GB
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
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 Expert Mod 8TB
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
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...
2
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...
19
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...
2
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...
9
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...
4
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...
12
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...
4
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...
2
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...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

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.