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

    query con variabile char

    ciao a tutti
    ho un problema con php. devo fare una query che in mysql è

    SELECT ora FROM `guasto` WHERE codice_macchina = 1018 and Min_riparazione = 9 and Settore_guasto = "Elettrico" order by numero_guasto desc limit 0,1

    e funziona. Il problema è che io devo metterci delle variabili come valori dei campi cioè tipo

    $query1= 'SELECT ora FROM `guasto` WHERE `codice_macchina` ='.$macchina.' and Min_riparazione = '.$minuti.' and Settore_guasto = '.$settore.' ORDER BY numero_guasto DESC LIMIT 0,1';

    ma non funziona. credo perchè $settore è una stringa di caratteri infatti con mysql devo usare le "" ma come si fa con php? grazie infinite
    I may never prove what I know to be truth but I know that I still have to try

  2. #2
    Utente di HTML.it L'avatar di Il_Drugo
    Registrato dal
    May 2006
    Messaggi
    1,220
    Codice PHP:
    $query1"SELECT ora FROM `guasto` WHERE `codice_macchina` ='".$macchina."' and Min_riparazione = '".$minuti."' and Settore_guasto = '".$settore."' ORDER BY numero_guasto DESC LIMIT 0,1"


  3. #3
    grazie mille!!!!!
    I may never prove what I know to be truth but I know that I still have to try

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.