Jump to content

Warning: mysql_query() expects parameter 1 to be string


Spraban9

Recommended Posts

hi friends

i have the error in update coding

plz help me to solve this problem

<?php

if($_POST['comf'] != ''){
    
/*$name = $_POST['name']; */
$comf = $_POST['comf'];  
 include("include/connection.php");
        
    if (!$conn)    {
                die('Could not connect: ' . mysql_error());
            }
            
            mysql_select_db($database , $conn) or die (mysql_error());
            
/*        $result =  "UPDATE customer SET active = 1 WHERE randomno='$comf' ";
                $que=mysqli_query($r)or die(mysql_error());
        $que=mysql_query("select active from customer where  user='$name'");
        if($que)
        {*/
        
     $que1=mysql_query($conn,"UPDATE customer SET active = 1 WHERE randomno ='$comf' ") ;
    
if (!$que1 ){
    
            die("Database query failed: ". mysql_error());
       
            
}
else {
/*$saved= "Error in conformation code please retype";
*/        $saved= "Thank you to Activate Your Account ";
}


    
}
?>
 <label id="dis"> <h3><?php echo $saved?> </h3></label><br>
<form name="frmconfor"  id="frmconfor" method="post" action="comformation.php">
 
   
         <table width="536" height="265" id="font"  >
      
     <!--   <tr>
          <td height="62" class="style9"><label>UserName</label></td>
          <td><input required name="name" type="text" value=""  /></td>
        </tr>-->
        <tr>
          <td height="62" class="style9"><label>Conformation Code</label></td>
          <td><input required name="comf" type="text" value=""  /></td>
        </tr>
       
         <tr>
           <td height="118" colspan="2">
             <div align="center">
               <input name="submit" type="submit"  value="submit"/>
             
            </div></td>
         </tr>
    </table>
        
    
         
        
</form></center>

 

Link to comment
Share on other sites

hi this coding to showing error but update not working

<?php


if(isset($_POST['update'])){
	

$comf = $_POST['comf'];  
 include("include/connection.php");
		
    if (!$conn)	{
				die('Could not connect: ' . mysql_error());
			}
			
			mysql_select_db($database , $conn) or die (mysql_error());

		
	 $que1="update customer set active = 1 where randomno ='$comf' " ;
	 

mysql_select_db('vas');
$retval = mysql_query( $que1, $conn );
if(! $retval )
{
  die('Could not update data: ' . mysql_error());
}
echo "Updated data successfully\n";
mysql_close($conn);
}
else
{
?>
   


	

 <label id="dis"> <h3><?php echo $saved?> </h3></label><br>
<form name="frmconfor"  id="frmconfor" method="post" action="<?php $_PHP_SELF ?>">
 
   
	     <table width="536" height="265" id="font"  >
      
      
        <tr>
          <td height="62" class="style9"><label>Conformation Code</label></td>
          <td><input required name="comf" type="text" value=""  /></td>
        </tr>
       
         <tr>
           <td height="118" colspan="2">
             <div align="center">
               <input name="update" type="submit" id="update" value="Update">
             
            </div></td>
         </tr>
    </table>	    
    
	     
        
</form>
<?php
}
?> </center>

it show the "update successfuly "message

but no change in database

Link to comment
Share on other sites

 

hi this coding to showing error but update not working

<?php


if(isset($_POST['update'])){
    

$comf = $_POST['comf'];  
 include("include/connection.php");
        
    if (!$conn)    {
                die('Could not connect: ' . mysql_error());
            }
            
            mysql_select_db($database , $conn) or die (mysql_error());

        
     $que1="update customer set active = 1 where randomno = $comf " ;
    

mysql_select_db('vas');
$retval = mysql_query( $que1, $conn );
if(! $retval )
{
  die('Could not update data: ' . mysql_error());
}
echo "Updated data successfully\n";
mysql_close($conn);
}
else
{
?>
   


    

 <label id="dis"> <h3><?php echo $saved?> </h3></label><br>
<form name="frmconfor"  id="frmconfor" method="post" action="<?php $_PHP_SELF ?>">
 
   
         <table width="536" height="265" id="font"  >
      
      
        <tr>
          <td height="62" class="style9"><label>Conformation Code</label></td>
          <td><input required name="comf" type="text" value=""  /></td>
        </tr>
       
         <tr>
           <td height="118" colspan="2">
             <div align="center">
               <input name="update" type="submit" id="update" value="Update">
             
            </div></td>
         </tr>
    </table>        
    
         
        
</form>
<?php
}
?>

it show the "update successfuly "message

but no change in database

Could not update data: Unknown column 'kmrlyOBOYv' in 'where clause'

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.