please help me to find out where i am doing mistake in this code? i wnat retieve the value that i am
Posted
by user309381
on Stack Overflow
See other posts from Stack Overflow
or by user309381
Published on 2010-04-07T00:45:14Z
Indexed on
2010/04/07
5:33 UTC
Read the original article
Hit count: 281
function reload(form) { var val = $('seltab').getValue();
new Ajax.Request('Website.php?cat=' +escape(val),
{
method:'get',
onSuccess: function(transport){
var response = transport.responseText ;
$("MyDivDB").innerHTML = transport.responseText ;
alert("Success! \n\n" + response);
},
onFailure: function(){ alert('Something went wrong...') }
});
}
</script>
</head>
title author pages
$con = mysql_connect($dbhostname,$dbuserid,$dbpassword);
if(!$con)
{
die ("connection failed".mysql_error());
}
$db = mysql_select_db($dbname,$con);
if(!$db)
{
die("Database is not selected".mysql_error());
}
$query ="SELECT * FROM books NATURAL JOIN authors" ;
$result = mysql_query($query);
if(!$query)
{
die("Database is not query".mysql_error());
}
while($row = mysql_fetch_array($result,MYSQL_ASSOC))
{
$title = $row["title"];
$author = $row["author"];
$page = $row["pages"];
echo "<tr>";
echo "<td>$title</td>";
echo "<td>$author</td>";
echo "<td>$page</td>";
echo "</tr>";
}
print "</table>";
echo "<select id = seltab onchange = 'reload(this.form)'>";
$querysel = "SELECT title_id,author FROM authors NATURAL JOIN books";
$result1 = mysql_query($querysel) ;
while($rowID = mysql_fetch_assoc($result1))
{
$TitleID = $rowID['title_id'];
$author = $rowID['author'];
print "<option value = $author>$author\n";
print "</option>";
}
print "</select>";
?>
Wbsite.php
© Stack Overflow or respective owner