logo-dw

Go Back   Dreamweaver Club Forums > Hand Coders Forum > PHP
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 01-12-2010, 04:39 PM   #1
the chosen one
 
Join Date: Jan 2010
Posts: 1
Default Detial Page

Good day

I would like to add a detail page:
On the my Search page I take the field (dealerID) I would like to use as a link and add the following in the link field at the bottom: detail.php?detail.php=<?php echo $row_rsDetail['prodID']; ?>
That opens my detail page.
Now if I want to add a Recordset in my detail page, I go to bindings and select Recordset (Query).
I first go to “simple” select from my Products table all the fields i want. Then i go to Advanced and found Dreamweaver already added a Variable. I anyway go on and select all the fields I want from my dealers table. My SQL then looks like this:
SELECT prodID, prodMake, prodModel, prodSpecs, prodYear, prodMileage, prodAsk, prodBook, prodColor, prodReconvalue, prodReconremaks, products.dealerID , dealers.dealerID, dealers.dealerName, dealers.dealerContact, dealers.dealerPhone, dealers.dealerCell, dealers.dealerEmail, dealers.dealerCity, dealers.dealerProvince
FROM products, dealers
WHERE prodID = colname and products.dealerID = dealers.dealerID
Dreamweaver self puts in a Variable: colname
Which it further puts in:
Name: colname
Type: Integer
Default value: -1
Run-time value: $_GET[‘prodID’]
If i test it how ever it shows no data.
When I test the page then in IE it shows nothing.
Here is my HTML for my search page:
Code:
1. <?php require_once('Connections/dealertrades.php'); ?>
2. <?php
3. if (!function_exists("GetSQLValueString")) {
4. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
5. {
6. if (PHP_VERSION < 6) {
7. $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
8. }
9. $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
10. switch ($theType) {
11. case "text":
12. $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
13. break; 
14. case "long":
15. case "int":
16. $theValue = ($theValue != "") ? intval($theValue) : "NULL";
17. break;
18. case "double":
19. $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
20. break;
21. case "date":
22. $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
23. break;
24. case "defined":
25. $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
26. break;
27. }
28. return $theValue;
29. }
30. }
31. $maxRows_rsProducts = 20;
32. $pageNum_rsProducts = 0;
33. if (isset($_GET['pageNum_rsProducts'])) {
34. $pageNum_rsProducts = $_GET['pageNum_rsProducts'];
35. }
36. $startRow_rsProducts = $pageNum_rsProducts * $maxRows_rsProducts;
37. mysql_select_db($database_dealertrades, $dealertrades);
38. $query_rsProducts = "SELECT prodID, prodMake, prodModel, prodSpecs, prodYear, prodMileage, prodAsk, prodBook, prodColor FROM products ORDER BY prodMake, prodModel ASC";
39. $query_limit_rsProducts = sprintf("%s LIMIT %d, %d", $query_rsProducts, $startRow_rsProducts, $maxRows_rsProducts);
40. $rsProducts = mysql_query($query_limit_rsProducts, $dealertrades) or die(mysql_error());
41. $row_rsProducts = mysql_fetch_assoc($rsProducts);
42. if (isset($_GET['totalRows_rsProducts'])) {
43. $totalRows_rsProducts = $_GET['totalRows_rsProducts'];
44. } else {
45. $all_rsProducts = mysql_query($query_rsProducts);
46. $totalRows_rsProducts = mysql_num_rows($all_rsProducts);
47. }
48. $totalPages_rsProducts = ceil($totalRows_rsProducts/$maxRows_rsProducts)-1;$maxRows_rsProducts = 20;
49. $pageNum_rsProducts = 0;
50. if (isset($_GET['pageNum_rsProducts'])) {
51. $pageNum_rsProducts = $_GET['pageNum_rsProducts'];
52. }
53. $startRow_rsProducts = $pageNum_rsProducts * $maxRows_rsProducts;
54. mysql_select_db($database_dealertrades, $dealertrades);
55. $query_rsProducts = "SELECT prodID, prodMake, prodModel, prodSpecs, prodYear, prodMileage, prodAsk, prodBook, prodColor FROM products ORDER BY prodMake, prodModel ASC";
56. $query_limit_rsProducts = sprintf("%s LIMIT %d, %d", $query_rsProducts, $startRow_rsProducts, $maxRows_rsProducts);
57. $rsProducts = mysql_query($query_limit_rsProducts, $dealertrades) or die(mysql_error());
58. $row_rsProducts = mysql_fetch_assoc($rsProducts);
59. if (isset($_GET['totalRows_rsProducts'])) {
60. $totalRows_rsProducts = $_GET['totalRows_rsProducts'];
61. } else {
62. $all_rsProducts = mysql_query($query_rsProducts);
63. $totalRows_rsProducts = mysql_num_rows($all_rsProducts);
64. }
65. $totalPages_rsProducts = ceil($totalRows_rsProducts/$maxRows_rsProducts)-1;
66. ?>
67. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
68. <html xmlns="http://www.w3.org/1999/xhtml">
69. <head>
70. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
71. <title>Where Dealers Trade</title>
72. <style type="text/css">
73. <!--
74. @import url("CSS/tafelbinne.css");
75. body {
76. background-color: #1e3036;
77. }
78. .maintable {
79. font-family: Arial, Helvetica, sans-serif;
80. background-color: #d0d0d0;
81. color: #1E3036;
82. }
83. #tafelheader {
84. color: #D0D0D0;
85. background-color: #1E3036;
86. border: thin solid #D0D0D0;
87. }
88. table {
89. color: #D0D0D0;
90. background-color: #1E3036;
91. border: thin solid #D0D0D0;
92. }
93. -->
94. </style>
95. <script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
96. <link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />
97. <style type="text/css">
98. <!--
99. .style1 {font-size: 12px}
100. -->
101. </style>
102. </head>
103. <body>
104. <table width="90%" border="0" align="center" class="maintable">
105. <tr>
106. <th scope="col"><img src="Images/banner.jpg" width="759" height="148" /></th>
107. </tr>
108. <tr>
109. <link href="../../widgets/menubar/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />
110. <style type="text/css">
111. <!--
112. /* Give the menu bar a width and set the margins to "auto"
113. * so that the browser does the centering.
114. */
115. ul.MenuBarHorizontal {
116. width: 75em;
117. margin: auto;
118. }
119. -->
120. </style>
121. <td>
122. <ul id="MenuBar1" class="MenuBarHorizontal">
123. <li><a href="index.php">Home</a></li>
124. <li><a class="MenuBarItemSubmenu" href="#">Search</a>
125. <ul>
126. <li><a href="searchall.php">All</a></li>
127. <li><a href="searchprovince.php">By Province</a></li>
128. <li><a href="searchmakemodel.php">Make &amp; Model</a></li>
129. </ul>
130. </li>
131. <li><a href="add.php">Add Vehicles</a> </li>
132. <li><a href="wanted.php">Vehicles Wanted</a></li>
133. <li><a href="#" class="MenuBarItemSubmenu">Login</a>
134. <ul>
135. <li><a href="loginmembers.php">Members</a></li>
136. <li><a href="loginsiteman.php">Site Manager</a></li>
137. </ul>
138. </li>
139. <li><a href="talktome.php">Talk To Me</a></li>
140. <li><a href="howmuch.php">How Much</a></li>
141. <li><a href="subscribe.php">Subscribe</a></li>
142. </ul></td>
143. </tr>
144. <tr>
145. <td><table width="100%" border="1">
146. <tr>
147. <th width="6%" class="style1" scope="col">I.D.</th>
148. <th width="20%" scope="col"><span class="style1">Make</span></th>
149. <th width="20%" scope="col"><span class="style1">Model</span></th>
150. <th width="10%" scope="col"><span class="style1">Specs</span></th>
151. <th width="6%" scope="col"><span class="style1">Year</span></th>
152. <th width="10%" scope="col"><span class="style1">Mileage</span></th>
153. <th width="14%" scope="col"><span class="style1">Ask Price</span></th>
154. <th width="14%" scope="col"><span class="style1">Book Value</span></th>
155. </tr>
156. </table></td>
157. </tr>
158. <tr>
159. <td class="style1"><?php do { ?>
160. <table width="100%" border="1">
161. <tr class="maintable">
162. <th width="6%" class="style1" scope="col"><a href="detail.php?detail.php=<?php echo $row_rsDetail['prodID']; ?>"><?php echo $row_rsProducts['prodID']; ?></a></th>
163. <th width="20%" scope="col"><?php echo $row_rsProducts['prodMake']; ?></th>
164. <th width="20%" scope="col"><?php echo $row_rsProducts['prodModel']; ?></th>
165. <th width="10%" scope="col"><?php echo $row_rsProducts['prodSpecs']; ?></th>
166. <th width="6%" scope="col"><?php echo $row_rsProducts['prodYear']; ?></th>
167. <th width="10%" scope="col"><?php echo $row_rsProducts['prodMileage']; ?></th>
168. <th width="14%" scope="col"><?php echo $row_rsProducts['prodAsk']; ?></th>
169. <th width="15%" scope="col"><?php echo $row_rsProducts['prodBook']; ?></th>
170. </tr>
171. </table>
172. <?php } while ($row_rsProducts = mysql_fetch_assoc($rsProducts)); ?></td>
173. </tr>
174. </table>
175. <script type="text/javascript">
176. <!--
177. var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});
178. //-->
179. </script>
180. </body>
181. </html>
182. <?php
183. mysql_free_result($rsProducts);
184. ?>
 
And here are the HTML for my Detail page:
 
1. <?php require_once('Connections/dealertrades.php'); ?>
2. <?php
3. if (!function_exists("GetSQLValueString")) {
4. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
5. {
6. if (PHP_VERSION < 6) {
7. $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
8. }
9. $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
10. switch ($theType) {
11. case "text":
12. $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
13. break; 
14. case "long":
15. case "int":
16. $theValue = ($theValue != "") ? intval($theValue) : "NULL";
17. break;
18. case "double":
19. $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
20. break;
21. case "date":
22. $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
23. break;
24. case "defined":
25. $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
26. break;
27. }
28. return $theValue;
29. }
30. }
31. $colname_Rsdetail = "-1";
32. if (isset($_GET['prodID'])) {
33. $colname_Rsdetail = $_GET['prodID'];
34. }
35. mysql_select_db($database_dealertrades, $dealertrades);
36. $query_Rsdetail = sprintf("SELECT prodID, prodMake, prodModel, prodSpecs, prodYear, prodMileage, prodAsk, prodBook, prodColor, prodReconvalue, prodReconremaks, products.dealerID, dealers.dealerID, dealers.dealerName, dealers.dealerContact, dealers.dealerPhone, dealers.dealerCell, dealers.dealerEmail, dealers.dealerCity, dealers.dealerProvince FROM products, dealers WHERE prodID = %s and products.dealerID = dealers.dealerID", GetSQLValueString($colname_Rsdetail, "int"));
37. $Rsdetail = mysql_query($query_Rsdetail, $dealertrades) or die(mysql_error());
38. $row_Rsdetail = mysql_fetch_assoc($Rsdetail);
39. $totalRows_Rsdetail = mysql_num_rows($Rsdetail);
40. ?>
41. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
42. <html xmlns="http://www.w3.org/1999/xhtml">
43. <head>
44. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
45. <title>Where Dealers Trade</title>
46. <style type="text/css">
47. <!--
48. body {
49. background-color: #1e3036;
50. }
51. .maintable {
52. font-family: Arial, Helvetica, sans-serif;
53. background-color: #d0d0d0;
54. border-color: #1E3036;
55. color: #1E3036;
56. }
57. -->
58. </style>
59. <script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
60. <link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />
61. </head>
62. <body>
63. <table width="87%" border="0" align="center" class="maintable">
64. <tr>
65. <th scope="col"><img src="Images/banner.jpg" width="759" height="148" /></th>
66. </tr>
67. <tr>
68. <link href="../../widgets/menubar/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />
69. <style type="text/css">
70. <!--
71. /* Give the menu bar a width and set the margins to "auto"
72. * so that the browser does the centering.
73. */
74. ul.MenuBarHorizontal {
75. width: 75em;
76. margin: auto;
77. }
78. -->
79. </style>
80. <td>
81. <ul id="MenuBar1" class="MenuBarHorizontal">
82. <li><a href="index.php">Home</a></li>
83. <li><a class="MenuBarItemSubmenu" href="#">Search</a>
84. <ul>
85. <li><a href="searchall.php">All</a></li>
86. <li><a href="searchprovince.php">By Province</a></li>
87. <li><a href="searchmakemodel.php">Make &amp; Model</a></li>
88. </ul>
89. </li>
90. <li><a href="add.php">Add Vehicles</a> </li>
91. <li><a href="wanted.php">Vehicles Wanted</a></li>
92. <li><a href="#" class="MenuBarItemSubmenu">Login</a>
93. <ul>
94. <li><a href="loginmembers.php">Members</a></li>
95. <li><a href="loginsiteman.php">Site Manager</a></li>
96. </ul>
97. </li>
98. <li><a href="talktome.php">More Info</a></li>
99. <li><a href="howmuch.php" class="MenuBarItemSubmenu">Administrator</a>
100. <ul>
101. <li><a href="#" class="MenuBarItemSubmenu">Members</a>
102. <ul>
103. <li><a href="#">Add Member</a></li>
104. <li><a href="#">Delete Member</a></li>
105. </ul>
106. </li>
107. <li><a href="#">Add Make</a></li>
108. </ul>
109. </li>
110. <li><a href="subscribe.php">Subscribe</a></li>
111. </ul></td>
112. </tr>
113. <tr>
114. <td><table width="90%" border="1" align="center">
115. <tr>
116. <th width="20%" scope="row">Product ID:</th>
117. <td width="80%" bgcolor="#FFFFFF"><?php echo $row_Rsdetail['prodID']; ?></td>
118. </tr>
119. <tr>
120. <th scope="row">Make:</th>
121. <td bgcolor="#FFFFFF"><?php echo $row_Rsdetail['prodMake']; ?></td>
122. </tr>
123. <tr>
124. <th scope="row">Model:</th>
125. <td bgcolor="#FFFFFF"><?php echo $row_Rsdetail['prodModel']; ?></td>
126. </tr>
127. <tr>
128. <th scope="row">Specifications:</th>
129. <td bgcolor="#FFFFFF"><?php echo $row_Rsdetail['prodSpecs']; ?></td>
130. </tr>
131. <tr>
132. <th scope="row">Year:</th>
133. <td bgcolor="#FFFFFF"><?php echo $row_Rsdetail['prodYear']; ?></td>
134. </tr>
135. <tr>
136. <th scope="row">Mileage</th>
137. <td bgcolor="#FFFFFF"><?php echo $row_Rsdetail['prodMileage']; ?></td>
138. </tr>
139. <tr>
140. <th scope="row">Ask Price:</th>
141. <td bgcolor="#FFFFFF"><?php echo $row_Rsdetail['prodAsk']; ?></td>
142. </tr>
143. <tr>
144. <th scope="row">Book Value:</th>
145. <td bgcolor="#FFFFFF"><?php echo $row_Rsdetail['prodBook']; ?></td>
146. </tr>
147. <tr>
148. <th scope="row">Color:</th>
149. <td bgcolor="#FFFFFF"><?php echo $row_Rsdetail['prodColor']; ?></td>
150. </tr>
151. <tr>
152. <th scope="row">Recon Value:</th>
153. <td bgcolor="#FFFFFF"><?php echo $row_Rsdetail['prodReconvalue']; ?></td>
154. </tr>
155. <tr>
156. <th scope="row">Recon Remarks:</th>
157. <td bgcolor="#FFFFFF"><?php echo $row_Rsdetail['prodReconremaks']; ?></td>
158. </tr>
159. <tr>
160. <th scope="row">Dealer ID:</th>
161. <td bgcolor="#FFFFFF"><?php echo $row_Rsdetail['dealerID']; ?></td>
162. </tr>
163. <tr>
164. <th scope="row">Dealer Name:</th>
165. <td bgcolor="#FFFFFF"><?php echo $row_Rsdetail['dealerName']; ?></td>
166. </tr>
167. <tr>
168. <th scope="row">Contact Person:</th>
169. <td bgcolor="#FFFFFF"><?php echo $row_Rsdetail['dealerContact']; ?></td>
170. </tr>
171. <tr>
172. <th scope="row">Phone Number:</th>
173. <td bgcolor="#FFFFFF"><?php echo $row_Rsdetail['dealerPhone']; ?></td>
174. </tr>
175. <tr>
176. <th scope="row">Cell Phone:</th>
177. <td bgcolor="#FFFFFF"><?php echo $row_Rsdetail['dealerCell']; ?></td>
178. </tr>
179. <tr>
180. <th scope="row">E Mail:</th>
181. <td bgcolor="#FFFFFF"><?php echo $row_Rsdetail['dealerEmail']; ?></td>
182. </tr>
183. <tr>
184. <th scope="row">City:</th>
185. <td bgcolor="#FFFFFF"><?php echo $row_Rsdetail['dealerCity']; ?></td>
186. </tr>
187. <tr>
188. <th scope="row">Province:</th>
189. <td bgcolor="#FFFFFF"><?php echo $row_Rsdetail['dealerProvince']; ?></td>
190. </tr>
191. <tr>
192. <th scope="row">&nbsp;</th>
193. <td bgcolor="#FFFFFF">&nbsp;</td>
194. </tr>
195. </table></td>
196. </tr>
197. </table>
198. <script type="text/javascript">
199. <!--
200. var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});
201. //-->
202. </script>
203. </body>
204. </html>
205. <?php
206. mysql_free_result($Rsdetail);
207. ?>
Thank you in advance for all help.

Last edited by edbr; 01-13-2010 at 12:15 AM..
the chosen one is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:31 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com