472,354 Members | 2,105 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,354 software developers and data experts.

drop down menu list update *help*

201 100+
i can query the list fine using:

Expand|Select|Wrap|Line Numbers
  1. select list.list, many_table.list_id_fk from list left join many_table
  2. 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:
Expand|Select|Wrap|Line Numbers
  1. $updateSQL = sprintf("UPDATE list_many SET list_many_id_fk=%s, UserIdFk='1', `Date`=now() WHERE Id=%s",
  2. GetSQLValueString($_POST['list_many_idfk'], "int"),
  3. GetSQLValueString($_POST['UserIdFk'], "int"),
  4. GetSQLValueString($_POST['Date'], "date"),
  5. GetSQLValueString($_POST['Id'], "int"))
thanks in advance for your help!

Sep 23 '09 #1
7 2629
1,168 Expert 1GB
Can I just ask why you are using that method to update your tables? Why haven't you used something like:
Expand|Select|Wrap|Line Numbers
  1. $list_many_idfk = $_POST['list_many_idfk'];
  2. $userIdFk  $_POST['UserIdFk'];
  3. $date  $_POST['Date'];
  4. $id = $_POST['id'];
  6. $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?
Sep 23 '09 #2
8,658 Expert Mod 8TB
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.
Sep 23 '09 #3
201 100+
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.
Sep 23 '09 #4
8,658 Expert Mod 8TB
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.
Sep 23 '09 #5
1,168 Expert 1GB
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
Sep 23 '09 #6
201 100+
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.

Expand|Select|Wrap|Line Numbers
  1. $updateSQL = sprintf("update ASBodyType as a
  2.               left join BSType as b
  3.         on b.Id = a.BodyType
  4.         set a.BodyType=%s, a.Date=now()
  5.              where a.UIdFk='1'",
  6.            GetSQLValueString($_POST['BodyType'], "int"));

thanks again for your help!
Sep 24 '09 #7
1,168 Expert 1GB
Your code looks a little different with the BodyType, so still unclear what the problem was, but glad you got it solved.
Sep 24 '09 #8

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: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.