FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Search whole database





avk
Hello,

what should i do if i want to search in a table of a database??
Not a single row but the whole table.
AftershockVibe
I assume you mean multiple columns (fields) as it already searches all rows (records).

I'm afraid that you have to specify them by name. Something along the lines of;

SELECT * FROM Table WHERE Field1 = "Criteria" OR Field2 = "Criteria".

You shouldn't really ever need to search the entire table though unless you have something odd going on with your table design,.
asiddle423
hi

is it something like a login where you want to find a username and password match. if so it will be something similar to this:

Code:

<?php
$login = 'login';
$pass = 'password';

mysql_query = "SELECT * FROM tableName WHERE login = '$login' AND password = '$pass'";

?>
thnn
If you want to make say a search page to search content on you site you can do,

Code:
mysql_query = "SELECT * FROM tableName WHERE fieldName like '%Query%'";


The % means that anything can be on the side of it. If you wanted more you would use (fieldname like '&Query&') OR (fieldname2 like '%Query%')
avk
Yup,
Thankyou I got my answer.
This thread can be closed now
Related topics
Can someone make me a php script?
Free Online Games (Do not make more new threads about this)
Boot up Windows XP 60 times faster
Someone else's database in my account
How-to make people visit you site
Want a news script which doesnt use MySQL?
Google's Search engine and its lies
Good layout site?
PhpBB Invisible Forum
Creating a Search Script with PHP for MySQL
Problem restoring databases
Any fast way to transfer/backup a domain to another server?
Restoring table from database backup?
Hoping for a response. NEED Help..
This topic is locked: you cannot edit posts or make replies.    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.