1

Been trying for hours to get data from mysql into my site but i cant figure out what im doing wrong...

Notice: Undefined index: subcatid in C:\xampp\htdocs\website\products.php on line 17

<?php
    $url=$_SERVER['REQUEST_SCHEME']."://".$_SERVER['HTTP_HOST']."/eshopmgk/";

    require_once("connection.php");
    $sql1="select * from prointa where id=".$_GET['catid'];

    mysqli_query($con,'set names "utf8"');

    $recordset=mysqli_query($con,$sql1);    

    $sqla="select * from proionta
            inner join subcatigories on proionta.subcatigories_id=subcatigories.subcatigories_id 
            where subcatigories.subcatigories_alias like  '".$_GET['subcatid']."'";
    $recordsetcannon=mysqli_query($con,$sqla);
?>

.

<div class="col100  products-home-items">
                <?php while($recordcannon=mysqli_fetch_assoc($recordsetcannon)){?>
                    <div class="col25 products-home-item">
                        <div class="col100 items-img">
                            <img width="55%" src="<?=$url?><?=$recordcannon['photos']?>" />
                        </div>
                        <div class="col100 items-title">
                            <a href="#">
                                <p>Φακός</p>
                            </a>
                        </div>
                        <div class="col100 items-category">
                            <a href="<?=$url?>/<?=$_GET['catid']?>/<?=$_GET['subcatid']?>/<?=$recordcannon['proionta_alias']?>"><h3><?=$recordcannon['proionta_name']?></h3></a>                            
                        </div>
                        <div class="col100">                            
                            <div class="col100">
                                <p class="items-price text-center"><?=$recordcannon['proionta_timi']?>&euro;</p>
                            </div>
Lori
  • 1,392
  • 1
  • 21
  • 29
Gregor GoG
  • 19
  • 1
  • Where are you getting that `subcatid` index of your $_GET? – Roshan Feb 04 '19 at 01:55
  • 3
    why is this question getting two upvotes for an obvious dupe? – Jeff Feb 04 '19 at 02:01
  • @Roshan its for the database i have , subcatigories , subcat – Gregor GoG Feb 04 '19 at 02:01
  • 1
    Tips on debugging: Show us the incoming URL. Do `print_r($_GET);` to see if there is a subcatid in the incoming URL. What if the user does not fill in that part of the form? Let's see the form. You code is very dangerous, with respect to "SQL Injection" (a way a hacker could take over or kill your server). `echo $sqla` so we can see the query. – Rick James Feb 04 '19 at 03:37

0 Answers0