Function For Making Url Friendly Strings
I'm using MySql on a web server. Iv''e got at table with diffrent catgories, where some of the category has non-url-supported charcters such as &, : åäö, etc.
I'd like function that turns all non-url-supported-characters into a '-'. For instance: Me & My Friends -> me-my-friends.
I know that I can make another table with "url-name" but that's not a good solution for med. I would also like to avoid using the REPLACE function for every non-supported chacter.
View Complete Forum Thread with Replies
Sponsored Links:
Related Messages:
Command Line More Function? User Friendly Way To Show Database Structure?
In the MySQL command-line interface, is there a way to pause (like the more function in windows) the data? for example, SELECT * FROM TABLE shows a huge list of data that overflowed my command prompt in windows. I can't see the ones on top. Another question is, how do I download or view the tables and its values in a database in a more user/graphic friendly way? I have a huge list of tables amd data in the tables, but using the command-line interface is basically a horrible waay to look at the data structure.
View Replies !
View Related
Is This A Friendly News Group
I have coded in Rbase for DOS, Foxpro (DOS and Win3.1) and have a little C and old Paschal behind me. Coding for the internet seems to be totally different. I expect different in respect to how sql results are returned. I intend to have an internet provider, can someone tell me why Apache is or is not beneficial? Does mysql provide a user interface or must that be structured in PHP or something else?
View Replies !
View Related
Log Activity User-friendly Or Versioning System, Possible ?
I have created a MySQL database that my users access using OpenOffice Base forms. They would like to get a kind of history of changes / versioning system that would keep track of their changes and would be easy to read. I thought of using the bin log file that contains all the transactions, but they are quite difficult to read for users that are not familiar with SQL. Is there any tool to display a "simplified" version of the bin log file (for instance using a web server). Even if the commands are still there, that would be OK, because they could at least check they did not delete stuff, or review their additions. Or is there any other way to get a "diff" between 2 DBs ?
View Replies !
View Related
IF Function,GROUP BY,aggregate Function Problems
Yep, I have all those problems in the title. So I'll explain each one at a time - I did have another thread relating to this very same query but I thought it was time to update where I am with the query because at the moment I feel like I am getting nowhere! The query I have basically searches through an items_ordered table through each product and checks to see whether the item is VATable or not. This is not where I have the problem though. Where I am really having the first problem is when I am trying to use the IF function to check if the TOTAL of an order is over £300. IF it is then I multiply it my 0.95 (i.e. 5% off). With the query below I get no errors but neither do I get the desired result. It's as though it couldn't even see it. =....
View Replies !
View Related
How To Do A 2 Way LIKE In Strings?
I'm sure everyone will be familiar with LIKE. SELECT * FROM Table1 WHERE Column1 LIKE ('expression%') Given a Row x, I would like to find all rows where 1. Column 1 LIKE Column1 of ROW x OR 2. Column 1 of ROW x LIKE Column 1 So all rows starting with Row x Column 1 and longer strings or e.g say Column 1 of Row x is a String "fridge". I would like to see all these rows with Column 1 "fridgemagnet" (fridgemagnet begins with fridge) "fri" (fridge begins with fri) So it's a LIKE both ways.
View Replies !
View Related
Escaping Strings
I am using MySQL from ASP. Is there a simple way to process string values which I am reading/writing before constructing my query so that they are always correctly escaped? Or is there a way of including this process in my SQL statements? I am worried about writing strings to a VARCHAR field which contain special characters that haven't been escaped correctly.
View Replies !
View Related
Combine 2 Strings
I am making a query from a few tables. In one table I've stored the name info in 3 columns, FirstName, LastName, Initial. I would now like to join the name info together, but I'm not really clear on how to do that. Code: Names.FirstName & ' ' & Names.LastName Doesn't seem to work for me. Is that the correct format? I'd like to have a space between the names.
View Replies !
View Related
Strings Combining
i'm having two strings in temp1 and temp2.how can i combine those two in the below query having an x in the middle of both strings and search. I'm not getting proper results.say... i've 720 in temp1 and 480 in temp2.how can i combine these two to search as '720x480'.Code: $query = "SELECT s.stream_name,s.stream_location,v.video_type,v.video_pid,a.audio_pid,a.audio_t ype,v.video_resolution,v.video_frame_rate from streams s join video v on (v.video_sid= s.stream_id) join audio a on(a.audio_sid=s.stream_id and a.audio_prgm_number=v.video_prgm_number) and v.video_resolution like '$temp1x$temp2'";
View Replies !
View Related
Matching Strings
I have a lot of records in a table named in this pattern "this text is the same.r01 someText (001/100)", "this text is the same.r01 someText (002/100)", "this text is the same.r02 someText (003/100)" etc. The idea is that i want to automate the process of recognizing the files belonging to the same file(.r02 in this case), and then set a value which shows that is belongs to a certain fileID in another table. The problem is that i have no idea what would be the best way to do this. My initial guess is that i would have to use a trigger and a LIKE clause comparing the "this text is the same.r02" part of the string, to see if it already exists in the database. If it does, i have to mark it as belonging to the same file. I guess using a LIKE clause would be very slow, and the amount of records will grow quite big(millions of rows).
View Replies !
View Related
Strings To Datetime
If I run the query Select '2006-12-14' + ' ' + '10:24:40'; in MS SQL Server the result 2006-12-14 10:24:40 is returned as I expect. If I run the same query in MySQL, 2016 is returned. Why? What I want is to update a datetime field from two char fields containing the date and time parts in the above formats.I, therefore, run Update Tablename Set z=x+' '+y; where z is a column in datetime format and x and y are in char format and contains values like the above.Again this works perfectly in SQL Server but it fails in MySQL.Why? And what can I do about it.
View Replies !
View Related
REPLACE Two Different Strings
I have a table with two different strings ( 'yes' and 'no' ). I try to replace them with TRUE and FALSE but it is only possible to change on string to another one... SELECT entry_key, REPLACE(signature,'yes','TRUE') AS ligands FROM INTERFACE ORDER BY entry_key; What I get is a second column with 'TRUE' and 'no'. But I want to replace this 'no' in 'FALSE' too.
View Replies !
View Related
How To Compare Strings ?
I have a problem comparing strings that have spaces between the words, specifically file path, I am using strcmp but is not working properly. For example I have a table named files with two fields: id(int) and filepath(varchar 100) then I want to select the one that have the same filepath, what I do is this: SELECT * FROM files WHERE STRCMP( files.filepath,'serverdocsan example of file')=0 The result is null but in the database there is an ocurrence that match the filepath exactly. I don't know why this is happening. Could some body tell how can I make this work properly?
View Replies !
View Related
Comparing Strings
I can't work out but i'll try to present it simply here. Assume the table "Names". FirstName, SecondName Robert Smith John Jones Richard Robertson Mike Richardson Ian Stevenson I need to write a query where by it selects all records where the First Name appears as part of any second name. the output should be Robert Smith Richard Robertson Now, I know I can do SELECT FirstName, LastName FROM Names WHERE LastName LIKE '%Richard%'; This will find all records where Richard appears as part of a last name. But I want it to work for any first name not just a specific one. i basicly need the last line to be something int he order of WHERE LastName LIKE '%FirstName%'; only a version that works.
View Replies !
View Related
Compare Strings In SQL
I have a string field where are stored dates and i want to select from this table like this: "SELECT * FROM [table] WHERE field_date>='date1' AND field_date<='date2'". Apparently doens't work, the query returning all the rows in the table. Is there a posibility for this string comparison or i should probably convert the field that stores these dates into the date one?
View Replies !
View Related
Using 'N' Prefix For Unicode Strings
I have ported a .NET application which supports unicode from MS SQL Server to mysql. The .net framework itself is unicode throughout and I am using utf-8 innodb tables in mysql. When working with mssql it was necessary to prefix unicode strings with N e.g. N'a' when building the SQL to get them processed correctly. This behaviour mostly seems to work in mysql unless there are single quote characters in the string e.g. insert into foo values ('a''b') -- works fine insert into foo values (N'a''b') -- just inserts 'ab' From reading the mysql manual I don't see any mention of the N prefix but conversely the database engine doesn't seem to reject it. Am I OK working with unicode strings in mysql without this N prefix? Any idea why the prefix causes the quote processing to go wrong?
View Replies !
View Related
How To Enter Unicode Strings?
How does one enter Unicode strings into a 5.0.3 MySQL table? I tried things like: INSERT INTO tablename(colname) VALUES( _utf8'€©®á§A¦n') But this doesn't work. I guess I need an escape sequence, but the MySQL manual doesn't specify Unicode escape sequences, just for quotes, newlines and such.
View Replies !
View Related
Dates Differences From Strings
If I have two String objects which are formatted date-times, say for example: '20060127 01:00:03' and '20060217 13:41:17' Is there a means by which I could redisplay this as the difference between the two, as a String, say, like, that may show the hh:mm:ss as well as the number of days?
View Replies !
View Related
Matching Escaped Strings
I have the following info in my database ID|Name ================ 1|Author's As you can see, the name value has been escaped. Now, the question is, how do you match on a value that has escaped charaters? I've tried the following SELECT * FROM table WHERE Name = 'Author's' SELECT * FROM table WHERE Name LIKE 'Author's' SELECT * FROM table WHERE Name = '%Author's%' SELECT * FROM table WHERE Name = 'Author''s' SELECT * FROM table WHERE Name = "Author's" SELECT * FROM table WHERE Name = "Author's" And none of them work.
View Replies !
View Related
Joining Select Strings
I've got 3 columns in a mysql database that I am trying to join. I'm using CONCAT(), but it's giving me NULL results. This has worked for me before ... What am I doing wrong? Here's a straight select: mysql> select peopleID, firstName, middleInit, lastname -> from people; +----------+-----------+------------+------------+ | peopleID | firstName | middleInit | lastname | +----------+-----------+------------+------------+ | 1 | Joe | NULL | Shockey | | 3 | John | NULL | Doe | Here my select with the concat. It's not concatenating the string for some reason: mysql> select peopleID, CONCAT(firstName, ' ', middleInit, ' ', lastname) AS person -> from people; +----------+--------+ | peopleID | person | +----------+--------+ | 1 | NULL | Can anyone tell me what I'm doing wrong? Should I be using a different method for joining these srings? BTW - here's my table structure: mysql> show columns from people; +------------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------+-------------+------+-----+---------+----------------+ | peopleID | int(10) | | PRI | NULL | auto_increment | | firstName | varchar(50) | YES | | NULL | | | middleInit | varchar(50) | YES | | NULL | | | lastName | varchar(50) | YES | | NULL | | | phone | varchar(50) | YES | | NULL | | | email | varchar(50) | YES | | NULL | | +------------+-------------+------+-----+---------+----------------+
View Replies !
View Related
Comparing Partial Strings
Suppose I have a varchar field "A" in my table that has a value '120 g' I have a variable $weight=120; Now I want to run a query which compares $weight to 120 of field A Can I do that? I think I will have to extract the number from 120 G and then do the comparsion.or something like that/
View Replies !
View Related
Concatenate Date And Strings
I am trying to concatenate the following: concat(date_format(dbirth, '%m%d%Y'), substr(cfirstname, 1, 1), substr(clastname, 1, 1)) but I get an error about incompatible values. There is no date to string conversion function. How can I concatenate these items?
View Replies !
View Related
Matching Partial Strings
I've been working all day trying to figure out how to do this query and have exhausted all of my resources.i'm trying to find relationships between the 'category' field of my "songstab" table which can contain more than one category separated by commas and the 'category_set' field of my "category" table which has all of the possible categories as it's rows. it works fine if there is only one category in 'songs.category' but doesn't return anything if there are more than one item (ie. Drama,Comedy,Action). how can i get it to recognize the partial string matches?
View Replies !
View Related
Comparing Strings With Accents
I want to compare strings with a select command. In two tables, there are strings with and whitout accents, like "Cecile" and "Cécile". I don't know how I can get all the results for this kind of select : select table1.givenname from table1,table2 where table1.givenname = table2.givename I want to compare whitout accents but I don't know how to.
View Replies !
View Related
Multi Part SQL Strings
1. How can i browse my data base table to see if "category" contains a specific word and then return the results. ex: if a "category" is a table key and contains text, and i want to know if the text contains for instance the word "computers" 2. How can i get sql to return random keys from the category table, for instance i'd like to return 40 random entries in category
View Replies !
View Related
Sorting Numeric Strings
I have a column of type varchar that stores many different numbers. Say for example there are 3 rows: 17.95, 199.95 and 139.95 When I SORT BY this column, I get 139.95, 17.95, 199.95, (in that order) because it's comparing them as strings. Is there a way to make the sql compare them as numbers?
View Replies !
View Related
Find String Between Two Strings
I have a column with some data delimited by a ; like this weight:80;size:90;height=40; I am wondering in mysql is it possible to update the next column with just this part size:90; I have tried using instr to do this, but im just not sure if it is possible and whether i should carry on finding a solution. Tried using this code but no luck update table1 set delimiterurll = (SELECT delimiterurl, POSITION('size:' IN delimiterurl), SUBSTRING(delimiterurl FROM 1 FOR POSITION('size:' IN delimiterurl)) ) where delimiterurl like '%size:%'
View Replies !
View Related
Whitespace At The Beginning Of Strings...
I ran a query on my table... mysql SELECT * FROM weapons WHERE LEFT( w_name, 1 ) = ' ' And it returned 201 rows... so this means I have whitespace at the beginning of the values of column w_name. Is there one massive MySQL query that I can run to get rid of ONE SPACE at the beggining of the value of the column name 'w_name'? Thanks so much!
View Replies !
View Related
Sum() Is Making
i have a table called bill, in which there r three fields named bill,paid,exempted. when i when i want to deduct the due of each customer the following query does not work: ..........
View Replies !
View Related
Set Empty Strings To NULL Across Many Columns
I have a PHP application which has written lots of empty strings into columns which do allow NULL. When I export the resultset to an excel file using the MySQL Query Browser, Excel does not recognize the cells as being blank using the counta() function. I need for Excel to count the number of nonblank cells, though, to have accurate statistics. Is there any way to convert all these empty strings in my MySQL DB to NULL? I am familiar with using REPLACE() to change one column at a time, but I have lots of columns and don't want to do it manually.
View Replies !
View Related
Problems With $_GET[] And Query Strings
I am trying to write code that will bring up a large image (bigpic1) when I click on a thumbnail image (tn1). The <img src.../> for these are stored in a mysql database in fields bigpic1, etc, and tn1, etc. The .jpg images themselves are stored in the root directory. I am trying to get the value $bigpic1 passed using the query string in (B) into the variable $bigpic in (A)...
View Replies !
View Related
Comparing Strings And String Concatenation
i am just learning sql and am having trouble doing a query on strings and concatenation what I need to do is compare the registered owner's name with the ticketed driver's name. problem is, registered owner is one string and driver's name is separated into LastName and FirstName. I need to list the ticketed drivers who were issued a ticket while driving another person's vehicle. select FirstName, LastName from driver,vehicle,ticket where vehicle.regowner not like concat(driver.FirstName,'',driver.LastName)
View Replies !
View Related
Does MySQL Support Binary Strings?
I want to have a sort of switchboard system on my database which tells which features are set and which ones are not... 01010110 That would tell you that some features are enabled and some are not. However when it comes down to storing the value I have two options... 1) Store it as a CHAR(8) value, and then fetch it without decoding it. Simply have a server side code use number.charAt(i) to determine the bit value. 2) Store it as a Decimal (Base10: 0-255) number and then have server side scripts covert it to base2 (binary). Then from there it will take the process that step one takes... Both these solutions work well, But I would really like to have something in the middle. Say storing a base10 number (already decoded into base 2) but stores as a binary string. Is that possible?
View Replies !
View Related
Making A Column
ihave some Access background. I've created a table for which I intended the email column to be the primary key, but didn't specify it at creation. Now, I'm trying to figure out how to specify it post facto.
View Replies !
View Related
Making Archive
i need to be able to archive old data, that also can be viewed later. is there an archiving feature in mysql that lets you do that? of course i can always put the data into a separate table and call it an ArchiveTbl, but thats not really saving space per say.
View Replies !
View Related
|