Forum Moderators: coopster
The error is in the following part of the query: Site_idSite = ("select idSite from Site where name=('".$_POST['site']."')
")
I get that there is a problem in the brackets n quotes, but i have tried all combinations , nothing works
Someone please help!
The full thing is as follows
$site = $_POST['site'];
$sql = ("select idSite from Site where name='$site'");
$result = @mysql_query("select idTest_Equipment,
name,
equipment_Type,
Site_idSite,
Owner_idOwner,
capability,
ownership,
asset_Rental_Number,
location,
next_Calibration_Date
from Test_Equipment
where Site_idSite=$sql ");
However now there is a problem in the
$sql = ("select idSite from Site where name='$site'"); statement
$site is a string so i have put it in single quotes.
please help! i m stuck on this problem since 2 days n have a deadline ahead!
Any help is appreciated.
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'select idSite from Site where name =''' at line 11
Also before this it gives me a :
Notice: Undefined index: site in c:\program files\easyphp1-7\www\mysite\css_test\testequipment_manage1.php on line 96
My line 96 is: $site = $_POST['site'];
In this line i want to obtain the value selected by a user in a dropdown list named 'site' and put it in a variable named site. However when i try to print $site i realise that it contains nothing!
heres the dropdown thing:
<select name="site[]" onChange="MM_jumpMenu('parent',this,0)">
<option>dog</option>
<option>cat</option>
<option>ALL</option>
</select>
I am accessing it within the form itself so it shouldnt be out of scope too!
Could you explain to me in what condition we get the 'undefined index' message?
$site = $_POST['site'];
$sql = "select idSite from Site where name ='".$site."'";
$result = @mysql_query("select idTest_Equipment,
name,
equipment_Type,
Site_idSite,
Owner_idOwner,
capability,
ownership,
asset_Rental_Number,
location,
next_Calibration_Date
from Test_Equipment
where Site_idSite = $sql ");
This will give you alot more detail on what is actually wrong with your query.
I get a message like this..
Notice: Undefined index: type in line102
the line is:
$site = $_POST['site'];
Please help the whole page gets filled with messages like this initially. Site happens to be the name of a drop down list. But when i select a value from the list and click submit, the message disappears.