|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
POST variable in SELECT statement
I created a form to submit a date to a php file, but how do you get the QUERY statement to search for the date submitted by the form?
|
|
#2
|
|||
|
|||
|
RE: POST variable in SELECT statement
$query = select * from mytable where myfield = $_POST[myformfield]";
|
|
#3
|
|||
|
|||
|
RE: POST variable in SELECT statement
The statement above actually received the variable, but the results are blank. I had to enclose the $_POST[variable] in quotes for it to work. I received "syntax error" without the quotes around $_POST. Help me. |
|
#4
|
|||
|
|||
|
RE: POST variable in SELECT statement
post the code you are currently using that gets tyhe error so I can take a look.
|
|
#5
|
|||
|
|||
|
RE: POST variable in SELECT statement
if (isset ($_POST[submit])) {
} $query = 'SELECT * FROM Tickets LEFT JOIN Students ON Tickets.`Student Id`=Students.Id WHERE Date="2004-03-25" AND `Comment Id` = "$_POST[code]" ORDER BY `Student Id`'; // Define the query if ($r = mysql_query ($query)) { |
|
#6
|
|||
|
|||
|
RE: POST variable in SELECT statement
try the query like this
$query = "SELECT * FROM Tickets LEFT JOIN Students ON Tickets.`Student Id`=Students.Id WHERE Date='2004-03-25' AND `Comment Id` = '$_POST[code]' ORDER BY `Student Id`"; see if that makes any difference. another thing to do would be to echo the query before executing it to see if the query is well formed. |
|
#7
|
|||
|
|||
|
RE: POST variable in SELECT statement
|
|
#8
|
|||
|
|||
|
RE: POST variable in SELECT statement
I don't think arrays get expanded automatically, since it is ambiguous. Try changing $_POST[code] in the query statement to ${_POST['code']}.
|
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Database Help > POST variable in SELECT statement |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|