0

I dont have problem with html and css, i will fix them, but in my screen they dont display the content of the database, but lines of code

Connecting to database:

mysql_connect("sth.gr", "sth", "sth123")or die("cannot connect");
mysql_select_db("sth");
mysql_query("set names 'utf8'");

$today=date("Y-m-d");

SQL query

$sql = "SELECT FLINES.FLINES,
       LMAST.NAME,
       FDOC.FDOC,
       FLINES.COMMENTS AS FLCOMMENTS,
       FLINES.QTY1,
       SUBSTRING(FDOC.TRNDATE,1,10) AS TRNDATE,
       FLINES.SE1_START,
       TIMESTAMPDIFF(MINUTE,SE1_START,SE1_END) AS DIFERENCE
FROM FLINES
INNER JOIN FDOC ON FDOC.FDOC=FLINES.FDOC
INNER JOIN LMAST ON LMAST.LMAST=FDOC.LMAST
INNER JOIN SMAST ON SMAST.SMAST=FLINES.SMAST
WHERE TRNDATE >= '$today'
  AND SMAST.U_SE1='true'
  AND FLINES.SE1_END IS NULL
ORDER BY TRNDATE,
         FDOC,
         FLINES
";

I put the query in a variable in order to fetch every row above

$stmt = mysql_query( $sql );
if ($stmt->connect_error) {
    die("Connection failed: " . $stmt->connect_error);
}

The results from above i'm going to style with html and css, i will create a table with all these

while($row = mysql_fetch_array($stmt)) {
    if ($temp_FDOC!=$row[FDOC]) { 
        echo $row[NAME];            
        $j=0; 
    }
    echo $j=$j+1; 
    echo $row[FLCOMMENTS]; 
    echo $row[QTY1]; 

Here are some buttons

    if($row[SE1_START]==NULL) { 
        echo '<button name="flines_id_start" value="<? echo $row[FLINES];?>" type="submit">ΞΕΚΙΝΑΩ</button>';
    } else {
        echo '<button name="flines_id_end" value="<? echo $row[FLINES];?>" type="submit">ΕΤΟΙΜΟ</button>';
        echo '<button name="flines_id_again" value="<? echo $row[FLINES];?>" type="submit">ΕΠΑΝΕΚΚΗΝΙΣΗ</button>';
    } 
    $temp_FDOC=$row[FDOC];
};

mysql_free_result( $stmt);
Lasse Sviland
  • 1,479
  • 11
  • 23
Miltos
  • 1
  • `` ==> ` –  Apr 10 '17 at 21:20
  • thank thats one mistake...now it displays me this: Uncaught Error: Call to undefined function mysql_connect() in C:\xampp\htdocs\miltos_test.php:3 Stack trace: #0 {main} thrown in C:\xampp\htdocs\miltos_test.php on line 3 – Miltos Apr 10 '17 at 21:22
  • mysql_* has been removed from php7, and even if your using php 5, dont use it –  Apr 10 '17 at 21:27
  • If your on the php7 the mysql is no longer included. You will need to move to mysqli functions. – Jason K Apr 10 '17 at 21:27

0 Answers0