thank
Posted: Wed Jan 12, 2011 5:04 am
hi friends....
Finally i finished my work with all urs help,,,thaks a lot,,,,, now the problem is ,,, i run this code in MAMP it runs perfectlyy,,,but when i am try to run this code in WAMP it shows error message(You have error on sql syntax near ')
Finally i finished my work with all urs help,,,thaks a lot,,,,, now the problem is ,,, i run this code in MAMP it runs perfectlyy,,,but when i am try to run this code in WAMP it shows error message(You have error on sql syntax near ')
Code: Select all
<html>
<body>
<?php
session_start() or die("errror");
include "tacre.php";
$da= "show tables";
$ds=mysql_query($da) or die("Error While retreiving tables". mysql_error());
$t=0;
$dar=array();
while($er=mysql_fetch_assoc($ds))
{
//print $er['Tables_in_gm']."<br>";
$dar[$t]=$er['Tables_in_gm'];
$t++;
}
echo "<br>";
echo '<form name=for method=get action="nload.php">';
echo 'Enter the user name: <input type=text name=uname style="position:absolute;left:160px"><br><br>
Enter the mail id: <input type=text name=eid style="position:absolute;left:160px"> <br>
<br>';
echo "Select the group you want to add =>";
echo '<select id=ty name=group onChange="show();">';
echo "<OPTION > None</option>";
foreach ($dar as $key => $value)
{
echo "<OPTION value='".$value."'> $value</option>";
}
echo "</select>";
echo '<input type=submit name=but style="position:absolute;left:140px;top:150px" value=Add><br>';
echo '</form>';
$rt=trim((String)'<script language=javascript>
function show()
{
var show=document.getElementById("ty").options[document.getElementById("ty").selectedIndex].value;
document.write(show);
}
</script>');
//$_SESSION['tab']= $rt;
//echo $rt;
$un=$_GET['uname'];
$e=$_GET['eid'];
$w=$_GET['group'];
if(isset($_GET[but]))
{
$sql="insert into $w values ('".$un."','".$e."')";
if(mysql_query($sql,$con) or die("<br>error in insertion ".mysql_error()))
echo "Successfully Added";
}
?>
<br>
<a href="home.php">Goto home page</a>
</body>
</html>