Visualizzazione dei risultati da 1 a 10 su 10

Discussione: query php

  1. #1

    query php

    ciao a todos... qualcuno può aiutarmi? devo estrarre l'ultimo record di un campo da una tabella che ha valori definiti di altri campi... lo so, non sono stato chiaro... ora mi spiego meglio. In pratica è come se io dovessi fare così:

    $query1= 'SELECT * FROM `guasto` ORDER BY numero_guasto DESC LIMIT 1 where `codice_macchina` ='.$macchina ;

    ma mi da errore... qualcuno mi può dire come devo fare? grazie tante
    I may never prove what I know to be truth but I know that I still have to try

  2. #2
    prova con ...LIMIT 0,1

  3. #3
    non va...
    I may never prove what I know to be truth but I know that I still have to try

  4. #4
    il where non lo puoi fare prima? in un'altra query?
    http://codecanyon.net/category/all?ref=Manuelandro
    And I bet she told a million people that she'd stay in touch, Well all the little promises they dont mean much,When theres
    memories to be made

  5. #5
    Codice PHP:
    $query1'SELECT * FROM `guasto` where `codice_macchina` ='.$macchina.' ORDER BY numero_guasto DESC LIMIT 0,1' 

  6. #6
    pensandoci un attimo

    se fai così? :berto:

    Codice PHP:
    $query1"SELECT * FROM guasto where codice_macchina ='$macchina' ORDER BY numero_guasto DESC LIMIT 0,1"
    http://codecanyon.net/category/all?ref=Manuelandro
    And I bet she told a million people that she'd stay in touch, Well all the little promises they dont mean much,When theres
    memories to be made

  7. #7
    ecoo le mie prove e i risultati

    $query1= 'SELECT ora FROM `guasto` where `codice_macchina` = ' .$macchina. 'ORDER BY numero_guasto DESC LIMIT 0,1';

    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in c:\programmi\easyphp1-8\www\registra.php on line 35

    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in c:\programmi\easyphp1-8\www\registra.php on line 49



    $query1= 'SELECT ora FROM `guasto` where `codice_macchina` = ' $macchina 'ORDER BY numero_guasto DESC LIMIT 0,1';

    Parse error: parse error in c:\programmi\easyphp1-8\www\registra.php on line 32

    come posso fare??? javascript:void(0);
    Piange
    I may never prove what I know to be truth but I know that I still have to try

  8. #8
    è giusta la prima, basta solo che ci metti lo spazio prima di ORDER BY, dopo aver aperto gli apici..

    su però, un po' di impegno...

  9. #9
    javascript:void(0);
    Metallica
    FUNZIONA!!!!!!! GRAZIE LORYZZ!!!!!!! non avevo fatto caso al mancato spazio.... ti ringrazio infinitamente.........
    ciao ciao

    javascript:void(0);
    Ciauz
    I may never prove what I know to be truth but I know that I still have to try

  10. #10
    mi fa piacere

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.