Jump to content

Recommended Posts

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

 

Link to comment
https://forums.phpfreaks.com/topic/1636-record-set-issue/
Share on other sites

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. banghead.gif

Link to comment
https://forums.phpfreaks.com/topic/1636-record-set-issue/#findComment-5374
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.