I'm trying to get this to work, it will compile with "php -l" but the
search is broken. What's wrong? I have MYSQL 4.1. Thanks
$result = mysql_query("SELECT p.page_url AS url, p.title AS title,
p.descrip AS descrip, p.page_id AS id
FROM page p, word w, occurrence o
WHERE p.page_id = o.page_id AND
w.word_id = o.word_id AND
w.word_word LIKE '%$keyword%'")
UNION
(SELECT p.page_url AS url, p.title AS title,
p.descrip AS descrip, p.page_id AS id
FROM page p
WHERE p.descrip LIKE '%$keyword%'");
GROUP BY p.page_id
ORDER BY p.page_id DESC" ); 3 1932
On Sun, 17 Oct 2004 20:18:39 GMT, leegold2 <le*****@nospam.net> wrote: I'm trying to get this to work, it will compile with "php -l" but the search is broken. What's wrong?
Define broken. Errors? (Which ones?) Wrong results? (What did you expect? What
data do you have?)
--
Andy Hassall / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
leegold2 wrote: I'm trying to get this to work, it will compile with "php -l" but the search is broken. What's wrong? I have MYSQL 4.1. Thanks $result = mysql_query("SELECT p.page_url AS url, p.title AS title, p.descrip AS descrip, p.page_id AS id FROM page p, word w, occurrence o WHERE p.page_id = o.page_id AND w.word_id = o.word_id AND w.word_word LIKE '%$keyword%'")
UNION (SELECT p.page_url AS url, p.title AS title, p.descrip AS descrip, p.page_id AS id FROM page p WHERE p.descrip LIKE '%$keyword%'");
GROUP BY p.page_id ORDER BY p.page_id DESC" );
I can't remember which version of Mysql that unions are finally
supported. it may be that yours is too old.
However, will a variable name in single quoted in double quotes expand
to it's value? I don't think it will. You man need to catenate a few
substrings together to get it to work.
Steve
Steve wrote: leegold2 wrote:
I'm trying to get this to work, it will compile with "php -l" but the search is broken. What's wrong? I have MYSQL 4.1. Thanks $result = mysql_query("SELECT p.page_url AS url, p.title AS title, p.descrip AS descrip, p.page_id AS id FROM page p, word w, occurrence o WHERE p.page_id = o.page_id AND w.word_id = o.word_id AND w.word_word LIKE '%$keyword%'")
UNION (SELECT p.page_url AS url, p.title AS title, p.descrip AS descrip, p.page_id AS id FROM page p WHERE p.descrip LIKE '%$keyword%'");
GROUP BY p.page_id ORDER BY p.page_id DESC" );
I can't remember which version of Mysql that unions are finally supported. it may be that yours is too old.
the UNION statement is available in MySQL from version 4.0.0 onwards.
However, will a variable name in single quoted in double quotes expand to it's value? I don't think it will. You man need to catenate a few substrings together to get it to work.
"LIKE '%$keyword%'" should work fine. Steve
sadara This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: techquest |
last post by:
got slightly similar table.
#Temp Table:
name,name1,name2,exam,score
A,A1,A21,
A,A1,A21,math100,88
A,A1,A21,math101,56
A,A1,A21,
A,A1,A21,math102,67
A,A1,A21,
A,A1,A21,math104,45
|
by: angelasg |
last post by:
Here is sample data I'm working with:
ID ShiftDate SegTime
99 5/2/2005 5/2/2005 1:00:00 PM
99 5/2/2005 5/2/2005 1:04:00 PM
99 5/2/2005 5/2/2005 1:43:00 PM
99 5/2/2005...
|
by: plaztik8 |
last post by:
Hello,
Can someone please help me with a query?
The table looks like this:
BookedRooms
===========
CustomerID RoomID BookDateID
|
by: Dalan |
last post by:
From reading Access 97 help text, it seems that to do what I need to
do will require a Union Query. As this would be my first, I think I
might require a little guidance.
I have two tables with...
|
by: Jeff Blee |
last post by:
I hope someone can help me get this graph outputing in proper order.
After help from Tom, I got a graph to display output from the previous
12 months and include the average of that output all in...
|
by: spam |
last post by:
If I run the following query in Access 2002 then I get the expected
result:
SELECT *
FROM CSVImport
UNION SELECT *
FROM AssetTemp;
I get the contents of both tables with no duplicates. If I...
|
by: BillCo |
last post by:
I'm having a problem with a union query, two simple queries joined with
a union statement. It's created in code based on parameters. Users were
noticing some inconsistant data and when I analysed...
|
by: KoliPoki |
last post by:
Hello every body.
I have a small issue.
Problem: I have a table with 4 descriptor columns (type). I need to
formulate a query to retrieve a count for each type so I can group
by...etc. The...
|
by: bgreenspan |
last post by:
Hi Everyone, I'm back for some more expert help. Here's what I am
doing and what I tried.
My database has entries with Contract Names and Expiry Dates, among
other fields. I have a form...
|
by: MLH |
last post by:
How can I turn the following into a make-table query?
SELECT & " " & AS Recipient FROM
tblVehicleJobs INNER JOIN tblAddnlOwnrs ON tblVehicleJobs.VehicleJobID
= tblAddnlOwnrs.VehicleJobID WHERE...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |