|
-
Apr 22nd, 2002, 02:37 PM
#1
Thread Starter
Fanatic Member
check if query has something
PHP Code:
SELECT * FROM reviews WHERE instr(gamename, '$search')
is that right?
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?
-
Apr 22nd, 2002, 07:38 PM
#2
PowerPoster
this is how i do it:
mysql_query("SELECT * FROM book ORDER BY title ASC",$db);
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
-
Apr 22nd, 2002, 08:27 PM
#3
Thread Starter
Fanatic Member
its like a mini search thingy, i want it search the reviews for $search and return the results
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?
-
Apr 23rd, 2002, 05:09 PM
#4
Thread Starter
Fanatic Member
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?
-
Apr 24th, 2002, 02:48 PM
#5
Thread Starter
Fanatic Member
oh ok
that will check if that has $search in it right?
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?
-
Apr 24th, 2002, 02:53 PM
#6
correct, it will check to see if what the user entered and if it is in the database, so if
$search = table
then once it goes through it's search it then will fine any game that has table in it. that is what the % means. it can have anything before it or after it but it has to contain table.
-
Apr 25th, 2002, 04:00 PM
#7
Thread Starter
Fanatic Member
it wont work. like it wont find anything
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?
-
Apr 25th, 2002, 04:04 PM
#8
what's the cod eyou have now?
-
Apr 25th, 2002, 08:39 PM
#9
Thread Starter
Fanatic Member
PHP Code:
$sql="SELECT * FROM reviews WHERE (gamename LIKE '%$search%') OR (review LIKE '%$search%') OR (name LIKE '%$search%') OR (describ LIKE '%$search%')";
$result = mysql_query($sql);
echo "<UL>\n";
while ($row = mysql_fetch_array($result)) {
printf("<li><a href=\"viewreview.php?id=%s&system=%s\">%s</a> - by <a href=\"../forums/profile.php?mode=viewprofile&u=%s\">%s</a> - %s</li>", $row['id'], $row['system'], $row['gamename'], $row['id'], $row['name'], $row['describ']);
}
echo "</UL><BR>\n";
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?
-
Apr 25th, 2002, 08:55 PM
#10
like this.
PHP Code:
$sql="SELECT * FROM reviews WHERE (gamename LIKE '%$search%' OR review LIKE '%$search%' OR name LIKE '%$search%' OR describ LIKE '%$search%')";
-
Apr 27th, 2002, 11:28 AM
#11
Thread Starter
Fanatic Member
still wont work, no errors are returned
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?
-
Apr 27th, 2002, 12:20 PM
#12
try this and see if the select statement is ok on the ouput. also it will give an error if the result is wrong. also make sure all the categories are actually in the reviews table. Also what is the form coding that the search is coming from?
PHP Code:
$sql="SELECT * FROM reviews WHERE (gamename LIKE '%$search%' OR review LIKE '%$search%' OR name LIKE '%$search%' OR describ LIKE '%$search%')";
echo $sql;
$result = mysql_query($sql);
if (!$result)
{echo mysql_error($result)}
echo "<UL>\n";
while ($row = mysql_fetch_array($result)) {
printf("<li><a href=\"viewreview.php?id=%s&system=%s\">%s</a> - by <a href=\"../forums/profile.php?mode=viewprofile&u=%s\">%s</a> - %s</li>", $row['id'], $row['system'], $row['gamename'], $row['id'], $row['name'], $row['describ']);
}
echo "</UL><BR>\n";
-
Apr 28th, 2002, 12:01 PM
#13
Thread Starter
Fanatic Member
alright i got it, thanks
i noticed it wasnt showing the SQL statement, this was the prob:
PHP Code:
if($submit){ //check if submitted
...
}
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|