Forgive the coding, i'm just creating the page and it's all gone wrong.....
here is the PHP script...
basically, URL search variables are passed to this file.... so thats what all the IF ISSET and GETs are for
I'm using SPRINTF function to build the sql SELECT statement.
I created the original code in dreamweaver just with the one WHERE item in the SELECT statement, However I want to search by all the ones I've listed above.
When loaded, the URL parameters are passed to the page but the page is totally blank dispite the original having a table repeat reagon and their is nothing in the resultant HTML code as shown below.
The full code is below....
Can someone tell me what I've done wrong please, I've been trying to track this down for hours.
Thanks
here is the PHP script...
<?php
$colname1_customer_search = "";
if (isset($_GET['Customer_ID'])) {
$colname1_customer_search = (get_magic_quotes_gpc()) ? $_GET['Customer_ID'] : addslashes($_GET['Customer_ID']);
}
$colname2_customer_search = "";
if (isset($_GET['Customer_Salutation'])) {
$colname2_customer_search = (get_magic_quotes_gpc()) ? $_GET['Customer_Salutation'] : addslashes($_GET['Customer_Salutation']);
}
$colname3_customer_search = "";
if (isset($_GET['Customer_initials'])) {
$colname3_customer_search = (get_magic_quotes_gpc()) ? $_GET['Customer_initials'] : addslashes($_GET['Customer_initials']);
}
$colname4_customer_search = "";
if (isset($_GET['Customer_Surname'])) {
$colname4_customer_search = (get_magic_quotes_gpc()) ? $_GET['Customer_Surname'] : addslashes($_GET['Customer_Surname']);
}
$colname5_customer_search = "";
if (isset($_GET['Customer_Address1'])) {
$colname5_customer_search = (get_magic_quotes_gpc()) ? $_GET['Customer_Address1'] : addslashes($_GET['Customer_Address1']);
}
$colname6_customer_search = "";
if (isset($_GET['Customer_Address2'])) {
$colname6_customer_search = (get_magic_quotes_gpc()) ? $_GET['Customer_Address2'] : addslashes($_GET['Customer_Address2']);
}
$colname7_customer_search = "";
if (isset($_GET['Customer_Address3'])) {
$colname7_customer_search = (get_magic_quotes_gpc()) ? $_GET['Customer_Address3'] : addslashes($_GET['Customer_Address3']);
}
$colname8_customer_search = "";
if (isset($_GET['Customer_Address4'])) {
$colname8_customer_search = (get_magic_quotes_gpc()) ? $_GET['Customer_Address4'] : addslashes($_GET['Customer_Address4']);
}
$colname9_customer_search = "";
if (isset($_GET['Customer_Address5'])) {
$colname9_customer_search = (get_magic_quotes_gpc()) ? $_GET['Customer_Address5'] : addslashes($_GET['Customer_Address5']);
}
$colname10_customer_search = "";
if (isset($_GET['Customer_Country'])) {
$colname10_customer_search = (get_magic_quotes_gpc()) ? $_GET['Customer_Country'] : addslashes($_GET['Customer_Country']);
}
$colname11_customer_search = "";
if (isset($_GET['Post_Code'])) {
$colname11_customer_search = (get_magic_quotes_gpc()) ? $_GET['Post_Code'] : addslashes($_GET['Post_Code']);
}
$colname12_customer_search = "";
if (isset($_GET['Phone_Number'])) {
$colname12_customer_search = (get_magic_quotes_gpc()) ? $_GET['Phone_Number'] : addslashes($_GET['Phone_Number']);
}
$colname13_customer_search = "";
if (isset($_GET['Phone_Extension'])) {
$colname13_customer_search = (get_magic_quotes_gpc()) ? $_GET['Phone_Extension'] : addslashes($_GET['Phone_Extension']);
}
$colname14_customer_search = "";
if (isset($_GET['Referral_Number'])) {
$colname14_customer_search = (get_magic_quotes_gpc()) ? $_GET['Referral_Number'] : addslashes($_GET['Referral_Number']);
}
$colname15_customer_search = "";
if (isset($_GET['Referral_Paid'])) {
$colname15_customer_search = (get_magic_quotes_gpc()) ? $_GET['Referral_Paid'] : addslashes($_GET['Referral_Paid']);
}
$colname16_customer_search = "";
if (isset($_GET['Referral_printed'])) {
$colname16_customer_search = (get_magic_quotes_gpc()) ? $_GET['Referral_printed'] : addslashes($_GET['Referral_printed']);
}
$colname17_customer_search = "";
if (isset($_GET['Phone_Pad'])) {
$colname17_customer_search = (get_magic_quotes_gpc()) ? $_GET['Phone_Pad'] : addslashes($_GET['Phone_Pad']);
}
$colname18_customer_search = "";
if (isset($_GET['DOB'])) {
$colname18_customer_search = (get_magic_quotes_gpc()) ? $_GET['DOB'] : addslashes($_GET['DOB']);
}
$colname19_customer_search = "";
if (isset($_GET['AMCATID'])) {
$colname19_customer_search = (get_magic_quotes_gpc()) ? $_GET['AMCATID'] : addslashes($_GET['AMCATID']);
}
mysql_select_db($database_localhost, $localhost);
$query_customer_search = sprintf("SELECT * FROM CUSTOMER WHERE customer_id = %s, customer_salutation = %s, customer_initials = %s, customer_surname = %s, customer_address1 = %s, customer_address2 = %s, customer_address3 = %s, customer_address4 = %s, customer_address5 = %s, customer_country = %s, customer_postcode = %s, customer_phone_number = %s, customer_phone_Ex_or_nolist = %s, customer_referral_number = %s, customer_referral_paid = %s, customer_referral_printed = %s, Customer_Phone_Pad = %s, DOB = %s, AMCATID = %s ORDER BY customer_id ASC", $colname1_customer_search, $colname2_customer_search, $colname3_customer_search, $colname4_customer_search, $colname5_customer_search, $colname6_customer_search, $colname7_customer_search, $colname8_customer_search, $colname9_customer_search, $colname10_customer_search, $colname11_customer_search, $colname12_customer_search, $colname13_customer_search, $colname14_customer_search, $colname15_customer_search, $colname16_customer_search, $colname17_customer_search, $colname18_customer_search, $colname19_customer_search);
$customer_search = mysql_query($query_customer_search, $localhost) or die(mysql_error());
$row_customer_search = mysql_fetch_assoc($customer_search);
$totalRows_customer_search = mysql_num_rows($customer_search);
?>
basically, URL search variables are passed to this file.... so thats what all the IF ISSET and GETs are for
I'm using SPRINTF function to build the sql SELECT statement.
I created the original code in dreamweaver just with the one WHERE item in the SELECT statement, However I want to search by all the ones I've listed above.
When loaded, the URL parameters are passed to the page but the page is totally blank dispite the original having a table repeat reagon and their is nothing in the resultant HTML code as shown below.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252"></HEAD>
<BODY></BODY></HTML>
The full code is below....
<?php
$colname1_customer_search = "";
if (isset($_GET['Customer_ID'])) {
$colname1_customer_search = (get_magic_quotes_gpc()) ? $_GET['Customer_ID'] : addslashes($_GET['Customer_ID']);
}
$colname2_customer_search = "";
if (isset($_GET['Customer_Salutation'])) {
$colname2_customer_search = (get_magic_quotes_gpc()) ? $_GET['Customer_Salutation'] : addslashes($_GET['Customer_Salutation']);
}
$colname3_customer_search = "";
if (isset($_GET['Customer_initials'])) {
$colname3_customer_search = (get_magic_quotes_gpc()) ? $_GET['Customer_initials'] : addslashes($_GET['Customer_initials']);
}
$colname4_customer_search = "";
if (isset($_GET['Customer_Surname'])) {
$colname4_customer_search = (get_magic_quotes_gpc()) ? $_GET['Customer_Surname'] : addslashes($_GET['Customer_Surname']);
}
$colname5_customer_search = "";
if (isset($_GET['Customer_Address1'])) {
$colname5_customer_search = (get_magic_quotes_gpc()) ? $_GET['Customer_Address1'] : addslashes($_GET['Customer_Address1']);
}
$colname6_customer_search = "";
if (isset($_GET['Customer_Address2'])) {
$colname6_customer_search = (get_magic_quotes_gpc()) ? $_GET['Customer_Address2'] : addslashes($_GET['Customer_Address2']);
}
$colname7_customer_search = "";
if (isset($_GET['Customer_Address3'])) {
$colname7_customer_search = (get_magic_quotes_gpc()) ? $_GET['Customer_Address3'] : addslashes($_GET['Customer_Address3']);
}
$colname8_customer_search = "";
if (isset($_GET['Customer_Address4'])) {
$colname8_customer_search = (get_magic_quotes_gpc()) ? $_GET['Customer_Address4'] : addslashes($_GET['Customer_Address4']);
}
$colname9_customer_search = "";
if (isset($_GET['Customer_Address5'])) {
$colname9_customer_search = (get_magic_quotes_gpc()) ? $_GET['Customer_Address5'] : addslashes($_GET['Customer_Address5']);
}
$colname10_customer_search = "";
if (isset($_GET['Customer_Country'])) {
$colname10_customer_search = (get_magic_quotes_gpc()) ? $_GET['Customer_Country'] : addslashes($_GET['Customer_Country']);
}
$colname11_customer_search = "";
if (isset($_GET['Post_Code'])) {
$colname11_customer_search = (get_magic_quotes_gpc()) ? $_GET['Post_Code'] : addslashes($_GET['Post_Code']);
}
$colname12_customer_search = "";
if (isset($_GET['Phone_Number'])) {
$colname12_customer_search = (get_magic_quotes_gpc()) ? $_GET['Phone_Number'] : addslashes($_GET['Phone_Number']);
}
$colname13_customer_search = "";
if (isset($_GET['Phone_Extension'])) {
$colname13_customer_search = (get_magic_quotes_gpc()) ? $_GET['Phone_Extension'] : addslashes($_GET['Phone_Extension']);
}
$colname14_customer_search = "";
if (isset($_GET['Referral_Number'])) {
$colname14_customer_search = (get_magic_quotes_gpc()) ? $_GET['Referral_Number'] : addslashes($_GET['Referral_Number']);
}
$colname15_customer_search = "";
if (isset($_GET['Referral_Paid'])) {
$colname15_customer_search = (get_magic_quotes_gpc()) ? $_GET['Referral_Paid'] : addslashes($_GET['Referral_Paid']);
}
$colname16_customer_search = "";
if (isset($_GET['Referral_printed'])) {
$colname16_customer_search = (get_magic_quotes_gpc()) ? $_GET['Referral_printed'] : addslashes($_GET['Referral_printed']);
}
$colname17_customer_search = "";
if (isset($_GET['Phone_Pad'])) {
$colname17_customer_search = (get_magic_quotes_gpc()) ? $_GET['Phone_Pad'] : addslashes($_GET['Phone_Pad']);
}
$colname18_customer_search = "";
if (isset($_GET['DOB'])) {
$colname18_customer_search = (get_magic_quotes_gpc()) ? $_GET['DOB'] : addslashes($_GET['DOB']);
}
$colname19_customer_search = "";
if (isset($_GET['AMCATID'])) {
$colname19_customer_search = (get_magic_quotes_gpc()) ? $_GET['AMCATID'] : addslashes($_GET['AMCATID']);
}
mysql_select_db($database_localhost, $localhost);
$query_customer_search = sprintf("SELECT * FROM CUSTOMER WHERE customer_id = %s, customer_salutation = %s, customer_initials = %s, customer_surname = %s, customer_address1 = %s, customer_address2 = %s, customer_address3 = %s, customer_address4 = %s, customer_address5 = %s, customer_country = %s, customer_postcode = %s, customer_phone_number = %s, customer_phone_Ex_or_nolist = %s, customer_referral_number = %s, customer_referral_paid = %s, customer_referral_printed = %s, Customer_Phone_Pad = %s, DOB = %s, AMCATID = %s ORDER BY customer_id ASC", $colname1_customer_search, $colname2_customer_search, $colname3_customer_search, $colname4_customer_search, $colname5_customer_search, $colname6_customer_search, $colname7_customer_search, $colname8_customer_search, $colname9_customer_search, $colname10_customer_search, $colname11_customer_search, $colname12_customer_search, $colname13_customer_search, $colname14_customer_search, $colname15_customer_search, $colname16_customer_search, $colname17_customer_search, $colname18_customer_search, $colname19_customer_search);
$customer_search = mysql_query($query_customer_search, $localhost) or die(mysql_error());
$row_customer_search = mysql_fetch_assoc($customer_search);
$totalRows_customer_search = mysql_num_rows($customer_search);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Search Results</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<p>Number Of Records: <?php echo $totalRows_customer_search; ?><br>
<?php echo $colname1_customer_search ?></p>
<table border="1">
<tr>
<td>customer_id</td>
<td>customer_salutation</td>
<td>customer_initials</td>
<td>customer_surname</td>
<td>customer_address1</td>
<td>customer_address2</td>
<td>customer_address3</td>
<td>customer_address4</td>
<td>customer_address5</td>
<td>customer_country</td>
<td>customer_postcode</td>
<td>customer_phone_number</td>
<td>customer_phone_Ex_or_nolist</td>
<td>customer_referral_number</td>
<td>customer_referral_paid</td>
<td>customer_referral_printed</td>
<td>Customer_Phone_Pad</td>
<td>DOB</td>
<td>User1</td>
<td>User2</td>
<td>User3</td>
<td>User4</td>
<td>AMCATID</td>
</tr>
<?php do { ?>
<tr>
<td><?php echo $row_customer_search['customer_id']; ?></td>
<td><?php echo $row_customer_search['customer_salutation']; ?></td>
<td><?php echo $row_customer_search['customer_initials']; ?></td>
<td><?php echo $row_customer_search['customer_surname']; ?></td>
<td><?php echo $row_customer_search['customer_address1']; ?></td>
<td><?php echo $row_customer_search['customer_address2']; ?></td>
<td><?php echo $row_customer_search['customer_address3']; ?></td>
<td><?php echo $row_customer_search['customer_address4']; ?></td>
<td><?php echo $row_customer_search['customer_address5']; ?></td>
<td><?php echo $row_customer_search['customer_country']; ?></td>
<td><?php echo $row_customer_search['customer_postcode']; ?></td>
<td><?php echo $row_customer_search['customer_phone_number']; ?></td>
<td><?php echo $row_customer_search['customer_phone_Ex_or_nolist']; ?></td>
<td><?php echo $row_customer_search['customer_referral_number']; ?></td>
<td><?php echo $row_customer_search['customer_referral_paid']; ?></td>
<td><?php echo $row_customer_search['customer_referral_printed']; ?></td>
<td><?php echo $row_customer_search['Customer_Phone_Pad']; ?></td>
<td><?php echo $row_customer_search['DOB']; ?></td>
<td><?php echo $row_customer_search['User1']; ?></td>
<td><?php echo $row_customer_search['User2']; ?></td>
<td><?php echo $row_customer_search['User3']; ?></td>
<td><?php echo $row_customer_search['User4']; ?></td>
<td><?php echo $row_customer_search['AMCATID']; ?></td>
</tr>
<?php } while ($row_customer_search = mysql_fetch_assoc($customer_search)); ?>
</table>
</body>
</html>
<?php
mysql_free_result($customer_search);
?>
Can someone tell me what I've done wrong please, I've been trying to track this down for hours.
Thanks