i trying to read data from quite a few tables.. Now the statement works well except when i include the where e.equipmentLocationID = l.equipmentLocationID AND e.cabinetID = c.cabinetID AND e.equipmentOsID= osy.equipmentOsID AND e.equipmentServiceLevelID = s.equipmentServiceLevelID AND e.equipmentTypeID = eq.equipmentTypeID . But i need to include since the output i want is not the ID but the field.
I am using PHP... -
$query = "select e.equipmentName, e.equipmentSerTagNum,l.location,c.name , osy.osName , s.type, e.hardwareDescription,e.macAddress,e.rackNum, eq.type,e.hostServerName,e.updatedDate,e.warrantyStartDate, e.warrantyEndDate ,e.equipmentBrand,e.equipmentApplication
-
from equipmentInfo as e, equipmentLocation as l, cabinet as c, os as osy ,serviceLevelType as s, equipmentType as eq
-
-
where e.equipmentLocationID = l.equipmentLocationID AND e.cabinetID = c.cabinetID AND e.equipmentOsID= osy.equipmentOsID AND e.equipmentServiceLevelID = s.equipmentServiceLevelID AND e.equipmentTypeID = eq.equipmentTypeID
-
-
And e.equipmentName like \"%$trimmed%\" or e.equipmentSerTagNum like \"%$trimmed%\"
-
order by e.equipmentName";
-
-
-
7 1169
Do you get an error, and which one, or is the SQL statement executed without taking the WHERE clause ? Do you have a [php]or die("error ".mysql_error());[/php] to catch errors? If not surre show the PHP mysql_* command used.
Ronald
-
connect();
-
-
-
// Build SQL Query
-
-
$query = "select e.equipmentName, e.equipmentSerTagNum,l.location,c.name , osy.osName , s.type, e.hardwareDescription,e.macAddress,e.rackNum, eq.type,e.hostServerName,e.updatedDate,e.warrantyStartDate, e.warrantyEndDate ,e.equipmentBrand,e.equipmentApplication
-
from equipmentInfo as e, equipmentLocation as l, cabinet as c, os as osy ,serviceLevelType as s, equipmentType as eq
-
-
where e.equipmentLocationID = l.equipmentLocationID AND e.cabinetID = c.cabinetID AND e.equipmentOsID= osy.equipmentOsID AND e.equipmentServiceLevelID = s.equipmentServiceLevelID AND e.equipmentTypeID = eq.equipmentTypeID
-
-
AND e.equipmentName like \"%$trimmed%\" or e.equipmentSerTagNum like \"%$trimmed%\"
-
order by e.equipmentName" or die("error".mysql_error());
-
-
-
$numresults=mysql_query($query);
-
-
So?? see my last post. Do you get an error or is the statement just executed without anything returning?
Ronald
So?? see my last post. Do you get an error or is the statement just executed without anything returning?
Ronald
it executed without anything returning
So the statement is correct and working. To me it looks like there is no database result to be returned from that statetement.
Ronald
i getting results without the following statement. -
where e.equipmentLocationID = l.equipmentLocationID AND e.cabinetID = c.cabinetID AND e.equipmentOsID= osy.equipmentOsID AND e.equipmentServiceLevelID = s.equipmentServiceLevelID AND e.equipmentTypeID = eq.equipmentTypeID
-
but i need to include it for the outpuit i looking for..
whenever i include it returns nothing...
Then NOTHING matches that where clause. The combination of these restrictions is not there.
When you are pertinent that there must be a result, then do some debugging.
Have you tried to issue the WHERE clause with fewer restrictions? Like starting with the first one and see what is returned. If anything is returned, gradually expand the where clause until it returns nothing?
Ronald
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Robert Mark Bram |
last post by:
Hi All!
I have the following two methods in an asp/jscript page - my problem is that
without the update statement there is no error, but with the update
statement I get the following error:
...
|
by: James E Koehler |
last post by:
I can't get the WHILE statement to work in MySQL.
The version of MySQL that I am using is:
Ver 12.16 Distrib 4.0.6-gamma, for Win95/Win98 (i32)
running on Windows MX.
Here is the relevant...
|
by: Little PussyCat |
last post by:
Hello,
I hope you can help me.
We have a SQL Server 2000 database at work, (which works with a VB6
frontend) which grew to a considerable size, so one of my past colleagues
sent me this...
|
by: WindAndWaves |
last post by:
Hi Team
The function below searches all the tables in a database. However, if
subsearch = true then it searches all the objects listed in a recordset
(which are all table names).
I thought to...
|
by: Scott C. Reynolds |
last post by:
In VB6 you could do a SELECT CASE that would evaluate each case for
truth and execute those statements, such as:
SELECT CASE True
case x > y:
dosomestuff()
case x = 5:
dosomestuff()
case y >...
| |
by: John Smith |
last post by:
Can you do a Select Statement within a Select Statement? I want to build a
query similar to queries built in Access which link to other queries but
using only SQL Statements. Is it possible? If...
|
by: FayeC |
last post by:
I really need help figuring this out.
i have a db with mostly text fields but 2.
The user_id field is an autonumber (key) and the user_newsletter is a
number (1 and 0) field meaning 1 yes the ...
|
by: Jack |
last post by:
Hi, I have a asp page where part of the code is as follows. This builds up
the sql statement partially.
sql01 = "UPDATE EquipmentTbl SET "
sql01 = sql01 & "SerialNumber = '" &...
|
by: Steven Bethard |
last post by:
I've updated PEP 359 with a bunch of the recent suggestions. The
patch is available at:
http://bugs.python.org/1472459
and I've pasted the full text below.
I've tried to be more explicit about...
|
by: dspfun |
last post by:
Hi!
The words "expression" and "statement" are often used in C99 and C-
textbooks, however, I am not sure of the clear defintion of these
words with respect to C.
Can somebody provide a sharp...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |