1
Good morning, I’m here with a very big question. I’ve been at this all day and I haven’t been able to fix it yet. I have a database in sql server and I need to present some buttons with the records of the description of a table, but note that in this table there are records that can be repeated, in this case I have restaurant 4 times because the restaurant has more than one table. I’ll show you the result print and leave the code here if you can help me.
<head>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<?php
$sql="SELECT P.id as Id,
P.pointOfSale as [Description],
P.printerExtrat1 as PrinterExtrat1,
P.printerExtrat1FonteTicket as PrinterExtrat1Font,
P.printerExtrat2 as PrinterExtrat2,
P.printerExtrat2FonteTicket as PrinterExtrat2Font,
P.printerExtrat3 as PrinterExtrat3,
P.printerExtrat3FonteTicket as PrinterExtrat3Font,
T.id as IdTable,
T.tableDescription as TableDescription
FROM PointOfSale P LEFT
JOIN PointOfSalesTables T ON P.id=T.idPointOfSale and T.isActive=1
WHERE P.isActive=1
ORDER BY P.pointOfSale";
$result = sqlsrv_query($conn, $sql);
while ($row1 = sqlsrv_fetch_array( $result, SQLSRV_FETCH_NUMERIC)) {
$resultado1 = $row1[1];
?>
<body>
<form method="post">
<a class="banquetes"><?php echo $resultado1; ?></a>
</form>
</body>
<?php
}
?>
I can’t show more code due to the confidential links to the database.
I added but I got an error on the sqlsrv_fetch_array() line, which says expects Parameter 1 to be Resource
– Melissa Sousa
This error is a sign that the GROUP was probably put in the wrong position (the order of each SQL clause is specific), or some typing error, and the query failed. Important not only in this case, but in general, print the SQL error during development.
– Bacco
I updated the answer illustrating better
– Bacco