Advertisement

09.22.2008 at 07:38AM PDT, ID: 23751534
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.1

php $_GET?  Retrieving results from database and outputting using php.

Asked by BenthamLtd in PHP Installation, PHP for Windows, PHP and Databases

Tags:

Created the "insert_sheet.php" aspect of this system, and it works brilliantly. However, I was wondering if I could use the same format to retrieve results as well? Maybe exploiting $_GET a little?

The code is attached below. Is it possible to get it outputting, just by changing the <forms> to Get? I also want this reflecting in the URL e.g. sheets.php?sheet=12133 . I might be barking up the wrong tree here, I'm just running out of ideas and looking for suggestions.

You'll also notice that the "insert_sheet.php" runs off sql_str.php....basically an over-the-top way of retrieving <select> forms from various databases to output as a drop down. Will it still pick up on these?

Thank you in advance.Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
282:
283:
284:
285:
286:
287:
288:
289:
290:
291:
292:
293:
294:
295:
296:
297:
298:
299:
300:
301:
302:
303:
304:
305:
306:
307:
308:
309:
310:
311:
312:
313:
314:
315:
316:
317:
318:
319:
320:
321:
322:
323:
324:
325:
326:
327:
328:
329:
330:
331:
332:
333:
334:
335:
336:
337:
338:
339:
340:
341:
342:
343:
344:
345:
346:
347:
348:
349:
// insert_sheet.php
 
<?php // insert_sheet.php
require_once("_config.php"); 
require_once("sql_str.php");
 
// CALL FOR LOGIN IF USER IS NOT LOGGED IN"
if ($_SESSION["username"] == '') { punt(); }
 
?>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>CS Db | Main</title>
<LINK REL=StyleSheet HREF="styles.css" />
</head>
<body>
 
<div id="header_logo">
<?php include("header_logo.php") ?>
</div>
 
<div id="header">
<?php include("header.php") ?>
</div>
 
<div id="menu">
<?php include("menu.php") ?>
</div>
 
<div id="content">
<div id="sheets_table">
 
<table width="700" align="left" cellpadding="0" cellspacing="0" class="sheets">
<form action="insert_sheet.php" method="post" onsubmit="javascript:return confirm('Add this sheet?');">	<tr>	
    	<td width="154" class="hed">&nbsp;CURRENT STATUS</td>
    	<td width="171" class="hed"><select name="fStatus" id="fStatus" size="1">
									<option value="0" selected="selected">(select)</option>
									<?php do { ?><option value="<?php echo $row_sql_status['StatusID']; ?>"><?php echo $row_sql_status['Status']; ?></option>
									<?php } while ($row_sql_status = mysql_fetch_assoc($sql_status));
											$rows = mysql_num_rows($sql_status);
											if($rows > 0) {
												mysql_data_seek($sql, 0);
													$row_sql_status = mysql_fetch_assoc($sql_status);
											}
											?></select></td>
		<td width="182" class="hed">&nbsp;ACTIONEE</td>
		<td width="172" class="hed"><select name="fActionee" id="fActionee" size="1">
						<option value="0" selected="selected">(select)</option>
								<?php do { ?><option value="<?php echo $row_sql_actionee['ActioneeID']; ?>"><?php echo $row_sql_actionee['Actionee_DisplayName']; ?></option>
								<?php } while ($row_sql_actionee = mysql_fetch_assoc($sql_actionee));
										$rows = mysql_num_rows($sql_actionee);
										if($rows > 0) {
											mysql_data_seek($sql, 0);
												$row_sql_actionee = mysql_fetch_assoc($sql_actionee);
										}
										?></select></td>
  	</tr>
    <tr>
    	<td class="hed">&nbsp;TYPE</td>
    	<td class="hed"><select name="fType" id="fType" size="1">
						<option value="0" selected="selected">(select)</option>
						<?php do { ?><option value="<?php echo $row_sql_sheet_type['SheetTypeID']; ?>"><?php echo $row_sql_sheet_type['SheetType']; ?></option>
						<?php } while ($row_sql_sheet_type = mysql_fetch_assoc($sql_sheet_type));
								$rows = mysql_num_rows($sql_sheet_type);
								if($rows > 0) {
									mysql_data_seek($sql, 0);
										$row_sql_sheet_type = mysql_fetch_assoc($sql_sheet_type);
								}
								?></select></td>
		<td class="hed">&nbsp;</td>
		<td class="hed">&nbsp;</td>
	</tr>
 	<tr>
		<td colspan="4">&nbsp;</td>
	</tr>	
  	<tr>
 	   	<td><strong>Sheet No</strong> </td>
    	<td><form id="fRefNo" name="fRefNo" method="post" action="">
      		<label><input name="fRefNo" type="text" /></label></td>
		<td>Logged by </td>
    	<td><form id="fLoggedBy" name="fLoggedBy" method="post" action="">
       		<label><input name="fLoggedBy" type="text" value="<?php echo $_SESSION["name"]; ?>" /></label></td>
 	</tr>  
	<tr>
    	<td>Sales Ledger Ref No</td>
		<td><form id="fSalesRef" name="fSalesRef" method="post" action="">
      		<label><input name="fSalesRef" type="text" /></label></td>
		<td>Problems Class</td>
		<td><select name="fProblems" id="fProblems" size="1">
			<option value="0" selected="selected">(select)</option>
			<?php do { ?><option value="<?php echo $row_sql_problems_class['ProblemsClassID']; ?>"><?php echo $row_sql_problems_class['ProblemsClass']; ?></option> 
			<?php } while ($row_sql_problems_class = mysql_fetch_assoc($sql_problems_class));
 					$rows = mysql_num_rows($sql_problems_class);
  					if($rows > 0) {
      					mysql_data_seek($sql, 0);
        					$row_sql_problems_class = mysql_fetch_assoc($sql_problems_class);
  					}
					?></select></td>
	</tr>
	<tr>
		<td colspan="4">&nbsp;</td>
	</tr>
		<td>Creation DateTime </td>
   		<td><form id="fCreation" name="fCreation" method="post" action="">
     		<label><input type="text" name="fCreation" value="<?php echo date("Y-m-d H:i:s"); ?>" /></label></td>
		<td>Latest Modification </td>
    	<td><form id="fModification" name="fModification" method="post" action="">
      		<label><input type="text" name="fModification" value="<?php echo date("Y-m-d H:i:s"); ?>" /></label></td>
  	</tr>
	<tr>
    	<td colspan="4">&nbsp;</td>
    </tr>  
	<tr>
    	<td colspan="4">&nbsp;</td>
  	</tr>  
	<tr>
   		<td>Company Name</td>
    	<td><form id="fCompany" name="fCompany" method="post" action="">
      		<label><input type="text" name="fCompany" /></label></td>
		<td>Invoice Date</td>
    	<td><form id="fInvoice" name="fInvoice" method="post" action="">
      		<label><input type="text" name="fInvoice" /></label></td>
	</tr>  
	<tr>
    	<td>Contact Name</td>
   		<td><form id="fContact" name="fContact" method="post" action="">
      		<label><input type="text" name="fContact" /></label></td>   
    	<td>Account Manager</td>
    	<td><select name="fAccountMan" id="fAccountMan" size="1">
			<option value="0" selected="selected">(select)</option>
			<?php do { ?><option value="<?php echo $row_sql_account_manager['ActioneeID']; ?>"><?php echo $row_sql_account_manager['Actionee_DisplayName']; ?></option> 
			<?php } while ($row_sql_account_manager = mysql_fetch_assoc($sql_account_manager));
 					$rows = mysql_num_rows($sql_account_manager);
  					if($rows > 0) {
      					mysql_data_seek($sql, 0);
        					$row_sql_account_manager = mysql_fetch_assoc($sql_account_manager);
  					}
					?></select></td>
  	</tr>  
	<tr>
    	<td>Postcode</td>
    	<td><form id="fPostcode" name="fPostcode" method="post" action="">
      		<label><input type="text" name="fPostcode" /></label></td>
		<td>Order Confirmed by</td>
    	<td><select name="fConfirmedBy" id="fConfirmedBy" size="1">
			<option value="0" selected="selected">(select)</option>
			<?php do { ?><option value="<?php echo $row_sql_order_confirmed_by['ActioneeID']; ?>"><?php echo $row_sql_order_confirmed_by['Actionee_DisplayName']; ?></option> 
			<?php } while ($row_sql_order_confirmed_by = mysql_fetch_assoc($sql_order_confirmed_by));
 					$rows = mysql_num_rows($sql_order_confirmed_by);
  					if($rows > 0) {
      					mysql_data_seek($sql, 0);
        					$row_sql_order_confirmed_by = mysql_fetch_assoc($sql_order_confirmed_by);
  					}
					?></select></td>
	</tr>  
	<tr>
   		<td>Email</td>
    	<td><form id="fEmail" name="fEmail" method="post" action="">
      		<label><input type="text" name="fEmail" /></label></td>
		<td>&nbsp;</td>
  		<td>&nbsp;</td>
	</tr>  
	<tr>
    	<td>Phone</td>
    	<td><form id="fPhone" name="fPhone" method="post" action="">
      		<label><input type="text" name="fPhone" /></label></td>
		<td>&nbsp;</td>
    	<td>&nbsp;</td>
	</tr>  
	<tr>
		<td colspan="4">&nbsp;</td>
	</tr>
	<tr>
		<td>Description of problem</td>
		<td colspan="3"><form id="fDescription" name="fDescription" method="post" action="">
       			        <label><textarea name="fDescription" cols="95" rows="4" class="textarea"></textarea></label></td>
	</tr>
	<tr>
		<td colspan="4">&nbsp;</td>
	</tr>
	<tr>
    	<td>Goods to be returned </td>
    	<td><form id="fGoodsRet" name="fGoodsRet" method="post" action="">
   			<label><input type="text" name="fGoodsRet" /></label></td>
		<td>Goods to be shipped</td>
		<td><form id="fGoodsShip" name="fGoodsShip" method="post" action="">
			<label><input type="text" name="fGoodsShip" /></label></td>
	</tr>
	<tr>
		<td>&nbsp;</td>
    	<td>&nbsp;</td>
		<td>Goods to be sent on receipt</td>
		<td><form id="fGoodsReceipt" name="fGoodsReceipt" method="post" action="">
			<label><input type="text" name="fGoodsReceipt" /></label></td>
	</tr>
	<tr>
    	<td colspan="4">&nbsp;</td>
	</tr>
	<tr>
		<td>Method of return </td>
    	<td><select name="fMethodReturn" id="fMethodReturn" size="1">
			<option value="0" selected="selected">(select)</option>
			<?php do { ?><option value="<?php echo $row_sql_method_return['MethodReturnID']; ?>"><?php echo $row_sql_method_return['MethodReturn']; ?></option>
			<?php } while ($row_sql_method_return = mysql_fetch_assoc($sql_method_return));
					$rows = mysql_num_rows($sql_method_return);
					if($rows > 0) {
						mysql_data_seek($sql, 0);
							$row_sql_method_return = mysql_fetch_assoc($sql_method_return);
					}
			?></select></td>
		<td>Action required </td>
    	<td><select name="fActionReqd" id="fActionReqd" size="1">
			<option value="0" selected="selected">(select)</option>
			<?php do { ?><option value="<?php echo $row_sql_action_required['ActionReqdID']; ?>"><?php echo $row_sql_action_required['ActionReqd']; ?></option>
			<?php } while ($row_sql_action_required = mysql_fetch_assoc($sql_action_required));
					$rows = mysql_num_rows($sql_action_required);
					if($rows > 0) {
						mysql_data_seek($sql, 0);
							$row_sql_action_required = mysql_fetch_assoc($sql_action_required);
					}
			?></select></td>
	</tr>
	<tr>
    	<td>&nbsp;</td>
    	<td>&nbsp;</td>
		<td>Restocking charge </td>
   		<td><select name="fRestock" id="fRestock" size="1">
			<option value="0" selected="selected">(select)</option>
			<?php do { ?><option value="<?php echo $row_sql_restocking_charge['RestockingChargeID']; ?>"><?php echo $row_sql_restocking_charge['RestockingCharge']; ?></option>
			<?php } while ($row_sql_restocking_charge = mysql_fetch_assoc($sql_restocking_charge));
					$rows = mysql_num_rows($sql_restocking_charge);
					if($rows > 0) {
						mysql_data_seek($sql, 0);
							$row_sql_restocking_charge = mysql_fetch_assoc($sql_restocking_charge);
					}
			?></select></td>
	</tr>
    <tr>
		<td colspan="4">&nbsp;</td>
	</tr>
	<tr>
    	<td>Sales notes </td>
    	<td colspan="3"><form id="fSalesNotes" name="fSalesNotes" method="post" action="">
      					<label><textarea name="fSalesNotes" cols="95" rows="3"></textarea></label></td>
	</tr>
	<tr>
    	<td colspan="4">&nbsp;</td>
	</tr>
    <tr>
		<td>Product Support notes </td>
    	<td colspan="3"><form id="fProductSupNotes" name="fProductSupNotes" method="post" action="">
						<label><textarea name="fProductSupNotes" cols="95" rows="3"></textarea></label></td>
	</tr>
  	<tr>
		<td colspan="4">&nbsp;</td>
	</tr>
   	<tr>
		<td>Operations/Shipping notes </td>
		<td colspan="3"><form id="fOperationsNotes" name="fOperationsNotes" method="post" action="">
						<label><textarea name="fOperationsNotes" cols="95" rows="3"></textarea></label></td>
	</tr>
   	<tr>
	<td colspan="4">&nbsp;</td>
	</tr>
    <tr>
		<td>Accounts notes </td>
		<td colspan="3"><form id="fAccountsNotes" name="fAccountsNotes" method="post" action="">
	  					<label><textarea name="fAccountsNotes" cols="95" rows="3"></textarea></label></td>
	</tr>
	<tr>
	<td colspan="4">&nbsp;</td>
	<tr>
	<td colspan="4"><input name="submit" type="submit" value="Submit" /></form></td>
	</tr>
 
</table>
 
</div>
</div>
</body>
</html>
 
 
 
// sql_str.php
<?php
require_once("_config.php"); 
/* 
FORMAT OF SQL SELECT QUERIES
$query_<name> = "SELECT....";
$sql_<name> = mysql_query($query_<name>) or die(mysql_error());
$row_sql_<name> = mysql_fetch_assoc($sql_<name>);
$totalsrows_sql_<name> = mysql_num_rows($sql_<name>);
*/
// sheet_no
$query_sheet_no = "SELECT max(Sheet_No) FROM sheets";
$sql_sheet_no = mysql_query($query_sheet_no) or die(mysql_error());
$row_sql_sheet_no = mysql_fetch_assoc($sql_sheet_no);
$totalrows_sql_sheet_no = mysql_num_rows($sql_sheet_no);
// status
$query_status = "SELECT * from status";
$sql_status = mysql_query($query_status) or die(mysql_error());
$row_sql_status = mysql_fetch_assoc($sql_status);
$totalrows_sql_status = mysql_num_rows($sql_status);
// actionee
$query_actionee = "SELECT ActioneeID, Actionee_DisplayName from actionee ORDER BY ActioneeID Asc";
$sql_actionee = mysql_query($query_actionee) or die(mysql_error());
$row_sql_actionee = mysql_fetch_assoc($sql_actionee);
$totalrows_sql_actionee = mysql_num_rows($sql_actionee);
// sheet_type
$query_sheet_type = "SELECT * from sheet_type";
$sql_sheet_type = mysql_query($query_sheet_type) or die(mysql_error());
$row_sql_sheet_type = mysql_fetch_assoc($sql_sheet_type);
$totalsrows_sql_sheet_type = mysql_num_rows($sql_sheet_type);
// problems_class
$query_problems_class = "SELECT * from problems_class";
$sql_problems_class = mysql_query($query_problems_class) or die(mysql_error());
$row_sql_problems_class = mysql_fetch_assoc($sql_problems_class);
$totalrows_sql_problems_class = mysql_num_rows($sql_problems_class);
// account_manager (from actionee table)
$query_account_manager = "SELECT ActioneeID, Actionee_DisplayName from actionee WHERE ActioneeID > 7 ORDER BY ActioneeID Asc";
$sql_account_manager = mysql_query($query_account_manager) or die(mysql_error());
$row_sql_account_manager = mysql_fetch_assoc($sql_account_manager);
$totalsrows_sql_account_manager = mysql_num_rows($sql_account_manager);
// order_confirmed_by (from actionee table)
$query_order_confirmed_by = "SELECT ActioneeID, Actionee_DisplayName from actionee WHERE ActioneeID > 7 ORDER BY ActioneeID Asc";
$sql_order_confirmed_by = mysql_query($query_order_confirmed_by) or die(mysql_error());
$row_sql_order_confirmed_by = mysql_fetch_assoc($sql_order_confirmed_by);
$totalsrows_sql_order_confirmed_by = mysql_num_rows($sql_order_confirmed_by);
// method_return
$query_method_return = "SELECT * from method_return";
$sql_method_return = mysql_query($query_method_return) or die(mysql_error());
$row_sql_method_return = mysql_fetch_assoc($sql_method_return);
$totalsrows_sql_method_return = mysql_num_rows($sql_method_return);
// action_required
$query_action_required = "SELECT * from action_required";
$sql_action_required = mysql_query($query_action_required) or die(mysql_error());
$row_sql_action_required = mysql_fetch_assoc($sql_action_required);
$totalsrows_sql_action_required = mysql_num_rows($sql_action_required);
// restocking_charge
$query_restocking_charge = "SELECT * from restocking_charge";
$sql_restocking_charge = mysql_query($query_restocking_charge) or die(mysql_error());
$row_sql_restocking_charge = mysql_fetch_assoc($sql_restocking_charge);
$totalsrows_sql_restocking_charge = mysql_num_rows($sql_restocking_charge);
 
?>
 
Loading Advertisement...
 
[+][-]09.22.2008 at 08:34AM PDT, ID: 22540961

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.22.2008 at 10:58AM PDT, ID: 22542300

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.23.2008 at 05:01AM PDT, ID: 22548307

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.23.2008 at 05:03AM PDT, ID: 22548321

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.23.2008 at 07:32AM PDT, ID: 22549787

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: PHP Installation, PHP for Windows, PHP and Databases
Tags: php
Sign Up Now!
Solution Provided By: Ray_Paseur
Participating Experts: 2
Solution Grade: A
 
 
[+][-]09.23.2008 at 09:19AM PDT, ID: 22551106

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.23.2008 at 10:10AM PDT, ID: 22551685

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-44 / EE_QW_2_20070628