Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



Reply
Old 05-05-2006, 08:51 PM No Ouput with search
Novice Talker

Posts: 10
Trades: 0
I have this search script that I use. It does not return any results even when I input data I know is in the database. Here is code:

PHP Code:
<?php
    
/* call this script "this.php" */
    
if ($c != 1) {
?>
<form action="this.php?c=1">
<input type="text" name="keyword">
<input type="submit" value="Search!">
</form>
<?php
    
} else if ($c==1) {
        
MySQL_connect("localhost""*****""*****");
        
MySQL_select_db("testdb");
        
$sql "
            SELECT *,
                MATCH(coords, name, owner) AGAINST('
$keyword') AS score
                FROM planets
            WHERE MATCH(coords, name, owner) AGAINST('
$keyword')
            ORDER BY score DESC
        "
;
        
$res MySQL_query($sql);
?>
<table>
<tr><td>SCORE</td><td>Coords</td><td>Name</td></tr>
<?php
        
while($row MySQL_fetch_array($rest)) {
            echo 
"<tr><td>{$sql2['score']}</td>";
            echo 
"<td>{$sql2['coords']}</td>";
            echo 
"<td>{$sql2['name']}</td></tr>";
        }
        echo 
"</table>";
    }
?>
Can someone please help me as I am very new to this.
avis is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-06-2006, 03:05 AM Re: No Ouput with search
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
$res = MySQL_query($sql);
...
while($row = MySQL_fetch_array($rest)) {
...
echo "<tr><td>{$sql2['score']}</td>";

You operate different variables, so it's not a surprise that you have no output.
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 05-07-2006, 03:33 AM Re: No Ouput with search
Novice Talker

Posts: 10
Trades: 0
ok so what do I need to do?
avis is offline
Reply With Quote
View Public Profile
 
Old 05-07-2006, 04:10 AM Re: No Ouput with search
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
while($row = MySQL_fetch_array($res)) { // not $rest
...
echo "<tr><td>{$row['score']}</td>"; // not $sql2
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 05-08-2006, 04:11 AM Re: No Ouput with search
Novice Talker

Posts: 10
Trades: 0
cool thanks for your help. I have the search worked out thanks
avis is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to No Ouput with search
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.15918 seconds with 12 queries