i can query the list fine using: -
select list.list, many_table.list_id_fk from list left join many_table
-
on list.id = many_table.list_id_fk and many_table.userid = 'UserId';
-
that populates the list per user id.
now when the user selects a new item from the list
it does not update
here is the update query: -
$updateSQL = sprintf("UPDATE list_many SET list_many_id_fk=%s, UserIdFk='1', `Date`=now() WHERE Id=%s",
-
GetSQLValueString($_POST['list_many_idfk'], "int"),
-
GetSQLValueString($_POST['UserIdFk'], "int"),
-
GetSQLValueString($_POST['Date'], "date"),
-
GetSQLValueString($_POST['Id'], "int"))
-
thanks in advance for your help!
theo
7 2677
Can I just ask why you are using that method to update your tables? Why haven't you used something like: - $list_many_idfk = $_POST['list_many_idfk'];
-
$userIdFk $_POST['UserIdFk'];
-
$date $_POST['Date'];
-
$id = $_POST['id'];
-
-
$result = mysql_query("UPDATE list_many SET list_many_id_fk=$list_many_id_fk, UserIdFk='1', `Date`=now() WHERE Id=$id");
I think that's much easier to read/debug etc... As I say, I don't know much about this method, but are you sure you can set default values for UserIDFk and Date?
in sprintf() there are only the indicated values (%s, …) replaced, you have 2x %s but 4 values, obviously, the last two are therefore not used.
no problem neither did i, until i started programming it and using it. that method ( GetSQLValueString) calls a function which checks for sql injection, etc... you can log it if it fails, suspects, etc...
I prefer this method. less issues in the long run.
yes you can changed the %s to include a default record to set that should be in the where i switched them around. not worried about id. just the users record that is being updated.
************************************************** *********
ok -
this is what i'm trying to do.
pull data from a list table, for the fk in the many table and allow the user to update by using the drop down menu.
i have the drop down menu pulling the records and defaults on the record stored in the many table. its just the update is failing.
any help is appreciated.
ive tried doing a join update which works in mysql but php doesnt like it.
@wizardry
this should be no concern of PHP since it is only a string. if PHP doesn’t like it, there should be at least an notice/warning/error message.
@wizardry
Interesting, thanks. Well because I don't know the function myself, and for the next 8 hrs I will not be able to test it out, I recommend you do this:
Make a simple MySQL query (using GetSQLValueString) and bit by bit add small components to change it in your code until it doesn't work - that will be your problem, or atleast one fo them. It's the long way round, but I think you will get a result quicker.
Failing that, wait until another expert comes along to this post and spots it without reading twice :P
this has been resolved!
i needed to limit what the form was updating, just the list fk id and date that the new update was entered. - $updateSQL = sprintf("update ASBodyType as a
-
left join BSType as b
-
on b.Id = a.BodyType
-
set a.BodyType=%s, a.Date=now()
-
where a.UIdFk='1'",
-
GetSQLValueString($_POST['BodyType'], "int"));
thanks again for your help!
Your code looks a little different with the BodyType, so still unclear what the problem was, but glad you got it solved.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: vikram.cvk |
last post by:
Hello Experts,
Im trying to design a CSS vertical drop down menu which should have the
following functionality.
Home
About Us
|
-->Overview
|
by: hemanth.singamsetty |
last post by:
Hello there,
I've a drop down menu (created using CSS & Javascript -- see code
below).
My problem is, whenever I click a link on the menu
the new page replaces the current page (and the menu...
|
by: Aussie Rules |
last post by:
Hi,
I want to have a single line combo box dropdown, but where i can selected
multiple items in the drop down via a check box...
I can see one in the standard tool box... is there one ?
If...
|
by: StevePBurgess |
last post by:
Hi I am using a drop down menu adapted from the one in Stylin with CSS
by Charles Wyke Smith.
The CSS is below.
It works perfectly in Internet Explorer (using the csshover behaviour
file) but...
|
by: Laura K |
last post by:
I have a drop down menu which has a list of subcategories and the
initial value is "please choose a Subcategory". When the user chooses a
subcategory they are taken to a new page where the drop...
|
by: weiwei |
last post by:
Hi
here is my scenario, I create a drop down list in itemtemplate.(that
drop down is created from db), after user
click edit command, my ideal plan is have another drop down list in...
|
by: TycoonUK |
last post by:
Hi,
As I do not have IE7 on my computer, I was wondering if there is a
fault in my CSS Menu when using IE7.
Please can someone look at my site - http://www.worldofmonopoly.co.uk
and tell me...
|
by: SQLjunky |
last post by:
Hello,
Contrary to what my screen name indicates, i'm actually quite new to SQL.
Having said that, I'll get right into my problem.
I'm trying to query an mssql database to return to the value...
|
by: Archanak |
last post by:
Hi,
I am using 2-level CSS Drop Down Menu in my perl/CGI program.
here is the code.
#!c:/perl/bin/perl.exe
use CGI qw(:standard);
|
by: wizardry |
last post by:
hello -
i've created a drop down menu in dreamweaver, it selects my states from a list table that i have for users table.
I went from enum to list table and created a fk to the parent table.
...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |