• 0

MySQL Update Unknown Query in WHERE Clause


Go to solution Solved by Dick Montage,

Question

generalt

I'm trying to run a query to update table xcodes. xcodes has two columns: codes and status. I want to update the status of the code contained in $code to 1.

 

$qu = "UPDATE xcodes SET status = 1 WHERE codes = $code";
$re = mysqli_query ($dbc, $qu) or trigger_error("Query: $qu\n<br/>MySQL Error: " . mysqli_error($dbc));

 

When I run the query, I get an error telling me that the code (in the variable $code) is an unknown column! The column is codes, not $code.

 

An error occurred on line 83: Query: UPDATE clickycodes SET status = 1 WHERE (codes = d24rg26p)
MySQL Error: Unknown column 'd24rg26p' in 'where clause'

 

I must have my syntax wrong. I've tried putting $code in brackets {$code} to no avail. What am I doing wrong?

Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0
+Dick Montage

$qu = "UPDATE xcodes SET status = 1 WHERE codes = '$code'";

Link to post
Share on other sites
  • 0
generalt

Wow. I could have sworn I tried that.

 

Thanks!

Link to post
Share on other sites
  • 0
+Dick Montage

It's always the simplest things we overlook. Now, next, within your PHP, use the PDO library and turn that into a stored procedure and pass it parameters :)

Link to post
Share on other sites
This topic is now closed to further replies.
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By News Staff
      Get the Complete 2021 Superstar Backend Developer Bundle for only $39.99
      by Steven Parker

      Today's highlighted deal comes via our Online Courses section of the Neowin Deals store, where you can save 98% off the Complete 2021 Superstar Backend Developer Bundle. Explore the server-side of web and app development with 35+ hours of content on HTML5, CSS3, Ruby, Python, PHP, and more.



      This bundle consists of the following courses:

      HTML5 CSS3 JQUERY Single-Page Website Project from Scratch
      Build Your Own Website from Scratch Using HTML5 CCS JQUERY Java Basics: Learn To Code The Right Way
      Take on the Java Basics & Fast Track Your Way to Building Desktop + Android Apps Introduction to Ruby Programming
      Explore the Ruby Programming Language from the Ground Up Ruby on Rails for Web Development
      Learn Ruby on Rails the Fast & Easy Way! Master the Fundamentals of Python
      Gain Solid Python Understanding & Create Your Own Programs Python Programming For Everyone
      Learn Python Programming, from the Very Basic to Advanced Concepts, & How to Start Writing and Running Python Code JSON AJAX Data Transfer to MySQL Database Using PHP
      Create a Dynamic Input Form That Can Add Data & Retrieve Data from a MySQL Database PHP Development & Predefined Variables
      Have a Stronger Understanding of the PHP Programming Language & Create More Interactive Websites AJAX Connection to MySQL PHP API
      Create a Simple Database API Which Can Be Accessed from Frontend Code, Updated & More PHP Programming For Everyone
      Learn PHP Programming for Web Development the Fast & Easy Way! Functional Programming in JavaScript
      Begin Applying Functional Programming Techniques Into Their Own Code JavaScript Programming For Everyone
      Learn to Code JavaScript Like a Professional Programmer Beginner Object Oriented Programming in C# and .NET Core
      Learn Object-Oriented Programming Fundamentals & Climb Up the Developer Hierarchy Good to know
      Length of time users can access this course: lifetime Certificate of completion included Redemption deadline: redeem your code within 30 days of purchase Updates included For a full description, specs, and instructor info, click here.

      Here's the deal:
      This Complete 2021 Superstar Backend Developer Bundle normally costs $2,587, but you can pick it up for just $39.99 for a limited time - that represents a saving of $2,547.01 (98%) off.

      Spring Sale Promo
      Until tomorrow April 13, for every $75 spent, get $10 in store credit.

      Get this deal, or learn more about it
      See all discounted Online Courses. This is a time-limited offer.
      Get $1 credit for every $25 spent · Give $10, Get $10 · 10% off for first-time buyers.

      Not for you?
      That's OK, there are other deals on offer you can check out here.



      Enter giveaways: Polycade Home Arcade | $5K in cash | $10K in Crypto Ivacy VPN - 5 year subscription for just $1 per month NordVPN - 2 year subscription at up to 68% off Private Internet Access VPN - subscriptions at up to 71% off Unlocator VPN or SmartDNS - unblock Geoblock with 7-day free trial Neowin Store for our preferred partners. Subscribe to Neowin - for $14 a year, or $28 a year for Ad-Free experience Disable Sponsored posts · Neowin Deals · Free eBooks · Neowin Store

      Disclosure: This is a StackCommerce deal or giveaway in partnership with Neowin; an account at StackCommerce is required to participate in any deals or giveaways. For a full description of StackCommerce's privacy guidelines, go here. Neowin benefits from shared revenue of each sale made through our branded deals site, and it all goes toward the running costs.

    • By News Staff
      Save 97% off this Complete C Suite Programming Bundle
      by Steven Parker

      Today's highlighted deal comes via our Online Courses section of the Neowin Deals store, where you can save 97% off this Complete C Suite Programming Bundle. Master this foundational, general-purpose programming language with 80 hours of specially curated instructions on C++, C#, SQL, and more.



      This deal consists of the following courses:

      Complete Modern C++
      The Most Comprehensive C++ Tutorial with C++11/14/17 Features Master C# And SQL by Building Applications
      Become a Better Software Developer by Learning How to Build Applications Using C# & SQL Learn C# by Building Applications
      Understand the Concepts of C#6 & C#7 and Use Them to Build Real World .NET Console Apps The Complete Introduction to C++ Programming
      Learn All the Basics of C++ by Practice & Create Various Basic C++ Applications Structural Design Patterns in Modern C++
      Learn Structural Design Patterns in Depth & Their Implementation in Modern C++ Creational Design Patterns in Modern C++
      Learn Creational Design Patterns in Depth & Their Implementation in Modern C++ Object Oriented Analysis, Design & Programming with UML
      Learn Object-Oriented Analysis, Design & Programming Using UML in C++, Java and C# Detecting Memory Leaks in C/C++ Applications
      Apply Techniques to Detect & Isolate Memory-Related Errors in Visual Studio C/C++ Pointers & Applications
      Learn the Application of Pointers Such As Usage in Dynamic Arrays, Linked Lists, & More Beginner Object Oriented Programming In C# and .NET Core
      Learn Object-Oriented Programming Fundamentals & Climb Up the Developer Hierarchy Good to know
      Length of time users can access this course: lifetime Certificate of completion included Updates included Redemption deadline: redeem your code within 30 days of purchase For a full description, specs, and instructor info, click here.

      Here's the deal:
      This Complete C Suite Programming Bundle normally costs* $1,990, but you can pick it up for just $49.99 for a limited time - that represents a saving of $1,940.01 (97%) off.

      Get this deal, or learn more about it
      See all discounted Online Courses. This is a time-limited offer.
      Get $1 credit for every $25 spent · Give $10, Get $10 · 10% off for first-time buyers.

      Not for you?
      That's OK, there are other deals on offer you can check out here.



      Enter giveaways: Polycade Home Arcade | $5K in cash | $10K in Crypto Ivacy VPN - 5 year subscription for just $1 per month NordVPN - 2 year subscription at up to 68% off Private Internet Access VPN - subscriptions at up to 71% off Unlocator VPN or SmartDNS - unblock Geoblock with 7-day free trial Neowin Store for our preferred partners. Subscribe to Neowin - for $14 a year, or $28 a year for Ad-Free experience Disable Sponsored posts · Neowin Deals · Free eBooks · Neowin Store

      Disclosure: This is a StackCommerce deal or giveaway in partnership with Neowin; an account at StackCommerce is required to participate in any deals or giveaways. For a full description of StackCommerce's privacy guidelines, go here. Neowin benefits from shared revenue of each sale made through our branded deals site, and it all goes toward the running costs.

    • By News Staff
      Pay What You Want for this Full Stack Web Development Bundle
      by Steven Parker

      Today's highlighted deal comes via our Online Courses section of the Neowin Deals store, where you can Pay What You Want for this Full Stack Web Development Bundle. The world's best developers are Full Stack developers. Here's 122+ hours of instruction to help you join them.



      How does it work?
      With the Pay What You Want bundles, you can get something incredible for as little as you want to pay. And if you beat the average price, you’ll receive the fully upgraded bundle! Included in this Pay What You Want deal, are the following courses:

      Pay What You Want (as little as $1) for the unlocked item:

      Projects in HTML5
      Build 10 Products in HTML5 & JavaScript Or bid the average price to also get the following items:

      The Full Stack Web Development Course
      Handle Every Facet of An App's Development, Ascend to the Top of the Developer Mountain Projects In ReactJS: The Complete React Learning Course
      Dive Into One of Today's Most In-Demand Front End Development Tools Projects in JavaScript & JQuery
      Gain Practical Experience in JavaScript & jQuery By Completing 10 Projects ReactJS and Flux: Learn By Building 10 Projects
      Learning These Facebook-Created Development Tools Will Greatly Accelerate Your Workflow Projects in MongoDB: Learn MongoDB Building 10 Projects
      Explore the World's Most Popular Cross-Platform NoSQL Database Projects Using PHP Frameworks
      Build 10 Unique Projects to Get a Complete Grasp On Multiple PHP Frameworks Learn NodeJS by Building 10 Projects
      Use This Popular Runtime Environment to Craft Lightweight, Highly Scalable Apps Here's the deal:
      The bundle represents an overall retail value of $476 But you can Pay What You Want for the unlocked items (as little as $1) Beat the average price and you'll take home the entire bundle. Beat the Leader's price and get entered into the epic giveaway. Pay What You Want for this Full Stack Web Development Bundle
      See other Pay What You Want deals. This is a time-limited deal that ends soon.
      Get $1 credit for every $25 spent · Give $10, Get $10 · 10% off for first-time buyers.

      Not for you?
      That's OK, there are other free eBooks on offer you can check out here.



      Home Gym Giveaway | Bitcoin (BTC) Investment Giveaway Ivacy VPN - 5 year subscription for just $1 per month NordVPN - 2 year subscription at up to 68% off Private Internet Access VPN - subscriptions at up to 71% off Unlocator VPN or SmartDNS - unblock Geoblock with 7-day free trial Neowin Store for our preferred partners. Subscribe to Neowin - for $14 a year, or $28 a year for Ad-Free experience Disable Sponsored posts · Neowin Deals · Free eBooks · Neowin Store

      Disclosure: A valid email address is required to fulfill your request. Complete and verifiable information is required in order to receive this offer. By submitting a request, your information is subject to TradePub.com's Privacy Policy.

    • By News Staff
      Get this Backend Developer Bootcamp Bundle for only $29.99
      by Steven Parker

      Today's highlighted deal comes via our Online Courses section of the Neowin Deals store, where for only a limited time, you can save 96% off this Backend Developer Bootcamp Bundle. This 31-hour course bundle takes you behind the scenes of web development: C#, SQL, .NET Core, and more.



      This bundle includes the following courses:

      Learn C# By Building Applications
      Understand the Concepts of C#6 & C#7 and Use Them to Build Real World .NET Console Apps Master C# and SQL by Building Applications
      Learn How to Build Real-World Applications Using C# & SQL Beginner Object Oriented Programming in C# and .NET Core
      Learn Object-Oriented Programming Fundamentals & Climb Up the Developer Hierarchy Learn ASP.NET Core and SQL by Writing ToDo API
      Write an API with Step-by-Step Instructions Using ASP.NET Core, SQL Server, & T-SQL Microsoft SQL Server & T-SQL Course for Beginners
      Learn about the Benefits of SQL & How SQL Server Stores Data Good to know
      Length of time users can access this course: lifetime Certificate of completion included Redemption deadline: redeem your code within 30 days of purchase For a full description, specs, and instructor info, click here.

      Here's the deal:
      This Backend Developer Bootcamp Bundle normally costs $995, but you can pick it up for just $29.99 for a limited time - that represents a saving of $965.01 (96%) off.

      Get this deal, or learn more about it
      See all discounted Online Courses. This is a time-limited offer.
      Get $1 credit for every $25 spent · Give $10, Get $10 · 10% off for first-time buyers.

      Not for you?
      That's OK, there are other free eBooks on offer you can check out here.



      Home Gym Giveaway | Bitcoin (BTC) Investment Giveaway Ivacy VPN - 5 year subscription for just $1 per month NordVPN - 2 year subscription at up to 68% off Private Internet Access VPN - subscriptions at up to 71% off Unlocator VPN or SmartDNS - unblock Geoblock with 7-day free trial Neowin Store for our preferred partners. Subscribe to Neowin - for $14 a year, or $28 a year for Ad-Free experience Disable Sponsored posts · Neowin Deals · Free eBooks · Neowin Store

      Disclosure: A valid email address is required to fulfill your request. Complete and verifiable information is required in order to receive this offer. By submitting a request, your information is subject to TradePub.com's Privacy Policy.

    • By News Staff
      Save 98% off this All-in-One Coding Skills Bundle
      by Steven Parker

      Today's highlighted deal comes via our Online Courses section of the Neowin Deals store, where you can save 98% off the All-in-One Coding Skills Bundle. Boost your IT skill set and master coding with 25 hours on Scratch, Kodu, Python, SQL, Flutter, C++, and ITIL.



      This bundle consists of the following courses:

      Scratch 3.0 Programming Masterclass: Learn by Creating 12 Funny Games
      Build Games in Scratch 3.0 Including Snake, Pac-Man, Racing Game, & Elsa from Frozen Learn Coding by Creating 3D Games with Kodu Game Lab
      Be an Expert Coder in the Exciting, Funny Kodu Game Lab Python MTA 98-381 Complete Preparation Course
      Your Complete Python Resource to Succeed in the Python Certification MTA 98-381 Exams! MTA 98-361: Software Development Fundamentals Preparation Course
      Everything You Need to Pass the Microsoft MTA 98-361 Exam with Step-by-Step Examples SQL: Mastering MySQL & MariaDB with Examples for Beginners
      Understand SQL Using the MySQL Database, How to Install MySQL Service & Design Databases Master Flutter & Dart with a Complete Showcase Mobile App
      Build iOS & Android Apps with a Showcase Example Based on Dart and Flutter Framework C++: Master C++ with Step-by-Step Examples for Beginners
      Start from the Basics & Go All the Way to Creating Your Own Applications ITIL 4 Certification Exam: A Complete Preparation Masterclass to Master ITIL
      A 3-Step Process to Master ITIL & Pass the Exam Good to know
      Length of time users can access this course: lifetime This plan is only available to new users Redemption deadline: redeem your code within 30 days of purchase For a full description, specs, and instructor info, click here.

      Here's the deal:
      This All-in-One Coding Skills Bundle normally costs $1,592, but you can pick it up for just $29.99 for a limited time - that represents a saving of $1,562.01 (98%) off.

      Get this deal, or learn more about it
      See all discounted Online Courses. This is a time-limited offer.
      Get $1 credit for every $25 spent · Give $10, Get $10 · 10% off for first-time buyers.

      Not for you?
      That's OK, there are other free eBooks on offer you can check out here.



      Home Gym Giveaway | Bitcoin (BTC) Investment Giveaway Ivacy VPN - 5 year subscription for just $1 per month NordVPN - 2 year subscription at up to 68% off Private Internet Access VPN - subscriptions at up to 71% off Unlocator VPN or SmartDNS - unblock Geoblock with 7-day free trial Neowin Store for our preferred partners. Subscribe to Neowin - for $14 a year, or $28 a year for Ad-Free experience Disable Sponsored posts · Neowin Deals · Free eBooks · Neowin Store

      Disclosure: A valid email address is required to fulfill your request. Complete and verifiable information is required in order to receive this offer. By submitting a request, your information is subject to TradePub.com's Privacy Policy.