We help IT Professionals succeed at work.

update query is not working , giving Mariadb server version error

shruti A
shruti A asked
on
224 Views
Last Modified: 2017-04-06
<?php 
include ('db.php'); 
include ('header.php'); 
$id=$_GET['id'];
?>
<body>


<div class="container">
<div class="">
 <div class="container-con">
<!-- end banner & menunav -->

<div class="container">
<div class="">
<div class="span12">
<div class="row-fluid">
<div class="span3"></div>
<div class="span6">


<div class="hero-unit-3">
<center>

<?php
$sql="select * from combo1 where id='$id'";
  $query=mysqli_query($link,$sql)or die(mysqli_error($link));
$row=mysqli_fetch_array($query);
  ?>
  <center>
 <form class="form-horizontal" method="post"  enctype="multipart/form-data">
                                <legend><h4>Edit</h4></legend>
                                
                                <h4>UPDATE</h4>
                                <hr>
								<div class="control-group">
                                    <label class="control-label" for="inputColumn">COLUMN:</label>
                                    <div class="controls">
                                        <input type="text" name="column" required value=<?php echo $row['column']; ?>>
                                    </div>
                                </div>
								<div class="control-group">
                                    <label class="control-label" for="inputType">TYPE:</label>
                                    <div class="controls">
                                        <input type="text" name="type" required value=<?php echo $row['type']; ?>>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label" for="inputValue">VALUE:</label>
                                    <div class="controls">
                                        <input type="text" name="value" required value=<?php echo $row['value']; ?>>
                                    </div>
                                </div>
                               
								
								 <div class="control-group">
                                    <div class="controls">

                                        <button type="submit" name="update" class="btn btn-success" style="margin-right: 65px;" value="update">Save</button>
										<a href="excombo.php" class="btn">Back</a>
                                    </div>
                                </div>
                            </form>
							

							</center>
							<?php
							
							
							$id=$_REQUEST['id'];

$result = mysqli_query($link,"SELECT * FROM combo1 WHERE id = '$id'");
$test = mysqli_fetch_array($result);
if (!$result) 
		{
		die("Error: Data not found..");
		}
		        
									$column= $test['column'];
									$type= $test['type'];
									$value= $test['value'];
									
                            
if (isset($_POST['update'])) {

									// $column=(isset( $_POST['column']));
									$column = isset( $_POST['column']) ? $_POST['column']:" ";
									//$type= (isset($_POST['type']));
									$type = isset( $_POST['type']) ? $_POST['type']:" ";
									//$value= (isset($_POST['value']));
									$value = isset( $_POST['value']) ? $_POST['value']:" ";
									echo $id;

									echo $column;
									echo $type;
									echo $value;
													
								
mysqli_query($link,"UPDATE combo1 SET column = '$column' type = '$type'  value ='$value' WHERE id ='$id'") 
or die(mysqli_error($link)); 

header("Location:excombo.php");	

					}
								
								?>
								</center>
								

								</div>
								</div>
								</div>
								</div>
								</div>
								</div>
								</div>
								</div>
								</div>
</body>
</html>
								

Open in new window



it ia giving error like this
25col1INTAddressYou have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'column = 'col1' type = 'INT' value ='Address' WHERE id ='25'' at line 1
Comment
Watch Question

Most Valuable Expert 2011
Author of the Year 2014
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.