![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: Feb 2005
Posts: 74
Rep Power: 4
![]() |
Quick Question (hopefully)
You all were are so good I thought I'd test you again.
I want, when I insert data into a table to relate to to the others via a master id. In my code for submitting a certain piece of information I try to refer to the id from another table.Here's the error I get: Impossible to find an index FULLTEXT corresponding to this list of columns Here's the code snippet: //get master id
$add_master = "select id from client_name where match (company) against ('$_POST[add_work_order_client]')";
$master_id = mysql_query($add_master) or die (mysql_error());Hope this makes sense! ![]()
__________________
Lorem ipsum dolor sit amet... |
|
|
|
|
|
#2 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Stick curly brackets around the variable to tell PHP it's actually an array, not a string:
... against ('{$_POST[add_work_order_client]}')"; |
|
|
|
|
|
#3 |
|
Hobbyist Programmer
Join Date: Sep 2004
Posts: 207
Rep Power: 4
![]() |
Just I recommendation but I would set that to a different varible before I did that. Like
$woClient = $_POST[add_work_order_client] Just a matter of prefercene also you should try to shorten your names a bit. Less you have to type less chance of making a mistake.
__________________
_______________________________ BlazingWolf |
|
|
|
|
|
#4 |
|
Programmer
Join Date: Feb 2005
Posts: 74
Rep Power: 4
![]() |
thanks guys. as soon as I get an opportunity I'll give it a try and let you kow if it works.
Thanks for he advice too!
__________________
Lorem ipsum dolor sit amet... |
|
|
|
|
|
#5 |
|
Programming Guru
![]() |
remembed to run the variables through addslashes before put into the SQL statement, SQL injection is a problem...
__________________
|
|
|
|
|
|
#6 |
|
Programmer
Join Date: Feb 2005
Posts: 74
Rep Power: 4
![]() |
I haven't got it working quite right. I assigned the post value to a variable. but now I get this error:
Syntax error close to 'david' to the line 1 and here's the code again: $woClient = $_POST['add_work_order_client']; $add_master = "select id from client_name where match (company) against $woClient"; $master_id = mysql_query($add_master) or die (mysql_error()); First let me make sure I got this right, id is a field I want to choose from. client_name is the table I'm choosing the field from. Match is the other field in that table that must be of equal value to the against which is the post value input by the user. Is this right?
__________________
Lorem ipsum dolor sit amet... |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|