muneer_alam 0 Newbie Poster
<?php include("connect.php");?>
<?php include("cityname.php");?>
<?php // select from city
$query= "select city_id from city where(city_name='$city_name')";
//exe query
$result=mysql_query($query) or die();
$row=mysql_fetch_array($rsult);
$city_id=$row['city_id'];
// then insert into location
if($city_id){
$l_id=$_POST['l_id'];
$location=$_POST['location'];
$q = "INSERT INTO location (loc_id,city_id,loc_city)VALUES('','$city_id','$location')";
$re=mysql_query($q) or die (mysql_error());
if($re){
echo "roger that";
}
}
?>

when i am using this code following i find this code

Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\xampp\htdocs\newzstreet\addloc1.php on line 29

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in C:\xampp\htdocs\newzstreet\addloc1.php on line 29


currently i am using Apache server

muneer_alam 0 Newbie Poster

Error SummaryHTTP Error 500.0 - Internal Server ErrorThe page cannot be displayed because an internal server error has occurred.Detailed Error InformationModule FastCgiModule
Notification ExecuteRequestHandler
Handler PHP_via_FastCGI
Error Code 0x00000000
Requested URL http://localhost:80/muneer/newzstreet/addloc1.php
Physical Path C:\inetpub\wwwroot\muneer\newzstreet\addloc1.php
Logon Method Anonymous
Logon User Anonymous

HOw can i remove this error?......I am using IIS server not apache.....

muneer_alam 0 Newbie Poster

How can i apply Role based Access control in php ..........

muneer_alam 0 Newbie Poster

My problem is not resolved yet when i am running this code a problem is displaying

HTTP Error 500.0 - Internal Server ErrorThe page cannot be displayed because an internal server error has occurred.

what is this error????/

muneer_alam 0 Newbie Poster

in my city table there are two entry
city_id 1,2
city_name noida ,lucknow
city_status true,true

in my location table this is empty.....because i am inserting this...

muneer_alam 0 Newbie Poster

i am using mysql and iis for running application.....all are current version...

(if no, make sure you have data in the database for your query.) what is the meaning of this...........

muneer_alam 0 Newbie Poster

this is working very fine....which output i want

muneer_alam 0 Newbie Poster

A very very thanks for this code this is very helpfull.....

muneer_alam 0 Newbie Poster

Thanks for your reply

is this correct or wrong method........if wrong then try to correct this....

muneer_alam 0 Newbie Poster
<?PHP
if (isset($_POST['Submit']))
{
$selected_radio = $_POST['page'];

if ($selected_radio = = 'admin') 
{
echo "include("adminfetch.php")";
}
else if ($selected_radio = = 'customer') 
{
echo "include("customerfetch.php")";
}
}

?>

this is my code..

muneer_alam 0 Newbie Poster

Hello all of you,,,,,,,,

Currently i am facing a problem.....problem is that.i am using two table admin or customer.I have one form.....i want when i select admin button then it will insert the values into admin table and when i will select customer button then it will insert into the customer table....here is my form.....

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<form name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td colspan="3"><strong> Login Page </strong></td>
</tr>
<tr>
<td width="78">Username</td>
<td width="6">:</td>
<td width="294"><input name="username" type="text" id="myusername"></td>
</tr>
<tr>
<td>Password</td>
<td>:</td>
<td><input name="password" type="text" id="mypassword"></td>
</tr>
<tr>
<td><INPUT TYPE="radio" NAME="page" VALUE="admin" <?PHP print $admin_status; ?> >Admin</td><td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td><INPUT TYPE="radio" NAME="page" VALUE="customer" <?PHP print $customer_status; ?> >Customer</td>

</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><input type="submit" name="Submit" value="Login"></td>
</tr>
</table>
</td>
</form>
</tr>
</table>
</body>
</html>

i do not want to insert the value of radio button......

plz reply me.....

muneer_alam 0 Newbie Poster

Thanks for your reply but i have tried this one also there was no result.is there any problem on my code or query......

plz reply me....

muneer_alam 0 Newbie Poster

Query failed: Access denied for user 'ODBC'@'localhost' (using password: NO)


when i am accessing file addloc1.php

plz find as soon as possible....

muneer_alam 0 Newbie Poster

Here is my code which i am using here...........
droplistcity.php

<html>
<head>
<script language="JavaScript">
function onChange() {
  var Current=document.form1.select1.selectedIndex;
  document.form1.currentText3.value=document.form1.select1.options[Current].text;
}
</script>
</head>
<body>
<form name="form1" method="POST">
<?php include("connect.php")?>
<table border="1" align="center">
<tr><td>List of City</td>
<td><select name="select1" onChange="onChange()">
    <option value="">Select City</option>
<?php
 $reza=mysql_query("select city_id,city_name from city order by city_id");
                    while ($row=mysql_fetch_array($reza)){
					   $id1=$row["city_id"];
                      $id2=$row["city_name"];
                      
				 echo "<option value=\"$id2\">$id2</option>";
                    }
mysql_close($con);
?>
</select></td>
</tr>
<tr><td>Selected City</td>
<td><input
  name="currentText3"
  type="text"
  value=""
></td>
</tr></form>
</body>
</html>

cityname.php

<?php include("connect.php");?>
<?php 
$city_name = $_POST['currentText3'];
$result=mysql_query("select * from city where city_name='$city_name'");
while($row = mysql_fetch_array($result))
  {
  echo $row['city_name'] ;
  echo "<br />";
  }
mysql_close($con);
?>

addloc.php

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form name="form1"action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<table border="1" align="center">
<input type="hidden"  name="l_id" />
<tr>
<?php include("droplistcity.php");?>
</tr>
<tr>
<td>Location Name</td>
<td><input type="text" name="location" /></td></tr>
<tr>
<td></td><td><input type="submit" value="added!">
</td>
</tr>
</table>
</form>
</body>
</html>
<?php include("connect.php");?>
<?php include("cityname.php");?>

<?php
$l_id = $_POST['l_id'];
$city_id = $_POST['city_name'];
$location = $_POST['location'];
$query = "INSERT INTO location (loc_id, city_id,loc_city) VALUES('$l_id',(SELECT city_id FROM city WHERE city_id = '$city_id'),'$location')";
$result = mysql_query($query) or die("Query failed: ".mysql_error());
mysql_close($con);
?>



here is my all code........plz reply as soon as possible.......
muneer_alam 0 Newbie Poster

Here is my code which i am using here...........
droplistcity.php

<html>
<head>
<script language="JavaScript">
function onChange() {
  var Current=document.form1.select1.selectedIndex;
  document.form1.currentText3.value=document.form1.select1.options[Current].text;
}
</script>
</head>
<body>
<form name="form1" method="POST">
<?php include("connect.php")?>
<table border="1" align="center">
<tr><td>List of City</td>
<td><select name="select1" onChange="onChange()">
    <option value="">Select City</option>
<?php
 $reza=mysql_query("select city_id,city_name from city order by city_id");
                    while ($row=mysql_fetch_array($reza)){
					   $id1=$row["city_id"];
                      $id2=$row["city_name"];
                      
				 echo "<option value=\"$id2\">$id2</option>";
                    }
mysql_close($con);
?>
</select></td>
</tr>
<tr><td>Selected City</td>
<td><input
  name="currentText3"
  type="text"
  value=""
></td>
</tr></form>
</body>
</html>

cityname.php

<?php include("connect.php");?>
<?php 
$city_name = $_POST['currentText3'];
$result=mysql_query("select * from city where city_name='$city_name'");
while($row = mysql_fetch_array($result))
  {
  echo $row['city_name'] ;
  echo "<br />";
  }
mysql_close($con);
?>

addloc.php

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form name="form1"action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<table border="1" align="center">
<input type="hidden"  name="l_id" />
<tr>
<?php include("droplistcity.php");?>
</tr>
<tr>
<td>Location Name</td>
<td><input type="text" name="location" /></td></tr>
<tr>
<td></td><td><input type="submit" value="added!">
</td>
</tr>
</table>
</form>
</body>
</html>
<?php include("connect.php");?>
<?php include("cityname.php");?>

<?php
$l_id = $_POST['l_id'];
$city_id = $_POST['city_name'];
$location = $_POST['location'];
$query = "INSERT INTO location (loc_id, city_id,loc_city) VALUES('$l_id',(SELECT city_id FROM city WHERE city_id = '$city_id'),'$location')";
$result = mysql_query($query) or die("Query failed: ".mysql_error());
mysql_close($con);
?>



here is my all code........plz reply as soon as possible.......
muneer_alam 0 Newbie Poster

Hi,,
My problem is that i have two table city and location.In city table i have 3 field city_id(Primary key),city_name,city_status where city_status is true or false.In location table i have 3 field also loc_id(Primary key),city_id,loc_city.i done a code in which city_name comes into drop down list from city table.my problem starts here when i select one of this value and want to insert into location table...then this show error..is there any code available related to my problem plz send my id......