Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    MYSQL




String Search In Whole Database


I want to search a string in whole database [not in a table]? Is it possible in MYSQL? If so then how?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Search String
I want to provide my visitors the simple task of clicking a letter and finding ALL corresponding names beginning with that letter.
For example, I want to put a table with the letter A-Z (A-B-C-D-E, etc.), so, when someone clicks on the letter A, the php script will search the database and pull out every name that begins with the letter A. Click on the letter B, show every word that begins with the letter B, and so forth.

Search For String
I have a field called "contact" .I would like to search for the numbers, "3345". In this field the users were typing "C3345","CUS3345", or even "C 3345". In other words I just need to find the records that contain 3345 somewhere in the string.

Search String
I have a database with a user table. The user table holds the fields ip and lastip in addition to other information. I want to setup a script (which I assume I can do with an easy SQL statement) that will check to see if there is more than one record with the same ip or lastip. Basically to look for duplicate accounts. I'm just not sure what the best SQL statement to use is, as I'm a newbie to PHP/SQL! Thanks.
I dont need the connect strings, just the query, fetch or count sql statement that I should use.

Search All Fields For String
I have an email address entered wrong in some mystery field in the db, but have no idea where it is to correct. The only way I know about it is it comes back with bounced emails. Not sure if it is stuck in my CRM's cache, or in the db. Is there a way I can search all tables, all fields for the specific string???

Simple Search String For Keywords...
It's a simple 'when someone uses this keyword, bring back all listings containing that keyword.' Just like when you're searching in ANY db, you put in a keyword and it brings back all THOSE files. Now does that sound so impossible? For some reason, my last host's programmers and my brand-new host's programmers then a couple of paid programmers gave up. It's a standard string used in all dbs I would suppose, hence the need for databases-- databases search and they are a collection of data arranged for ease and speed of search and retrieval. So why have so many programmers tried to fix this simple string and failed? HELP. I am not a programmer and my site has been down now since before Christmas when I moved it from one server to another and "it got broken?" or something happened in the dump file.

Mysql Query Search And Find In String
I have following values in a field of mysql table. These values are stored as string [varchar] in the field.

Values : 3,4,10,21,20,8,100,2,6

How can I check through MYSQL query that 100 or 21 or 4 exists in the string?



REGEXP: Search String Where All Words Have Word Boundaries
I want to search a column using a search string where all words have word boundaries and each word MUST be included in the search result.. but using only 1 call to REGEXP per column

so instead of:
WHERE column1 REGEXP '<word_1>' AND column 1 REGEXP '<word_2>'

is there a way to do this?:
WHERE column1 REGEXP '<word_1>(and?)<word_2>'

i ask because there is an OR ( | ) available, maybe there's an 'and' as well? I can't seem to find it. I'm searching 3 columns and i'm just looking for a way to avoid generating 10+ REGEXP's for the search string.

Search: Remove Quotes From Database For Search
I am making a book site and currently in the database are book titles likes "John's Trip" and "Peter's new bike". I have a search function where the customer can type in "Peter's" and it will bring up everything with "Peter's" in it.

But i was wonderind is there any way i can search for "Peters" and "Johns".

String In The Database
Can i have a MySQL query which checks the table containing a list of
names?

I might have the following names on the table
Sony
Compaq
Logitech
Cabinet
Fedora
Angel
Incident

Can i get the results using the query for sounds like??

select name from table where name sounds like "sonny"

This should pick up Sony.. and a query like

select name from table where name sounds like "Kompaq"

This should pick up Compaq.

This is possible in MSSQL and Oracle. Is it possible in MySQL?

Searching A String Field In Database
I would like to have someone be able to search a my database. Here is how i would like it to work, but i am having a hard time figuring out how to code it. any help would be great.

So for instance say i have a field labeled "activities" and i will have the user check off boxes to fill this field.

Activities
"baseball AND soccer AND volleyball"

now i want someone to be able to search for "soccer" what would be the best way to search each person in the database for this attribute? Am i looking at this in the wrong way? Is there a better way to do this?

Retrieve Most Recent Records From Database Sorted By String Value
I'm having a problem with a simple select query. I've got users
uploading data into a database. I want to do something that seems as if
it should be really simple, but it isn't so far.

Basically, I want to retrieve the latest 12 records from the table,
sorted by the date-time field (uploaddate) then by a varchar field
(name). Here's the SQL that I'm using:

select * from tblcontent
where filetypeid=1 and release='Y'
order by uploaddate desc, name limit 12;

And here's the table schema:

Field,Type,Null,Key,Default,Extra
ContentID,int(3),,PRI,NULL,auto_increment
Name,varchar(50),,,,
Filename,varchar(100),,,,
Thumbnail,varchar(100),,,,
FileTypeID,int(11),,,0,
UploadDate,datetime,,,0000-00-00 00:00:00,
Description,text,,,,
ContributorID,int(10) unsigned,,,0,
Release,enum('Y','N'),YES,,N,

The problem I'm running into is that while I am retrieving the most
recent 12 records, it's not sorting by the varchar field. Instead, the
'Name' field seems randomly sorted. If I change the sort order (name,
uploaddate desc), I don't get the records that I want.

This seems like it should be something very simple to do, but it's
driving me nuts and I really have no idea how to resolve the problem. Code:

Updating A Database Field Based On A String Or Filename
I am using MySQL to store images that I serve up with Coppermine photo gallery. Each image is shown in low resolution format. I also store medium and high resolution versions of these files for download. There is a caption field where I put these links using BBcode. It looks something like this: Code:

Format Function In SQL String To Return From Numeric Field In Table To String
How would i form a format function in SQL string to return from numeric field in table to string:

1 --> '001'
5 --> '005'
57 --> '057'
125 --> '125'

How To Search '+','-' Or '(' In Database
How to search " +, - , ( " signs in mysql database....

Database Search
how to setup a search engine for my database.  Right now I have 4 different tables, all relating to each other thru different keys.  I currently use a search for where you must use drop downs to fill in text fields.  I want to change over to a search system that is just one text field that searches all the fields.  

First question, do I need to create an additional table for keywords?  If so, how do you keep that up to date?  I get photos and information added every hour.  

Do I need to look into a full text search or something different than the simple search/where?

Search The Whole Database
Is there a way to search all tables in a database for a keyword using 1 query?

Something like SELECT * FROM ??? WHERE ..ummm you know what,,I cant do it ,,please help

Database Search
I am looking for a query that will search all of my database without having to use all the individual table names and fields as there are 6 tables and over 30 fields in the database is there any special expression for this the search criteria would only be one word.

Search & Replace In Database?
I want to change a website from XHTML to HTML, so I have to get rid of my closing tags, such as...

<meta tags />
<image src="" />
<br />

I can clean up most of my site with Dreamweaver's search and replace function. Is there a way to do something similar with my database, preferably using phpMyAdmin? If so, will it let me use regex (for meta tags and images)?

Also, I know how to use phpMyAdmin's Search function, but is there a way to search for a specific item in a field, like " />" or "<br />"?

Search Database Query
I am looking for a query that will search all of my database without having to use all the individual table names and fields as there are 6 tables and over 30 fields in the database is there any special expression for this the search criteria would only be one word.

How To Search Mysql Database Using Php
in my mysql database table, i have

1. "this is mysql practice search test"
2. "that was my mysql practice search test"

if i use **
"SELECT * FROM `table` WHERE `def` like '%mysql%' order by id"
it returns both rows but ..
if
"SELECT * FROM `table` WHERE `def` like '%mysql my%' order by id"
doesn't return anything.

how to search table with more than one word from that may be in same field or different field of any row of table.?

Very Basic Database Search
Have a very basic database of contacts that I want to make searchable via PHP. Have successfully constructed the database, and can connect and get a basic search, but not sure how to get what I want.

Table name: Business

Fields:
ID (key),Name,Address,City,State,Zip,County,Region,Phone,Fax,Email,Category (4 main categories),Type,Web,Contact

Vision for search page: unified search, possibly with Category field being main selection (checkboxes, maybe), then refining search by City, County, Region, Type only. Results will be set off in a <div> to the right.

Techniques Available To Search A Database
Can someone provide a list of the most common techniques used to search a database for matches based on user-entered keywords etc?

At this point the only SQL syntax I'm aware of to search a db is using the LIKE clause:

SELECT article FROM mytable WHERE article LIKE "php variable";

Is this an efficient enough way, even for a large table? For example, what kind of algorithm do commercial scripts like VB or blog use to search its content?

Database Search Approaches
can i put together a site search tool for a e-comerce site that draws from a mySQL database. They are currently using a tool (Swish-e) that relies on an index of their site.
I don't know a lot about searches & it got me wondering if it is faster to query the database directly or may a daily index and search that, like they are currently doing? I don't believe they get a ton of hits on their search engine. I think they get around 120 orders a day, if you can deduce anything from that.
I'm also curious about the flexibility I would have to modify the way the program searches in the future. If I were using an indexed version it seems like it might be hard to produce advanced searches (all <color> tv's from <manufactuer>)

How Do You Replace A String With Another String
How do I write a query in myPHP admin to search through a particular field in a particular table for a string and replace it with another string? The string is only a part of the value of that field. For example, how would I change "Hello there" to "Hi there"?

I Have A Search Form To Search Through The DB.
I have a DB with 50,000 entries. I have a search form to search through the DB. If the recno=30123456 and you search the recno, you get that one file. what if i want a query that searches alll recno's that contain 30?? Can I do that using mysql or do I need to program that in my java app?

Could Not Connect To The Database, Please Recheck The Settings You Specified. Also Make Sure That A Database With The Name You Specified Already Exists On The Database Server. PhpAdsNew Will Not Create The Database For You, You Must Create It Manually
The error message I get above is the same everytime when trying to install phpAdsnew. I have tried everything. I am hosted through yahoo! and have actually succesfully installed scripts before even though I know nothing about it. Now that I have a "auto-install", it does not work. Yahoo! also offers php-nuke with the auto-install where you just click a few buttons, and I get a similar error stating that it can not conect to the database.

Please can anyone help me and tell me what I am doing wrong?

SQL String
I have VB6 app connected to a MySQL 4.1 database.
I am using ADO and myODBC to connect to the database on a webhost, and successfully return data to my forms.
My problem is that I need an SQL string to call records where the date is equal to today.

The string I've used is like "SELECT * FROM tblCalls WHERE CallDate='" & Format(Date,"yy-mm-dd")'".  When I populate my ADO control, with the SQL as its recordsource, I get all records back, i.e. it won't filter by today's date.
Can anyone tell me how I need to construct my SQL string to apply the filter I want?
Apologies if there's already a post about this, but I've tried to search this forum, and the MySQL forum with no luck.

Get String Of Certain Fields
Hi all! please bear with me as im not familiar with mysql... just can set up a database but thats about it.
I have a table for clothing, and for each item i have an 'enum' field for every colour available where i choose a &#390;' or &#391;' depending whether that colour is available for that item or not. There are many other fields in this table but the colours are the only ones im concerned with at the moment.
I'm just after how to get the string with the colours, that i can then explode onto my page. Once they are set out in a list im after adding a checked="checked" option to the radio button of the 1st item displayed.
Im not sure whether i'm making any sense whatsoever so you can view the original thread i made in the php forum that reffered me to here. Sorry if this is pretty vague let me know if u want me to elaborate on anything

String As Primary Key
www.site.com/abc
www.site.com/xyzzzz

"abc" and "xyzzzz" are names of products, and are unique.

This would mean that in my database design, I store the product ID as a string (primary key). Does this impact performance speed at all, vs. if I stored the product IDs separately as a number?

I've thought of storing them as numbers, but then it wouldn't be as easy to remember. Users would have to type:

www.site.com/3235389

to get to product "abc". However nobody would remember a number. It would be easier for them to remember "abc".

What are your thoughts? Storing a string (can be up to a few hundred characters long) as the primary key, is it ok for performance?

Which String Type Should I Use?
I am currently using a Text string type to store some webpage data. The webpage is not that large.

What is the maximum number of characters a Text string type can hold?

String And Memo
I am a delphi programmer.

I have created (manualy on the server) one table with this structur:

id - int auto increment primary key
name - varchar(50)
nipc - varchar(9)
....

After creating the table i tried to access to the table with my delphi application but it gets the fields varchar like memo.

But if i insert values with the line

insert into teste(nome,nipc) values('Marco','teste');

it interpretes the fiels like string, what is the problem?

I access the tables via odbc, with delphi 7, Mysql 4.1.

Searching A String
1. I have a list of states in a single variable, as such.

AZ CA NY NM OR


2. What is the best method to pull a match on a single state?

WHERE variable is LIKE value?

In JavaScript, I would use the indexOf like so.

if(var.indexOf(value) > -1){
THEN TRUE
}

Is there something that matchs the JavaScript IndexOf ?

TYIA!

String Matching
If i have the following table:

--------------
| ID | Color |
--------------
| 1 | Blue |
| 2 | Red |
--------------

If I have a HTML form and the user inputs in a textfield "The sky is usually blue in color".

String Comparison
I need to search a table for certain area codes. Because the office does not have a uniform way of entering phone numbers into the database, some are entered as (555)555-5555 and others as 555-555-5555.

I have a select statement in which I want to return phone numbers beginning with a certain area code indepent of how the phone number was entered.
I've tried the following:

CODESELECT customers_telephone FROM customers WHERE customers_groups_id = 3 AND customers_telephone
like '(310)%' OR customers_telephone
like '310%'

String Parsing
I am having a problem making an online form and I am fairly new to php and MySQL. I have an online form that errors when either single quotes are used. My code looks like this:

"INSERT INTO ".$_POST['gender']. " SET " .
"Name='".$_POST['school']."', "....

So if for example the name of the school were O'Connor, there would be an error with the parsing. Is there a way to fix this issue.

String Comparison
I would like to search a column of strings for matches to a given prefix. Is there a way to use existing string comparison functions to do this? Specifically I'm looking for the number of leading characters identical to my (variable) search string:

Example: looking for matches to prefix "Robb"

SELECT names, some_functions(names, "Robb") AS m FROM etc, etc, etc...

| names | m |

| Roger | 2 |
| Robert | 3 |
| Roseanne | 2 |
| Cary | 0 |
| Randy | 1 |
| Robby | 4 |
| Allison | 0 |

Return the highest value of m for which LEFT(names,m)=LEFT("Robb",m).

I've been reading through the section on string comparison function, but can't find anything suitable. But perhaps there is some combination of funtions you could use?

String Comparison
When i update a table i am carrying out a check to see if that entry already exists. This is ok when it is the same case but when it is different it allows it.

select
count( entityid ) as COUNTENTITIES
from
entities
where
code = '%1%'

I have tried LIKE but that didn't work either

What i am after is if there is a code 'c1' in database and someone tries 'C1' i want that to fail because 'c1' is already there. Is this possible?

Binary String?
In what case, I could use binary string?

String Comparisons
can someone please tell me where this statement evaluates true

select 'C:Documents and SettingsJudyVMy DocumentsDSC02062.JPG'='C:Documents and SettingsJudyVMy DocumentsDSC02072.JPG'

and how do i get it to evaluate false.

Format String
I have a large text file that I need to format so I can use a mysql command to populate a blob cell.

Is there an insert comand what will take my txt file and insert it into a cell from a remote computer?

Remove From String
I'm looking for some way to remove a part of a string from a table.

I have a table with a field called id. It contains data like this:
;1;6;9;34;54

What i want to do is to be able to remove ie. ";34" from this data, kind of oppisit of CONCAT. Hope that I explain myself well enough.

Do I have to extract all data, remove the substring and save the data in the db again, or is there an easier way?

How To Turn A String Into A Set?
If the string is in the form, say,

'setvalue1,setvalue3,setvalue7'

or 'setvalue2' if the row is a member of just one set.

Using An Apostrophe In A String.
Is there a way to pass an apostrophe from a webpage to a MySQL TEXT column? I have an area on my site where users can update their project details and I can foresee running into problems with the usage of apostrophes. I understand the error is in passing the INSERT command:

***
"INSERT INTO projects VALUES('1', '123456', 'Some Client', 'These are the project's details', 'Project Leader') ...

***

I understand that MySQL is thinking I mean to close the variable with the ' in project's.

Converting In To String
I have a table that has a field, subscription_id that is an unsigned long, and an account_number that is a string. I want to set the value of acct_number to be equal to the subscription_id converted to string form.

Get Min & Max Values Of A String
I have a field 'zip' in a table in my database that records values in the form on 'something/023/something', 'anything/346/somemore','kztt/1984/asdg'

I want to get the min and max values of this field in particular the numbers in the string. Initially, I simply run a query to get the min and max value of this field which works until the numbers in the string went to 4-digits instead of the usual 3.

Example query: select min(zip) as min, max(zip) as max from $dbtable

Then I run an explode function to retrieve the numbers in the string.

This query now return values like min=999, max=1000 instead, when the min number should be 023 and max is 1984

Selecting String
I am having a problem on selecting strings in mysql.

I have the folowing column:

|////////////////////////////////A\\\\\\\\|
+-------------------------------------------------------------------+
| 1A11B01C01D11E12A12B02C02D12E03A03B03C03D13E2 |
+-------------------------------------------------------------------+

What I would like to do is get this string giving a letter. Example:

I want letter B, then the result should be this: 1B02B03B0.

Got it? I give the letter and it returns me the prev char, the letter, next char. Only. Can mysql do this?

Efficiency Of String Vs Int
Is the difference in efficiency of a string in mysql vs the efficiency of an int drastic enough to avoid using an int? I'd like to use strings for readability of types but I can just as easily use ints like a C enum.

Error In String
I'd like to use placeholders but it looks difficult to use with $dbh->do() as I am not particularly familiar with this.

CODE  $dbh->do("INSERT INTO storage (url, altavista, yahoo, msn, teoma, google, alltheweb,Total, lastsearch, totalsearch) values($url, $altavista_results, $yahoo_results, $msn_results, $teoma_results, $google_results, $alltheweb_results, $total,$time, $total)") unless $dbh->do(UPDATE storage SET (url = "$url", altavista = "$altavista_results", yahoo = "$yahoo_results", msn = "$msn_results", teoma = "$teoma_results", google = "$google_results", alltheweb = "$alltheweb_results", total = total +1, time="$time") > 0;

Interpret String As Sql
Is there a way to interpret the content of a string as sql?


Copyright © 2005-08 www.BigResource.com, All rights reserved