Current location: Hot Scripts Forums » Programming Languages » PHP » Wrong parameter count for mysql_fetch_assoc()


Wrong parameter count for mysql_fetch_assoc()

Reply
  #1 (permalink)  
Old 05-26-04, 09:18 PM
altlprsn altlprsn is offline
Newbie Coder
 
Join Date: Apr 2004
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Question Wrong parameter count for mysql_fetch_assoc()

I'm trying to create a search for my website, then return the results with a link dynamically created for each result returned. I have tweaked the code so many times (lots of help from folks here!) but either I get ALL of the results (which means the query is n't working) or NO results (ditto)... right now I get NO results and the following error:

Wrong parameter count for mysql_fetch_assoc()

PHP Code:

<?

error_reporting
(E_ALL);

$Submit1 = isset($Submit1);
$word1 = isset($word1);
$word2 = isset($word2);
$word3 = isset($word3);
$name 'name';
$description 'description';

mysql_connect("""name""pass""CLIENT_MULTI_STATEMENTS") or die("Could not connect: "mysql_error());

mysql_select_db("recipes") or die("Could not select database");  
      
if (
$Submit1) {
    echo 
"<br><b>You searched for: '$word1', '$word2', '$word3'</ b>";
    
$sql "SELECT name, description"
        
" FROM `main` "
        
" WHERE MATCH ( fc )"
        
" AGAINST ( \'\%\$word1\%\, \%\$word2\%\' ) LIMIT 0, 30";
       
   
$result mysql_query($sql);
       while(
$current_recipe_found mysql_fetch_assoc($result)) { 
           
extract($current_recipe_found); 
    echo 
"<br /><b><a href=\"http://www.thepastaboard.com/recipes/selected_recipe.php3?recipe=" $current_recipe_found['name'] . "\">" $current_recipe_found['name'] . "</a></b><br />" $current_recipe_found['description'];
        } 
      } 
?>
I don't understand why it is a 'wrong parameter count' ????
Reply With Quote
  #2 (permalink)  
Old 05-26-04, 09:40 PM
tylerc tylerc is offline
Newbie Coder
 
Join Date: May 2004
Location: Canada
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Lightbulb

Ok I will show you an example

Page with Search Form

PHP Code:

<form method="post" action="search.php">

Search Words: <input type="text" name="search_value"> <input type="submit" name="submitter" value="Search Recipes">
</
form
Page that searchs

PHP Code:

<?php


// Lets Retrieve Search Field Values //
$search_value$HTTP_POST_VARS['search_value'];

// Lets now connect to MySql //
$linkmysql_connect('host','user','password');
mysql_select_db('db');

// Lets now load the Query //

$sql "SELECT name, description  FROM main WHERE name LIKE '%$search_value%' LIMIT 0, 30";
$querymysql_query($sql);

// Lets now do the loop! //

while($result msyql_fetch_array($query)) {
echo 
"<b><a href=\"http://www.thepastaboard.com/recipes/selected_recipe.php3?recipe=$result[0]</a></b><br>$result[1]<p>"
}

?>
that will print the the results as follows,

<b>Fried Chicken</b><br>A nice Meal!<p>
<b>Unbaked Cookies</b><br>Very good cookies!<p>
__________________
-Tyler
RuneGuide Owner/Manager

Runescape Stats:
http://www.rsbandb.com/sig/sigs/n/nexon89.png
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Multithreading application thread count? Alfarin Everything Java 1 05-04-04 01:25 PM
Good click count solution? parakeet PHP 0 04-20-04 07:48 PM
count() mivec PHP 2 04-16-04 08:52 AM
Post count, why? rob2132 Hot Scripts Forum Questions, Suggestions and Feedback 7 10-06-03 03:29 PM
count date superman PHP 5 07-01-03 02:28 AM


All times are GMT -5. The time now is 10:36 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.