Element clicked id= select*from 'id'

Hello all. I need to know if I can use ul onclick in external.js to make an Ajax call to file.php that executes mysql_query select * from ‘id’ of the li element clicked.
UL EG.


<ul id="jewelry">
<li id="silver>Silver Jewelry</li>
<li id="gold">Gold Jewelry</li>
<li id="silverwithstones">Silver with stones</li>
</ul>

file.php


mysql_query=SELECT*FROM '.id.' etc.

Thanks in advance for any thoughts:eye:

Which js framework?

Good question? I’m runing on WIN XP sp3 IE8 with all the latest updates. How would I find out?

Ok, if you are asking that question you are in way over your head. Learn basic PHP first, then worry about AJAX.

I’m sure you can. But what is the question exactly? How to make an ajax call (javascript)? Or how to retrieve data from the database (php)?

guido2004
Nice replly. This is the javascript ul onclick that I have
External.js


function getjewelry(i){
if(' '==='i'){
document.getElementById('f1').innerHTML=' ';
}
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("f1").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","getproduct.php?q="+i,true);
xmlhttp.send();
}
 
var jewelry= document.getElementById('jewelry').childNodes;   
for (i = 0; i < jewelry.length; i++) {   
if (jewelry[i].className == 'item') {  // excludes class="item disabled" 
jewelry[i].onclick = function() {   
alert(this.id+': Is sending your request.');  // this actually gets the right id
var i=this.id;
alert(i); //alerts correct id
getjewelry('i');
document.title==i+' jewelry';//not sure that worked no alert
alert(document.title);
document.getElementById('f1').className=i;//just checking the i is silver
alert(document.getElementsByTagName('div')[6].className);//div class=silver
}   
}   
}

getproduct.php


$q=$_GET["q"]; // Undefined index:'q' at line 2

$link=mysql_connect("localhost","root","root")or die(mysql_error( ));

mysql_select_db("bwi",$link) or die(mysql_error( ));

$query=mysql_query("SELECT * FROM [B]'.q.'[/B]")or die(mysql_error( ));
//the bold draws error syntax check sql version syntax etc.

:injured::shifty::nono: