dereksheahan
asked on
Passing URL parameter problem
Hi all,
I have a page that is getting values from two url parameters from the previous page. The two parameters are Type_variable and model_variable. The model_variable works fine but for some reason the Type_variable always shows its result on the page as a value of 1. I'm thinking this might be something to do with the fact that the Type_variable has been used on other pages in the site as well. The Type_variable was also used on the previous page to get information for that page. I know the correct Type_variable is being passed because I can see it in the title bar. The result displayed on the page however is always a value of 1. Can anyone help?
Here's the code to the page:
Thanks,
Derek
<?php require_once('../Connectio ns/GSM_mob ile.php'); ?>
<?php
$colname_rsPostalApp = "-1";
if (isset($_GET['Type_variabl e'])) {
$colname_rsPostalApp = (get_magic_quotes_gpc()) ? $_GET['Type_variable'] : addslashes($_GET['Type_var iable']);
}
$colname2_rsPostalApp = "-1";
if (isset($_GET['model_variab le'])) {
$colname2_rsPostalApp = (get_magic_quotes_gpc()) ? $_GET['model_variable'] : addslashes($_GET['model_va riable']);
}
mysql_select_db($database_ GSM_mobile , $GSM_mobile);
$query_rsPostalApp = sprintf("SELECT mod_model_id, mod_model_name, mod_type_id, type_table.type_type_id, type_table.type_type_name FROM model_table, type_table WHERE mod_type_id = %s AND mod_model_id = %s", $colname_rsPostalApp,$coln ame2_rsPos talApp);
$rsPostalApp = mysql_query($query_rsPosta lApp, $GSM_mobile) or die(mysql_error());
$row_rsPostalApp = mysql_fetch_assoc($rsPosta lApp);
$totalRows_rsPostalApp = mysql_num_rows($rsPostalAp p);
?><!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>
<SCRIPT>
// connect this function as shown below to a form button
function showData (form) {
window.currentForm = form;
form.oldAction = form.action;
form.oldTarget = form.target;
form.oldMethod = form.method;
form.action = 'formPrintData.html';
form.target = 'formData' + new Date().getTime();
form.method = 'get';
open ('', form.target);
form.submit();
}
</SCRIPT>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
-->
</style>
</head>
<body>
<form id="form1" name="form1" method="post" action="postalprint.php">
<p>Please fill out the following form:</p>
<p>
<label>
<div align="center">Name
<input name="txt_username" type="text" id="txt_username" />
</div>
</label>
</p>
<p align="center">
<label>Return Address
<input name="txt_rtn_add" type="text" id="txt_rtn_add" value="" />
</label>
</p>
<p align="center">
<label>Postcode
<input name="txt_postcode" type="text" id="txt_postcode" />
</label>
</p>
<p align="center">
<label>Contact Number
<input name="txt_contact_nr" type="text" id="txt_contact_nr" />
</label>
</p>
<p align="center">
<label>Email Address
<input name="txt_email_add" type="text" id="txt_email_add" />
</label>
</p>
<p align="center">
<label>Phone Make
<input name="txt_phone_make" type="text" id="txt_phone_make" value="<?php echo $row_rsPostalApp['type_typ e_name']; ?>" />
</label>
</p>
<p align="center">
<label>Phone Model
<input name="txt_phone_mobile" type="text" id="txt_phone_mobile" value="<?php echo $row_rsPostalApp['mod_mode l_name']; ?>" />
</label>
</p>
<p align="center">
<label>IMEI Number (enter *#06# on your handset)
<input name="txt_IMEI_nr" type="text" id="txt_IMEI_nr" />
</label>
</p>
<p align="center">
<INPUT TYPE="button" VALUE="show data"
ONCLICK="showData(this.for m);"
>
</p>
<p> </p>
</form>
</body>
</html>
<?php
mysql_free_result($rsPosta lApp);
?>
I have a page that is getting values from two url parameters from the previous page. The two parameters are Type_variable and model_variable. The model_variable works fine but for some reason the Type_variable always shows its result on the page as a value of 1. I'm thinking this might be something to do with the fact that the Type_variable has been used on other pages in the site as well. The Type_variable was also used on the previous page to get information for that page. I know the correct Type_variable is being passed because I can see it in the title bar. The result displayed on the page however is always a value of 1. Can anyone help?
Here's the code to the page:
Thanks,
Derek
<?php require_once('../Connectio
<?php
$colname_rsPostalApp = "-1";
if (isset($_GET['Type_variabl
$colname_rsPostalApp = (get_magic_quotes_gpc()) ? $_GET['Type_variable'] : addslashes($_GET['Type_var
}
$colname2_rsPostalApp = "-1";
if (isset($_GET['model_variab
$colname2_rsPostalApp = (get_magic_quotes_gpc()) ? $_GET['model_variable'] : addslashes($_GET['model_va
}
mysql_select_db($database_
$query_rsPostalApp = sprintf("SELECT mod_model_id, mod_model_name, mod_type_id, type_table.type_type_id, type_table.type_type_name FROM model_table, type_table WHERE mod_type_id = %s AND mod_model_id = %s", $colname_rsPostalApp,$coln
$rsPostalApp = mysql_query($query_rsPosta
$row_rsPostalApp = mysql_fetch_assoc($rsPosta
$totalRows_rsPostalApp = mysql_num_rows($rsPostalAp
?><!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>
<SCRIPT>
// connect this function as shown below to a form button
function showData (form) {
window.currentForm = form;
form.oldAction = form.action;
form.oldTarget = form.target;
form.oldMethod = form.method;
form.action = 'formPrintData.html';
form.target = 'formData' + new Date().getTime();
form.method = 'get';
open ('', form.target);
form.submit();
}
</SCRIPT>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
-->
</style>
</head>
<body>
<form id="form1" name="form1" method="post" action="postalprint.php">
<p>Please fill out the following form:</p>
<p>
<label>
<div align="center">Name
<input name="txt_username" type="text" id="txt_username" />
</div>
</label>
</p>
<p align="center">
<label>Return Address
<input name="txt_rtn_add" type="text" id="txt_rtn_add" value="" />
</label>
</p>
<p align="center">
<label>Postcode
<input name="txt_postcode" type="text" id="txt_postcode" />
</label>
</p>
<p align="center">
<label>Contact Number
<input name="txt_contact_nr" type="text" id="txt_contact_nr" />
</label>
</p>
<p align="center">
<label>Email Address
<input name="txt_email_add" type="text" id="txt_email_add" />
</label>
</p>
<p align="center">
<label>Phone Make
<input name="txt_phone_make" type="text" id="txt_phone_make" value="<?php echo $row_rsPostalApp['type_typ
</label>
</p>
<p align="center">
<label>Phone Model
<input name="txt_phone_mobile" type="text" id="txt_phone_mobile" value="<?php echo $row_rsPostalApp['mod_mode
</label>
</p>
<p align="center">
<label>IMEI Number (enter *#06# on your handset)
<input name="txt_IMEI_nr" type="text" id="txt_IMEI_nr" />
</label>
</p>
<p align="center">
<INPUT TYPE="button" VALUE="show data"
ONCLICK="showData(this.for
>
</p>
<p> </p>
</form>
</body>
</html>
<?php
mysql_free_result($rsPosta
?>
ASKER
Sure,
If what it says in the URL when I pass to the above page (http://localhost/GSM/Postal/postalform.php?Type_variable=12&model_variable=360).
Here's what the URL is and the preceeding page:
(http://localhost/GSM/Postal/jasontester.php?Type_variable=12)
and here's the code to the preceeding page. Hope it helps.
<?php require_once('../Connectio ns/GSM_mob ile.php'); ?>
<?php require_once('../Connectio ns/GSM_mob ile.php'); ?>
<?php
$colname_rsPostalResults = "-1";
if (isset($_GET['Type_variabl e'])) {
$colname_rsPostalResults = (get_magic_quotes_gpc()) ? $_GET['Type_variable'] : addslashes($_GET['Type_var iable']);
}
mysql_select_db($database_ GSM_mobile , $GSM_mobile);
$query_rsPostalResults = sprintf("SELECT mod_model_id, mod_model_name, mod_type_id FROM model_table WHERE mod_type_id = %s", $colname_rsPostalResults);
$rsPostalResults = mysql_query($query_rsPosta lResults, $GSM_mobile) or die(mysql_error());
$row_rsPostalResults = mysql_fetch_assoc($rsPosta lResults);
$totalRows_rsPostalResults = mysql_num_rows($rsPostalRe sults);
$colname_rsgetimage = "-1";
if (isset($_GET['Type_variabl e'])) {
$colname_rsgetimage = (get_magic_quotes_gpc()) ? $_GET['Type_variable'] : addslashes($_GET['Type_var iable']);
}
mysql_select_db($database_ GSM_mobile , $GSM_mobile);
$query_rsgetimage = sprintf("SELECT type_type_id, type_type_name, image_src FROM type_table WHERE type_type_id = %s", $colname_rsgetimage);
$rsgetimage = mysql_query($query_rsgetim age, $GSM_mobile) or die(mysql_error());
$row_rsgetimage = mysql_fetch_assoc($rsgetim age);
$totalRows_rsgetimage = mysql_num_rows($rsgetimage );
?><!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>Untitled Document</title>
<style type="text/css">
<!--
.style1 {font-family: Arial, Helvetica, sans-serif}
.style2 {color: #993333}
#Layer1 {
left:11px;
top:188px;
width:417px;
height:auto;
z-index:1;
}
#Layer1 {
border: thin dotted #333333;
}
Pos {
overflow: visible;
}
#Layer2 {
width:683px;
clear: both;
float: none;
}
.style4 {color: #0000CC}
#Layer3 {
position:absolute;
left:10px;
top:38px;
width:377px;
height:89px;
z-index:1;
}
#Layer1 {
position: relative;
}
#Layer2 {
position: relative;
left: 13px;
top: 251px;
}
#Layer4 {
position:absolute;
left:16px;
top:146px;
width:323px;
height:37px;
z-index:2;
}
-->
</style>
</head>
<body>
<div id="Layer3"><img src="http://localhost/GSM/Images/<?php echo $row_rsgetimage['image_src ']; ?>" />Postal Unlock : </div>
<div id="Layer1">
<p><span class="style1 style4">
<?php do { ?>
<a href="postalform.php?Type_ variable=< ?php echo $row_rsPostalResults['mod_ type_id']; ?>&model_variable=<?ph p echo $row_rsPostalResults['mod_ model_id'] ; ?>"><?php echo $row_rsPostalResults['mod_ model_name ']; ?></a>
<?php } while ($row_rsPostalResults = mysql_fetch_assoc($rsPosta lResults)) ; ?>
</span></p>
</div>
<div id="Layer2">
<p><a href="postalmain.php">Sear ch again </a></p>
<p>If your phone model is not listed then please <a href="../support.php">cont act us</a> to make sure we can unlock your phone before sending.</p>
<p>Alternatively you can download our <a href="../Files/postal unlocking form.doc">postal contact form</a> and fill it in later. </p>
</div>
<div id="Layer4">The following is a list of models that we support. Click on your model to continue:</div>
<div>
<form id="form1" name="form1" method="post" action="">
<p> </p>
<p> </p>
<p class="style1 style2"> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
</form>
</div>
</body>
</html>
<?php
mysql_free_result($rsPosta lResults);
mysql_free_result($rsgetim age);
?>
If what it says in the URL when I pass to the above page (http://localhost/GSM/Postal/postalform.php?Type_variable=12&model_variable=360).
Here's what the URL is and the preceeding page:
(http://localhost/GSM/Postal/jasontester.php?Type_variable=12)
and here's the code to the preceeding page. Hope it helps.
<?php require_once('../Connectio
<?php require_once('../Connectio
<?php
$colname_rsPostalResults = "-1";
if (isset($_GET['Type_variabl
$colname_rsPostalResults = (get_magic_quotes_gpc()) ? $_GET['Type_variable'] : addslashes($_GET['Type_var
}
mysql_select_db($database_
$query_rsPostalResults = sprintf("SELECT mod_model_id, mod_model_name, mod_type_id FROM model_table WHERE mod_type_id = %s", $colname_rsPostalResults);
$rsPostalResults = mysql_query($query_rsPosta
$row_rsPostalResults = mysql_fetch_assoc($rsPosta
$totalRows_rsPostalResults
$colname_rsgetimage = "-1";
if (isset($_GET['Type_variabl
$colname_rsgetimage = (get_magic_quotes_gpc()) ? $_GET['Type_variable'] : addslashes($_GET['Type_var
}
mysql_select_db($database_
$query_rsgetimage = sprintf("SELECT type_type_id, type_type_name, image_src FROM type_table WHERE type_type_id = %s", $colname_rsgetimage);
$rsgetimage = mysql_query($query_rsgetim
$row_rsgetimage = mysql_fetch_assoc($rsgetim
$totalRows_rsgetimage = mysql_num_rows($rsgetimage
?><!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>Untitled Document</title>
<style type="text/css">
<!--
.style1 {font-family: Arial, Helvetica, sans-serif}
.style2 {color: #993333}
#Layer1 {
left:11px;
top:188px;
width:417px;
height:auto;
z-index:1;
}
#Layer1 {
border: thin dotted #333333;
}
Pos {
overflow: visible;
}
#Layer2 {
width:683px;
clear: both;
float: none;
}
.style4 {color: #0000CC}
#Layer3 {
position:absolute;
left:10px;
top:38px;
width:377px;
height:89px;
z-index:1;
}
#Layer1 {
position: relative;
}
#Layer2 {
position: relative;
left: 13px;
top: 251px;
}
#Layer4 {
position:absolute;
left:16px;
top:146px;
width:323px;
height:37px;
z-index:2;
}
-->
</style>
</head>
<body>
<div id="Layer3"><img src="http://localhost/GSM/Images/<?php echo $row_rsgetimage['image_src
<div id="Layer1">
<p><span class="style1 style4">
<?php do { ?>
<a href="postalform.php?Type_
<?php } while ($row_rsPostalResults = mysql_fetch_assoc($rsPosta
</span></p>
</div>
<div id="Layer2">
<p><a href="postalmain.php">Sear
<p>If your phone model is not listed then please <a href="../support.php">cont
<p>Alternatively you can download our <a href="../Files/postal unlocking form.doc">postal contact form</a> and fill it in later. </p>
</div>
<div id="Layer4">The following is a list of models that we support. Click on your model to continue:</div>
<div>
<form id="form1" name="form1" method="post" action="">
<p> </p>
<p> </p>
<p class="style1 style2"> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
</form>
</div>
</body>
</html>
<?php
mysql_free_result($rsPosta
mysql_free_result($rsgetim
?>
Well, crap. This looks okay too.
A long time ago, someone once told me that the way DW writes queries is odd. I wonder if using sprintf and %s isn't screwing you up somehow...
I'm going to take some time to play with my son, then I'll play with this code. In the meantime, post a 20 point pointer question in the PHP area and ask some real PHP pros to look at this. Something is not quite right, but I can't put my finger on it...
A long time ago, someone once told me that the way DW writes queries is odd. I wonder if using sprintf and %s isn't screwing you up somehow...
I'm going to take some time to play with my son, then I'll play with this code. In the meantime, post a 20 point pointer question in the PHP area and ask some real PHP pros to look at this. Something is not quite right, but I can't put my finger on it...
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Its telling me I have an error in my SQL syntax when I change it to this. (You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1) I think I've put it in the right place?
<?php require_once('../Connectio ns/GSM_mob ile.php'); ?>
<?php
$colname_rsPostalApp = "-1";
if (isset($_GET['Type_variabl e'])) {
$colname_rsPostalApp = (get_magic_quotes_gpc()) ? $_GET['Type_variable'] : addslashes($_GET['Type_var iable']);
}
$colname2_rsPostalApp = "-1";
if (isset($_GET['model_variab le'])) {
$colname2_rsPostalApp = (get_magic_quotes_gpc()) ? $_GET['model_variable'] : addslashes($_GET['model_va riable']);
}
mysql_select_db($database_ GSM_mobile , $GSM_mobile);
$query_rsPostalApp = "SELECT mod_model_id, mod_model_name, mod_type_id, type_table.type_type_id, type_table.type_type_name FROM model_table, type_table WHERE mod_type_id = $colname_rsPostalApp AND mod_model_id = $colname2_rs_PostalApp";
$rsPostalApp = mysql_query($query_rsPosta lApp, $GSM_mobile) or die(mysql_error());
$row_rsPostalApp = mysql_fetch_assoc($rsPosta lApp);
$totalRows_rsPostalApp = mysql_num_rows($rsPostalAp p);
?><!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>
<SCRIPT>
// connect this function as shown below to a form button
function showData (form) {
window.currentForm = form;
form.oldAction = form.action;
form.oldTarget = form.target;
form.oldMethod = form.method;
form.action = 'formPrintData.html';
form.target = 'formData' + new Date().getTime();
form.method = 'get';
open ('', form.target);
form.submit();
}
</SCRIPT>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
-->
</style>
</head>
<body>
<form id="form1" name="form1" method="post" action="postalprint.php">
<p>Please fill out the following form:</p>
<p>
<label>
<div align="center">Name
<input name="txt_username" type="text" id="txt_username" />
</label>
<p align="center">
<label>Return Address
<input name="txt_rtn_add" type="text" id="txt_rtn_add" value="" />
</label>
</p>
<p align="center">
<label>Postcode
<input name="txt_postcode" type="text" id="txt_postcode" />
</label>
</p>
<p align="center">
<label>Contact Number
<input name="txt_contact_nr" type="text" id="txt_contact_nr" />
</label>
</p>
<p align="center">
<label>Email Address
<input name="txt_email_add" type="text" id="txt_email_add" />
</label>
</p>
<p align="center">
<label>Phone Make
<input name="txt_phone_make" type="text" id="txt_phone_make" value="<?php echo $row_rsPostalApp['type_typ e_name']; ?>" />
</label>
</p>
<p align="center">
<label>Phone Model
<input name="txt_phone_mobile" type="text" id="txt_phone_mobile" value="<?php echo $row_rsPostalApp['mod_mode l_name']; ?>" />
</label>
</p>
<p align="center">
<label>IMEI Number (enter *#06# on your handset)
<input name="txt_IMEI_nr" type="text" id="txt_IMEI_nr" />
</label>
</p>
<p align="center">
<INPUT TYPE="button" VALUE="show data"
ONCLICK="showData(this.for m);"
>
</p>
<p> </p>
</form>
</body>
</html>
<?php
mysql_free_result($rsPosta lApp);
?>
<?php require_once('../Connectio
<?php
$colname_rsPostalApp = "-1";
if (isset($_GET['Type_variabl
$colname_rsPostalApp = (get_magic_quotes_gpc()) ? $_GET['Type_variable'] : addslashes($_GET['Type_var
}
$colname2_rsPostalApp = "-1";
if (isset($_GET['model_variab
$colname2_rsPostalApp = (get_magic_quotes_gpc()) ? $_GET['model_variable'] : addslashes($_GET['model_va
}
mysql_select_db($database_
$query_rsPostalApp = "SELECT mod_model_id, mod_model_name, mod_type_id, type_table.type_type_id, type_table.type_type_name FROM model_table, type_table WHERE mod_type_id = $colname_rsPostalApp AND mod_model_id = $colname2_rs_PostalApp";
$rsPostalApp = mysql_query($query_rsPosta
$row_rsPostalApp = mysql_fetch_assoc($rsPosta
$totalRows_rsPostalApp = mysql_num_rows($rsPostalAp
?><!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>
<SCRIPT>
// connect this function as shown below to a form button
function showData (form) {
window.currentForm = form;
form.oldAction = form.action;
form.oldTarget = form.target;
form.oldMethod = form.method;
form.action = 'formPrintData.html';
form.target = 'formData' + new Date().getTime();
form.method = 'get';
open ('', form.target);
form.submit();
}
</SCRIPT>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
-->
</style>
</head>
<body>
<form id="form1" name="form1" method="post" action="postalprint.php">
<p>Please fill out the following form:</p>
<p>
<label>
<div align="center">Name
<input name="txt_username" type="text" id="txt_username" />
</label>
<p align="center">
<label>Return Address
<input name="txt_rtn_add" type="text" id="txt_rtn_add" value="" />
</label>
</p>
<p align="center">
<label>Postcode
<input name="txt_postcode" type="text" id="txt_postcode" />
</label>
</p>
<p align="center">
<label>Contact Number
<input name="txt_contact_nr" type="text" id="txt_contact_nr" />
</label>
</p>
<p align="center">
<label>Email Address
<input name="txt_email_add" type="text" id="txt_email_add" />
</label>
</p>
<p align="center">
<label>Phone Make
<input name="txt_phone_make" type="text" id="txt_phone_make" value="<?php echo $row_rsPostalApp['type_typ
</label>
</p>
<p align="center">
<label>Phone Model
<input name="txt_phone_mobile" type="text" id="txt_phone_mobile" value="<?php echo $row_rsPostalApp['mod_mode
</label>
</p>
<p align="center">
<label>IMEI Number (enter *#06# on your handset)
<input name="txt_IMEI_nr" type="text" id="txt_IMEI_nr" />
</label>
</p>
<p align="center">
<INPUT TYPE="button" VALUE="show data"
ONCLICK="showData(this.for
>
</p>
<p> </p>
</form>
</body>
</html>
<?php
mysql_free_result($rsPosta
?>
try to print your data to the page to debug stuff, e.g. echo Type_variable, and echo your query string to see what your feeding mySQL, believe me, it helps a big time!!
Change it back to the DW style and go with Dr_dedo's suggestion and post back...
ASKER
So.. I tried the following statements at the end of the page.
<?php
echo $Type_variable;
echo $query_rsPostalApp;
?>
The first one Type_variable doesn't seem to return anything no matter what I try. (I also tried echo Type_variable;)
Am I writing it correctly.
The second statement seems to return a correct result:
Printed on the end of the screen is:
SELECT mod_model_id, mod_model_name, mod_type_id, type_table.type_type_id, type_table.type_type_name FROM model_table, type_table WHERE mod_type_id = 12 AND mod_model_id = 316
<?php
echo $Type_variable;
echo $query_rsPostalApp;
?>
The first one Type_variable doesn't seem to return anything no matter what I try. (I also tried echo Type_variable;)
Am I writing it correctly.
The second statement seems to return a correct result:
Printed on the end of the screen is:
SELECT mod_model_id, mod_model_name, mod_type_id, type_table.type_type_id, type_table.type_type_name FROM model_table, type_table WHERE mod_type_id = 12 AND mod_model_id = 316
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks tried that and it gives the right result every time. Think I might have a better idea what the problem is. The recordset is returning the first value from the database (i.e. with a Type_variable of 1). Therefore it is probably trying all of the Type_variables to the text_box (which is the problem area where I want the Type_variable result to be displayed). Also, not sure if ye got this from the code but I'm trying to print the model_name and not the Type_variable. I'm only using the Type_variable parameter to filter the recordset. Not sure if I'm making perfect sense :)
ASKER
Yeah, just tested it there again. If I put the mod_type_id instead of the mod_type_name in the text field it displays the correct result. Therefore the problem has something to do with the connectivity between the mod_type_name and the mod_type_id??
ASKER
Got it sorted!!! I added another parameter to the SQL statement that linked the tables better. Changed the statement to look like this:
SELECT mod_model_id, mod_model_name, mod_type_id, type_table.type_type_id, type_table.type_type_name, type_table.type_type_id
FROM model_table, type_table
WHERE mod_type_id = colname AND mod_model_id = colname2 AND mod_type_id = type_type_id
Thanks so much for all the help guys!
SELECT mod_model_id, mod_model_name, mod_type_id, type_table.type_type_id, type_table.type_type_name,
FROM model_table, type_table
WHERE mod_type_id = colname AND mod_model_id = colname2 AND mod_type_id = type_type_id
Thanks so much for all the help guys!
You're welcome.
How close are you to being done with this? I'd love to see the live version...
How close are you to being done with this? I'd love to see the live version...
ASKER
Yeah I'd love to see the live version as well! Think about one more week or so and it should be ready to put something up. Don't worry you'll be the first to know about it :) This is my first project since I finished college course a few years back so I'm quite rusty, thus all the questions!.
( Don't know if you had a chance to have a look at that dynamic drop-down problem since yesterday? https://www.experts-exchange.com/questions/21841380/Dynamically-Linked-drop-down-problem.html Can't seem to make sense of it at all! If you're too busy not a bother, I'll keep hacking away at it. anyways :)
( Don't know if you had a chance to have a look at that dynamic drop-down problem since yesterday? https://www.experts-exchange.com/questions/21841380/Dynamically-Linked-drop-down-problem.html Can't seem to make sense of it at all! If you're too busy not a bother, I'll keep hacking away at it. anyways :)
Vallenwood is helping you there, so I am taking a backseat out of courtesy to him.
ASKER
No probs at all!
Can you post the page code from the page preceeding this one and also the query string (the part of the URL after the ?).
As far as I can see, this code is correct. However, where is the echo call to Type_variable?