Visualizzazione dei risultati da 1 a 8 su 8
  1. #1

    prelevare le prime X parole da un testo

    Salve a tutti, come da topic è possibile prelevare le prime X parole da un testo?
    E X caratteri sempre da un testo?

    ciao

  2. #2
    Utente bannato
    Registrato dal
    Aug 2001
    Messaggi
    696
    il testo è in un db?

  3. #3
    Originariamente inviato da bubu sette sette
    il testo è in un db?
    Si

  4. #4
    Utente bannato
    Registrato dal
    Aug 2001
    Messaggi
    696
    SUBSTRING(str,pos)
    SUBSTRING(str FROM pos)
    SUBSTRING(str,pos,len)
    SUBSTRING(str FROM pos FOR len)
    The forms without a len argument return a substring from string str starting at position pos. The forms with a len argument return a substring len characters long from string str, starting at position pos. The forms that use FROM are standard SQL syntax. mysql> SELECT SUBSTRING('Quadratically',5);
    -> 'ratically'
    mysql> SELECT SUBSTRING('foobarbar' FROM 4);
    -> 'barbar'
    mysql> SELECT SUBSTRING('Quadratically',5,6);
    -> 'ratica'

    This function is multi-byte safe.
    SUBSTRING_INDEX(str,delim,count)
    Returns the substring from string str before count occurrences of the delimiter delim. If count is positive, everything to the left of the final delimiter (counting from the left) is returned. If count is negative, everything to the right of the final delimiter (counting from the right) is returned. mysql> SELECT SUBSTRING_INDEX('www.mysql.com', '.', 2);
    -> 'www.mysql'
    mysql> SELECT SUBSTRING_INDEX('www.mysql.com', '.', -2);
    -> 'mysql.com'

    This function is multi-byte safe.

  5. #5
    Utente bannato
    Registrato dal
    Aug 2001
    Messaggi
    696
    quindi
    SUBSTRING_INDEX(nome_campo, ' ', 30)

    seleziona le prime 30 parole

  6. #6
    Originariamente inviato da bubu sette sette
    quindi
    SUBSTRING_INDEX(nome_campo, ' ', 30)

    seleziona le prime 30 parole
    E' standard SQL?

  7. #7
    Utente bannato
    Registrato dal
    Aug 2001
    Messaggi
    696
    non saprei

  8. #8
    Originariamente inviato da bubu sette sette
    non saprei
    Una funzione PHP che posso utilizzare per fare la stessa cosa?

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.