Note that there are some explanatory texts on larger screens.

plurals
  1. POclick on a link in a table, then check in what row the link was
    primarykey
    data
    text
    <p>What I want to make is this:</p> <p>I am making a blog. Now I want a query in my mysql-database that finds all the information that is in there. After that it should echo the title's of the blog's on my site in a table.</p> <p>Then I would like to give people a choice which blog they would like to see. So when they click on the first title they will see the content of that blog.</p> <p>So now the problem is that I don't know how I can make href's on every title that all go to another php file. In that file it should know which row/title is clicked and then it should make another query in the database that will find the content of that title. Then it should echo it on the site.</p> <p><strong>I got the table finished. I also know how to make the href's to the other page. the only thing I need to know is which title/href is clicked.</strong></p> <p>Is it possible to make this with php only? if yes, please explain me how.</p> <p>I hope I am clear in what i would like to make.</p> <p>EDIT: this is my code so far:</p> <pre><code> &lt;?php session_start(); $connectie = mysql_connect('localhost', 'root', 'usbw'); if ($connectie == false){ echo 'Er is iets fout gegaan met de connectie van de database'; } if (mysql_select_db('dldatabase', $connectie) == false) { echo 'Er kon geen verbinding met de database gemaakt worden'; } $query = "Select * from forum"; $resultaat = mysql_query($query, $connectie); echo "&lt;table border='1'&gt; &lt;tr&gt; &lt;th&gt;Tijd&lt;/th&gt; &lt;th&gt;Gebruikersnaam&lt;/th&gt; &lt;th&gt;Titel&lt;/th&gt; &lt;/tr&gt;"; `while($row = mysql_fetch_array($resultaat)) { $_SESSION['row'] = $row; echo "&lt;tr&gt;"; echo "&lt;td&gt;" . $row['Tijd'] . "&lt;/td&gt;"; echo "&lt;td&gt;" . $row['Gebruikersnaam'] . "&lt;/td&gt;"; echo "&lt;td&gt;" . '&lt;a class="formtitellink" href="forumdocument.php"&gt;' . $row['Titel'] . '&lt;/a&gt;' . "&lt;/td&gt;"; echo "&lt;/tr&gt;"; } echo "&lt;/table&gt;";` </code></pre> <p>this is the blog page</p> <p>and this is where the content of the blog should be±</p> <pre><code>session_start(); $row = $_SESSION['row']; $row = $row + 1; $query = "Select titel, inhoud from forum where `ID` = '$row'"; $resultaat = mysql_query($query, $connectie); echo "$resultaat"; </code></pre>
    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