0
I need to make available on an Opencart information page 2 price table files, where one is for retail and the other for wholesale. The page that will show the link is only accessed if the customer logs in, now I would like that if it is registered as retail have access only to the link of table V, but if it is registered as attacked it just see the link to the table A. The client registration table is called Custumer and the column indicating the group id is group_id, the id for Retail is 1 and for Wholesale is 2. I would like the experts to help me because I’m starting with PHP now and it’s very difficult to do that. Thank you.
Since the page where I want to enter the code is already within a session I was going to skip this check, so I thought:
<?php
// Verificar se o grupo é menor que 2
$consulta_grupo = "SELECT * FROM customer WHERE group_id < 2";
if ( empty($consulta_grupo)) {
$linkvarejo = "<a href="http://localhost/tabelavarejo.pdf">Tabela Varejo</a>";
} else {
$linkatacado = "<a href="http://localhost/tabelaatacado.pdf">Tabela Atacado</a>"; }
?>
just do an if. show what you’ve tried to do
– Victor Eyer
Since the page where I want to enter the code is already inside a session I was going to skip this check, so I thought: <? php $consulta_group = "SELECT * FROM Customer WHERE customer_group_id < 2";
– Marcelo
You thought right, but I don’t see any sense in the underage sign
<
, would be much simpler just= 1
or= 2
. That’s all your doubt was?– Costamilam
my full comment Since the page where I want to insert the code is already inside a session I was going to skip this check, so I thought: <? php // Check that the group is less than 2 $consulta_group = "SELECT * FROM Customer WHERE group_id < 2"; // Pórem do not know how to use if ( Empty($consulta_group)) { $linkwholesale = "tableelawholesale.pdf"; } Else { $linkvarejo = "tableretail.pdf": ?>
– Marcelo
I thought to use < 2 to indicate that the group_id is retail and that should show the retail link and if it was bigger the wholesale one
– Marcelo
put the code in the question of what you have already tried to do. Show the queries to the database that pull the value of the user group
– Victor Eyer
I already added to the question what I tried to do
– Marcelo