Home SQL UPDATE using a variable for column not work
Reply: 0

SQL UPDATE using a variable for column not work

Kaourou Marega
1#
Kaourou Marega Published in 2018-02-14 07:18:01Z

I got a pb when i try to udpate in my database from Php code. when i use echo i have the correct value of $SP. when i dont use $SP but a constant its working. please help thank you

SP 1:<input type="text"  value="<?php echo $actualWarningLetter1['WarningLetter1'];?>"readonly> </input><br>        
            <!-- Display the actual SP2 --> 
            SP 2:<input type="text"  value="<?php echo $actualWarningLetter2['WarningLetter2'];?>"readonly> </input><br>
            <!-- upload SP3 --> 
            Upload SP 3:<input type="file" name="WarningLetter" >
            <input type="text" name='SP' value="WarningLetter3" hidden>enter code here
$bdd = new PDO("mysql:host=localhost;dbname=global_intranet","root","gl0b4l"); // to connect to the database
                    $FullNameToUpdate= $_POST['FullName'];// Retrieve the FullName to update
                    $NewWarningLetter= $_POST['WarningLetter']; // Retrieve the edited WarningLetter
                    //$SP=$_POST['SP'];// Retreive the warning letter to be insert
                    $SP=$_POST['SP'];$SP1=$_POST['SP1'];
                    echo $SP.$SP1;

                ?>

' readonly>
' readonly>

prepare("UPDATE worker SET $SP='?' WHERE FullName=?"); // Update the Warning Letter in database $UpdateWarningLetter->execute(array($NewWarningLetter,$FullNameToUpdate));enter code here

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.295617 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO