473,322 Members | 1,510 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Help with "LOCATE" syntax needed please

Hello everyone, i hope you can help me with this query.
The code below all works fine, referring to the SUBSTRING part, at the moment it just displays all the text from the "http" part until the end of the thread.

I am trying to get it to just grab the URL and display that only.
Expand|Select|Wrap|Line Numbers
  1. $sql= <<< END 
  2. SELECT 
  3.  post_date 
  4. , DATE_FORMAT(FROM_UNIXTIME( post_date ) , '%d-%m-%Y') AS formatted_date 
  5. , LEFT(title, 30) AS title 
  6. , post 
  7. , SUBSTRING(post FROM LOCATE('http://',post) FOR 200) AS url 
  8. FROM posts, topics 
  9. WHERE post LIKE '%tp:%' 
  10. AND topic_id = topics.tid 
  11. AND forum_id = 29 
  12. ORDER BY post_date DESC 
  13. LIMIT 0 , 30 
  14. END;
I have this as a starting guide, but dont know what i am to place where the "X" are.

Expand|Select|Wrap|Line Numbers
  1. SUBSTRING(post FROM LOCATE('http://',post) FOR LOCATE(' ',xxxxx)-1)
I have tried "post", "SUBSTRING", "LOCATE", but know i am missing something
like a string, but dont know how to reference it.

Can anyone help me please?
Thanks
Jan 14 '08 #1
0 1242

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Larry Bates | last post by:
It doesn't happen often, but once in a while I will introduce a syntax error into a Python program I'm working on (in IDLE) and doing File-Check responds with the expected "Failed to check, syntax...
3
by: GeorgeAtkins | last post by:
I am using VS2003 and VB.NET. My project is to locate book titles within a library collection exported into an XML file and edit quiz information related to that book's library record. The "quiz...
7
by: mwt | last post by:
Is there a function in python that does what "locate" does in a bash shell? I know I could do it by using os.popen('locate'), but I'm curious if there's a Python "native" way to go about it....
6
by: Sile | last post by:
Hello, I'm trying to get f2py working from the command line on windows XP. I have mingw32 as my C complier (after some advice on a previous thread) and Compaq Visual Fortran 6.5. Changing my C...
3
by: dwblas | last post by:
The annual Linux Journal survey is online now for any Linux users who want to vote for Python. http://www.linuxjournal.com/node/1006101
3
by: deve8ore | last post by:
Hello, I have built a macro to automatically go to a specific directory and a specific folder, however the names of the files I need to automatically locate change names every month. I.e. - I...
36
by: James Harris | last post by:
Initial issue: read in an arbitrary-length piece of text. Perceived issue: handle variable-length data The code below is a suggestion for implementing a variable length buffer that could be used...
12
by: Jordi | last post by:
I'm getting the following error: Software error: Can't locate object method "new" via package "A::B" at /path/file.cgi line 5. My code is basically this: #!/usr/bin/perl -w use strict; use...
1
by: chaosbuddha | last post by:
Hi! I am trying to set-up mysql-zrm to take backups of a remote mysql server. The mysqlhotcopy command is throwing up the following error: Output of command: 'mysqlhotcopy' is { ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.