Solved

Query Update / Set issue

Posted on 2011-03-15
4
260 Views
Last Modified: 2012-05-11
I have a piece of code that check a value against an value that is stored in a database.  My update script works if the information compared does not match.  However, it does not update if the row in the database is empty.  Do you have any clues?

[code}
$q = "UPDATE exp_weblog_data SET field_id_29='$new_bridge', field_id_30='$new_brand', field_id_31='$new_bridgePickup', field_id_32='$new_buyCodeUSA', field_id_33='$new_prod_color', field_id_34='$new_prod_displayName', field_id_35='$new_prod_msrp', field_id_36='$new_prod_part_number', field_id_37='$new_prod_upc', field_id_38='$new_casegigbag', field_id_39='$new_controlKnobs', field_id_40='$new_controls'  WHERE field_id_104='$prodNo' LIMIT 1";
[/code}
0
Comment
Question by:rgranlund
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 8

Accepted Solution

by:
Rik-Legger earned 250 total points
ID: 35142754
Which row in de database is empty? If 'field_id_104' is empty and $prodNo has as a value than it will never update.
Maybe you can give some more details on your problem?
0
 
LVL 39

Expert Comment

by:Aaron Tomosky
ID: 35142780
Do you mean it doesn't insert a row if it doesn't find prodno in fieldid104?
0
 
LVL 7

Author Comment

by:rgranlund
ID: 35142849
I mean if field_id_29='$new_bridge',   if Field_id_29 is empty and $new_bridge ='Wood'  it will not update.

ifield_id_29='$new_bridge',   if Field_id_29=' Metal' and $new_bridge ='Wood' it will update.
0
 
LVL 39

Assisted Solution

by:Aaron Tomosky
Aaron Tomosky earned 250 total points
ID: 35142938
But you are sure that the rest of the fields including the where 104 are there?
Because I see nothing wrong with your query unless the whole row is missing
0

Featured Post

Congratulations! You’re Certified – Now What?

Starting a new career can be overwhelming. Becoming certified in your field of expertise is a great start, but where do you go from here?  Here are some tips to help you on your career journey.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question