Jump to content


Photo

Record Set Issue


  • Please log in to reply
1 reply to this topic

#1 homchz

homchz
  • Members
  • PipPipPip
  • Advanced Member
  • 93 posts
  • LocationLee, New Hampshire

Posted 28 January 2004 - 05:13 PM

I have a record set of a SQL query

the query looks like this:

SELECT C.equipmentaccount,
C.company_name,
C.address,
C.city,
C.zip_code,
C.phone_number,
E.make,
E.modelnumber,
E.serialnumber,
E.deliverydate,
C.state,
C.contact_name,
C.account_type,
C.email,
C.fax_number,
C.phone_number2,
C.partsaccount
FROM customer_info C
LEFT
JOIN equipment E
ON (E.equipaccount = C.equipmentaccount)
WHERE
(
(C.phone_number = '603-448-1134')
)

It works in great in a query builder, and works fine when I use the query as written in DMX2004
but what I want to do is have the WHERE command entered in a search field.

I am pulling information from two tables in one database. When I am done with the PHP code and query it looks like this.



$colname_Recordset1 = "1";
if (isset($_POST['Eaccount'])) {
$colname_Recordset1 = (get_magic_quotes_gpc()) ? $_POST['Eaccount'] : addslashes($_POST['Eaccount']);
}
mysql_select_db($database_connCustomerInfo, $connCustomerInfo);
$query_Recordset1 = sprintf("SELECT C.equipmentaccount,
C.company_name,
C.address,
C.city,
C.zip_code,
C.phone_number,
E.make,
E.modelnumber,
E.serialnumber,
E.deliverydate,
C.state,
C.contact_name,
C.account_type,
C.email,
C.fax_number,
C.phone_number2,
C.partsaccount
FROM customer_info C
LEFT JOIN equipment E ON (E.equipaccount = C.equipmentaccount)
WHERE C.equipmentaccount = '%s' ", $colname_Recordset1);
$Recordset1 = mysql_query($query_Recordset1, $connCustomerInfo) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);

While this works great WHEN the customer has equipment to find, but if there is nothing in the equipment table for the searched customer it displays nothing.

Any help would be appreciated.
Josh


#2 homchz

homchz
  • Members
  • PipPipPip
  • Advanced Member
  • 93 posts
  • LocationLee, New Hampshire

Posted 28 January 2004 - 07:30 PM

Nevermind fixed my issue. :rolleyes:

If you are having problems with record sets in DMX2004 not acting like they should be sure you are syncronizing your site to the testing server. :rolleyes:

It was not untill I deleted everything and notice the behavors still worked on test that I figured it out. Posted Image




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users