Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I get the row of a certain link in a table with data from a mysql database?
    text
    copied!<p>Here is my code:</p> <pre><code>&lt;html&gt; &lt;?php DEFINE('DATABASE_USER', 'sfasdfasd'); DEFINE('DATABASE_PASSWORD', 'asdfasdfasdf'); DEFINE('DATABASE_HOST', 'sdfasdfasd'); DEFINE('DATABASE_NAME', 'dsafsdfasd'); $connect = mysql_connect(DATABASE_HOST, DATABASE_USER, DATABASE_PASSWORD, DATABASE_NAME) or die ("Hey loser, check your server connection."); mysql_select_db("minedb"); $query = "SELECT * FROM ideastable ORDER BY datee DESC"; $quey1="select * from ideastable"; $result=mysql_query($query) or die(mysql_error()); ?&gt; &lt;table border=1 style="background-color:#000000;" &gt; &lt;caption&gt;&lt;EM&gt;Ideas List&lt;/EM&gt;&lt;/caption&gt; &lt;tr&gt; &lt;th&gt;IDEAS&lt;/th&gt; &lt;th&gt;Thumbs Ups&lt;/th&gt; &lt;/tr&gt; &lt;?php while($row=mysql_fetch_array($result)){ echo "&lt;/td&gt;&lt;td&gt;"; echo $row['idea']; echo "&lt;/td&gt;&lt;td&gt;"; echo $row['thumbsup']; $i = $row['id']; echo $i; echo '&lt;a href="#" onClick="doSomething()"&gt;Thumbs Up!&lt;/a&gt;'; echo "&lt;/td&gt;&lt;/tr&gt;"; } echo "&lt;/table&gt;"; ?&gt; &lt;SCRIPT type="text/javascript" src="jquery.min.js"&gt;&lt;/SCRIPT&gt; &lt;SCRIPT type="text/javascript"&gt; function doSomething() { var myVar = "&lt;?php echo $i; ?&gt;"; alert(myVar); $.load('uts.php?i=myVar'); return false; } &lt;/SCRIPT&gt; &lt;/html&gt; </code></pre> <p>My question is how would I be able to make it so that when I click the Thumbs Up it recognizes the row the link was in? I am making a site where you can rate some of the objects in a database and that is the start up of it.</p>
 

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