Parsing MySQL query return

Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default Parsing MySQL query return

    Hey All,

    I have a question regarding parsing text from a MySQL query. Basically, I
    have several paragraphs of text in a field in MySQL. I run a query, get the
    results, no problem. However, I would like to only display the first
    paragraph of the data returned.

    What is the best way to do this?

    Thanks,
    John



    John Guest

  2. Similar Questions and Discussions

    1. PARSING A QUERY OF QUERY WITH A VARIABLE VALUE
      On my first page the user selects a project. I am using the variable SelectedProject: <cfset SelectedProject =...
    2. Parsing return message from fetchmail
      Hello, I was wondering if anyone knew of a perl module that could parse the return of a fetchmail. When fetchmail the unix command returns its...
    3. mySQL query taking too long to return
      Greetings, I'm using mySQL in a VB.NET application, connecting it through the myOLEDB Provider. However, it's taking way too long to retrieve...
    4. MySQL Query Cache Not Working: MySQL 5 / Windows XP
      Please excuse this post if you've already read it on mailing.database.mysql - i just discovered these other groups. future posts will be...
    5. error parsing dataset upon return from webservice
      Found the problem shortly after posting: The submitted dataset had runtime properties added to some datacolumns (expressions added). These cause...
  3. #2

    Default Re: [PHP] Parsing MySQL query return

    ----- Original Message -----
    From: "John" <jpoz@quickscribble.com>
    To: <php-general@lists.php.net>
    Sent: Monday, July 28, 2003 8:22 PM
    Subject: [PHP] Parsing MySQL query return

    > Hey All,
    >
    > I have a question regarding parsing text from a MySQL query. Basically, I
    > have several paragraphs of text in a field in MySQL. I run a query, get
    the
    > results, no problem. However, I would like to only display the first
    > paragraph of the data returned.
    >
    > What is the best way to do this?
    That depends on te format of the text/paragraphs in the mysql field.
    How are the paragraphs separated ?



    regards,
    Ewout

    Ewout De Boer Guest

  4. #3

    Default Re: [PHP] Parsing MySQL query return

    I'm using someone elses data here (inheriting). But it looks like it was
    typed into the field, possibly using PHPMyADMIN. I would assume the
    paragraphs are just seperated by carriage returns. Is there a way to tell
    for sure?

    John


    "Ewout De Boer" <ewout@chemistry-interactive.nl> wrote in message
    news:005901c3553a$0751eea0$0200410a@soyuz...
    > ----- Original Message -----
    > From: "John" <jpoz@quickscribble.com>
    > To: <php-general@lists.php.net>
    > Sent: Monday, July 28, 2003 8:22 PM
    > Subject: [PHP] Parsing MySQL query return
    >
    >
    > > Hey All,
    > >
    > > I have a question regarding parsing text from a MySQL query. Basically,
    I
    > > have several paragraphs of text in a field in MySQL. I run a query, get
    > the
    > > results, no problem. However, I would like to only display the first
    > > paragraph of the data returned.
    > >
    > > What is the best way to do this?
    >
    > That depends on te format of the text/paragraphs in the mysql field.
    > How are the paragraphs separated ?
    >
    >
    >
    > regards,
    > Ewout
    >

    John Guest

  5. #4

    Default Re: [PHP] Parsing MySQL query return

    If you assume either \n or \n\n as the para delimiters then you could use
    strpos (see function.strpos.html) to work out where to split the text. If the
    text field contents are huge, you might consider limiting the query results
    by using left( field, size ) in the query.

    KR

    N
    On Monday 28 Jul 2003 7:57 pm, Ewout de Boer wrote:
    > ----- Original Message -----
    > From: "John" <jpoz@quickscribble.com>
    > To: <php-general@lists.php.net>
    > Sent: Monday, July 28, 2003 8:22 PM
    > Subject: [PHP] Parsing MySQL query return
    >
    > > Hey All,
    > >
    > > I have a question regarding parsing text from a MySQL query. Basically, I
    > > have several paragraphs of text in a field in MySQL. I run a query, get
    >
    > the
    >
    > > results, no problem. However, I would like to only display the first
    > > paragraph of the data returned.
    > >
    > > What is the best way to do this?
    >
    > That depends on te format of the text/paragraphs in the mysql field.
    > How are the paragraphs separated ?
    >
    >
    >
    > regards,
    > Ewout
    Nicholas Robinson Guest

  6. #5

    Default Re: [PHP] Parsing MySQL query return

    On Tuesday 29 July 2003 04:16, John wrote:
    > I'm using someone elses data here (inheriting). But it looks like it was
    > typed into the field, possibly using PHPMyADMIN. I would assume the
    > paragraphs are just seperated by carriage returns. Is there a way to tell
    > for sure?
    Yes, examine the contents.

    --
    Jason Wong -> Gremlins Associates -> [url]www.gremlins.biz[/url]
    Open Source Software Systems Integrators
    * Web Design & Hosting * Internet & Intranet Applications Development *
    ------------------------------------------
    Search the list archives before you post
    [url]http://marc.theaimsgroup.com/?l=php-general[/url]
    ------------------------------------------
    /*
    I don't want to be young again, I just don't want to get any older.
    */

    Jason Wong Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139