Note that there are some explanatory texts on larger screens.

plurals
  1. POUndefined index:trying to make a 'details' page with $_GET
    primarykey
    data
    text
    <p>I am making a project for one course and I need to make a prototype of a movie website with all the artists and movies. I need to display the results of the search by the name of the artist and to make a link to a page with more details about the artist. Part of code for search page:</p> <pre><code> elseif ($method=='artist') { $x=0; $query = "SELECT artistId, image, firstname,lastname,dateOfBirth,otherInfo FROM $artists WHERE CONCAT(firstname, ' ', lastname) LIKE '%$kword%' OR lastname LIKE '%$kword%' or firstname like '%$kword%'"; mysqli_select_db($connect, $mydb); $result = mysqli_query($connect, $query); if($result) { print '&lt;table &gt;'; while ($sqlRow=mysqli_fetch_array($result, MYSQL_ASSOC)) { $x++; echo "&lt;tr&gt;"; echo "&lt;td rowspan=\"3\" id=\"image\"&gt;"; echo '&lt;img src="' . $sqlRow['image'] . '" alt="alt"&gt;'; echo"&lt;/td&gt;"; echo "&lt;td id=\"title\"&gt;&lt;strong&gt;&lt;a href=artist_details.php?id=".$sqlRow['artistId']."&gt;".$sqlRow['firstname']." ".$sqlRow['lastname']."&lt;/strong&gt;&lt;/td&gt;"; echo "&lt;/tr&gt;"; echo "&lt;tr&gt;"; echo "&lt;td id=\"date\"&gt;&lt;strong&gt;".$sqlRow['dateOfBirth']."&lt;/strong&gt;&lt;/td&gt;"; echo "&lt;/tr&gt;"; echo "&lt;tr&gt;"; echo "&lt;td id=\"desc\"&gt;".$sqlRow['otherInfo']."&lt;/td&gt;"; echo "&lt;/tr&gt;"; } print '&lt;/table&gt;'; if ($x==0) { echo "&lt;h4&gt;"; echo "No matches found"; echo "&lt;/h4&gt;"; } } } </code></pre> <p>The code for the details page:</p> <pre><code>$query = "SELECT artistId, image, firstname,lastname,dateOfBirth,otherInfo FROM $artists WHERE artistId=".$_GET['artistId']; mysqli_select_db($connect, $mydb); $result = mysqli_query($connect, $query); if($result) { print '&lt;table &gt;'; while ($sqlRow=mysqli_fetch_array($result, MYSQL_ASSOC)) { $x++; echo "&lt;tr&gt;"; echo "&lt;td rowspan=\"3\" id=\"image\"&gt;"; echo '&lt;img src="' . $sqlRow['image'] . '" alt="alt"&gt;'; echo"&lt;/td&gt;"; echo "&lt;td id=\"title\"&gt;&lt;strong&gt;&lt;a href=\"artist_detail.php?id=".$sqlRow['artistId']."\"&gt;".$sqlRow['firstname']." ".$sqlRow['lastname']."&lt;/strong&gt;&lt;/td&gt;"; echo "&lt;/tr&gt;"; echo "&lt;tr&gt;"; echo "&lt;td id=\"date\"&gt;&lt;strong&gt;".$sqlRow['dateOfBirth']."&lt;/strong&gt;&lt;/td&gt;"; echo "&lt;/tr&gt;"; echo "&lt;tr&gt;"; echo "&lt;td id=\"desc\"&gt;".$sqlRow['otherInfo']."&lt;/td&gt;"; echo "&lt;/tr&gt;"; } print '&lt;/table&gt;'; } </code></pre> <p>Every time I get the same error:Undefined index: artistId. I would be really grateful for your help! :)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload