UPDATE now getting no errors and 'success' but still no image in the data base. Updated code belowButton Element with Type Submit & PHP ChallengesPass two parameters in $.ajax success functionPHP throws an error when trying to insert image in MySql table?PHP uploading form problemsPHP - Import csv into database data too longCant upload and store the image to the database by using phpphp image update query, how to update the queryjquery ajax post doesn't workcreating php database and displaying its contents'move_uploaded_file(): Unable to move' Multiple Files XAMPP

Project Euler Problem 45

Phrase request for "work in" in the context of gyms

How to create large inductors (1H) for audio use?

How to measure the statistical "distance" between two frequency distributions?

What is the justification for Dirac's large numbers hypothesis?

French equivalent of "my cup of tea"

Looking for a big fantasy novel about scholarly monks that sort of worship math?

Types of tablet... a tablet secretion

Who's this voice acting performer?

Why are UK MPs allowed to not vote (but it counts as a no)?

Do I need to declare engagement ring bought in UK when flying on holiday to US?

Is Sanskrit really the mother of all languages?

What is the name for quantum gates that can be reversed?

What exactly is Apple Cider

Why does the seven segment display have decimal point at the right?

These roommates throw strange parties

What are the map units that WGS84 uses?

How do I make my fill-in-the-blank exercise more obvious?

Remaining in the US beyond VWP admission period

What do English-speaking kids call ice-cream on a stick?

Pronounceable encrypted text

If I sell my PS4 game disc and buy a digital version, can I still access my saved game?

Entering the US with dual citizenship but US passport is long expired?

Did the Byzantines ever attempt to move their capital to Rome?



UPDATE now getting no errors and 'success' but still no image in the data base. Updated code below


Button Element with Type Submit & PHP ChallengesPass two parameters in $.ajax success functionPHP throws an error when trying to insert image in MySql table?PHP uploading form problemsPHP - Import csv into database data too longCant upload and store the image to the database by using phpphp image update query, how to update the queryjquery ajax post doesn't workcreating php database and displaying its contents'move_uploaded_file(): Unable to move' Multiple Files XAMPP






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















updated code and it's now displaying success but still no image in my database.
anyone have any idea why the image isnt being inserted?



<?php
error_reporting( E_ALL );
?>


<?php


if (isset($_POST['submit']))

if (getimagesize($_FILES['Image']['tmp_name'])==FALSE)
echo "failed";
else
$name=addslashes($_FILES['Image']['name']);
$image=base64_encode(file_get_contents(addslashes($_FILES['Image']['tmp_name'])));
saveimage($name,$image);

else
echo "error";


function saveimage($name,$image)
$con = mysqli_connect('', '','', '');
$sql = "INSERT INTO items ('image', 'Description') VALUES ($name, $image)";
$query=!mysqli_query($con,$sql);
if ($query)
echo "success";
else
echo "Not uploaded";



?>









share|improve this question


























  • Can you please check if $_FILES['Image']['Description'] exist? Oh, and just to be sure, is the Image in $_FILES['Image'] correct?

    – Carl Binalla
    Mar 28 at 5:18


















0















updated code and it's now displaying success but still no image in my database.
anyone have any idea why the image isnt being inserted?



<?php
error_reporting( E_ALL );
?>


<?php


if (isset($_POST['submit']))

if (getimagesize($_FILES['Image']['tmp_name'])==FALSE)
echo "failed";
else
$name=addslashes($_FILES['Image']['name']);
$image=base64_encode(file_get_contents(addslashes($_FILES['Image']['tmp_name'])));
saveimage($name,$image);

else
echo "error";


function saveimage($name,$image)
$con = mysqli_connect('', '','', '');
$sql = "INSERT INTO items ('image', 'Description') VALUES ($name, $image)";
$query=!mysqli_query($con,$sql);
if ($query)
echo "success";
else
echo "Not uploaded";



?>









share|improve this question


























  • Can you please check if $_FILES['Image']['Description'] exist? Oh, and just to be sure, is the Image in $_FILES['Image'] correct?

    – Carl Binalla
    Mar 28 at 5:18














0












0








0








updated code and it's now displaying success but still no image in my database.
anyone have any idea why the image isnt being inserted?



<?php
error_reporting( E_ALL );
?>


<?php


if (isset($_POST['submit']))

if (getimagesize($_FILES['Image']['tmp_name'])==FALSE)
echo "failed";
else
$name=addslashes($_FILES['Image']['name']);
$image=base64_encode(file_get_contents(addslashes($_FILES['Image']['tmp_name'])));
saveimage($name,$image);

else
echo "error";


function saveimage($name,$image)
$con = mysqli_connect('', '','', '');
$sql = "INSERT INTO items ('image', 'Description') VALUES ($name, $image)";
$query=!mysqli_query($con,$sql);
if ($query)
echo "success";
else
echo "Not uploaded";



?>









share|improve this question
















updated code and it's now displaying success but still no image in my database.
anyone have any idea why the image isnt being inserted?



<?php
error_reporting( E_ALL );
?>


<?php


if (isset($_POST['submit']))

if (getimagesize($_FILES['Image']['tmp_name'])==FALSE)
echo "failed";
else
$name=addslashes($_FILES['Image']['name']);
$image=base64_encode(file_get_contents(addslashes($_FILES['Image']['tmp_name'])));
saveimage($name,$image);

else
echo "error";


function saveimage($name,$image)
$con = mysqli_connect('', '','', '');
$sql = "INSERT INTO items ('image', 'Description') VALUES ($name, $image)";
$query=!mysqli_query($con,$sql);
if ($query)
echo "success";
else
echo "Not uploaded";



?>






php






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 28 at 5:30







s656

















asked Mar 28 at 4:58









s656s656

11 bronze badge




11 bronze badge















  • Can you please check if $_FILES['Image']['Description'] exist? Oh, and just to be sure, is the Image in $_FILES['Image'] correct?

    – Carl Binalla
    Mar 28 at 5:18


















  • Can you please check if $_FILES['Image']['Description'] exist? Oh, and just to be sure, is the Image in $_FILES['Image'] correct?

    – Carl Binalla
    Mar 28 at 5:18

















Can you please check if $_FILES['Image']['Description'] exist? Oh, and just to be sure, is the Image in $_FILES['Image'] correct?

– Carl Binalla
Mar 28 at 5:18






Can you please check if $_FILES['Image']['Description'] exist? Oh, and just to be sure, is the Image in $_FILES['Image'] correct?

– Carl Binalla
Mar 28 at 5:18













3 Answers
3






active

oldest

votes


















1
















I have Found the issue
Please update your query using i have given



 $sql = "INSERT INTO items (image, Description) VALUES ('".$name."', '".$image."')";





share|improve this answer


































    -1
















    Try adding an else to your outer if statement:



    if (isset($_POST['upload'])) 
    // code ...
    else
    // error code



    That will at least tell you if the error lies with $_POST['upload'].






    share|improve this answer

























    • yea that worked, thanks. turns out upload should have been submit. Now im getting Notice: Undefined index: image in /var/www/vhosts/imagetest.php on line 14 success (removed details from url)

      – s656
      Mar 28 at 5:07



















    -1
















    You should check you image column datatype in database table this should be text or blob type.






    share|improve this answer

























    • yea its blob, thanks

      – s656
      Mar 28 at 5:14













    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );














    draft saved

    draft discarded
















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55390453%2fupdate-now-getting-no-errors-and-success-but-still-no-image-in-the-data-base%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1
















    I have Found the issue
    Please update your query using i have given



     $sql = "INSERT INTO items (image, Description) VALUES ('".$name."', '".$image."')";





    share|improve this answer































      1
















      I have Found the issue
      Please update your query using i have given



       $sql = "INSERT INTO items (image, Description) VALUES ('".$name."', '".$image."')";





      share|improve this answer





























        1














        1










        1









        I have Found the issue
        Please update your query using i have given



         $sql = "INSERT INTO items (image, Description) VALUES ('".$name."', '".$image."')";





        share|improve this answer















        I have Found the issue
        Please update your query using i have given



         $sql = "INSERT INTO items (image, Description) VALUES ('".$name."', '".$image."')";






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Mar 28 at 7:32

























        answered Mar 28 at 7:25









        Jydipsinh ParmarJydipsinh Parmar

        3262 silver badges11 bronze badges




        3262 silver badges11 bronze badges


























            -1
















            Try adding an else to your outer if statement:



            if (isset($_POST['upload'])) 
            // code ...
            else
            // error code



            That will at least tell you if the error lies with $_POST['upload'].






            share|improve this answer

























            • yea that worked, thanks. turns out upload should have been submit. Now im getting Notice: Undefined index: image in /var/www/vhosts/imagetest.php on line 14 success (removed details from url)

              – s656
              Mar 28 at 5:07
















            -1
















            Try adding an else to your outer if statement:



            if (isset($_POST['upload'])) 
            // code ...
            else
            // error code



            That will at least tell you if the error lies with $_POST['upload'].






            share|improve this answer

























            • yea that worked, thanks. turns out upload should have been submit. Now im getting Notice: Undefined index: image in /var/www/vhosts/imagetest.php on line 14 success (removed details from url)

              – s656
              Mar 28 at 5:07














            -1














            -1










            -1









            Try adding an else to your outer if statement:



            if (isset($_POST['upload'])) 
            // code ...
            else
            // error code



            That will at least tell you if the error lies with $_POST['upload'].






            share|improve this answer













            Try adding an else to your outer if statement:



            if (isset($_POST['upload'])) 
            // code ...
            else
            // error code



            That will at least tell you if the error lies with $_POST['upload'].







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 28 at 5:01









            ChipsterChipster

            2,2332 gold badges7 silver badges25 bronze badges




            2,2332 gold badges7 silver badges25 bronze badges















            • yea that worked, thanks. turns out upload should have been submit. Now im getting Notice: Undefined index: image in /var/www/vhosts/imagetest.php on line 14 success (removed details from url)

              – s656
              Mar 28 at 5:07


















            • yea that worked, thanks. turns out upload should have been submit. Now im getting Notice: Undefined index: image in /var/www/vhosts/imagetest.php on line 14 success (removed details from url)

              – s656
              Mar 28 at 5:07

















            yea that worked, thanks. turns out upload should have been submit. Now im getting Notice: Undefined index: image in /var/www/vhosts/imagetest.php on line 14 success (removed details from url)

            – s656
            Mar 28 at 5:07






            yea that worked, thanks. turns out upload should have been submit. Now im getting Notice: Undefined index: image in /var/www/vhosts/imagetest.php on line 14 success (removed details from url)

            – s656
            Mar 28 at 5:07












            -1
















            You should check you image column datatype in database table this should be text or blob type.






            share|improve this answer

























            • yea its blob, thanks

              – s656
              Mar 28 at 5:14















            -1
















            You should check you image column datatype in database table this should be text or blob type.






            share|improve this answer

























            • yea its blob, thanks

              – s656
              Mar 28 at 5:14













            -1














            -1










            -1









            You should check you image column datatype in database table this should be text or blob type.






            share|improve this answer













            You should check you image column datatype in database table this should be text or blob type.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 28 at 5:07









            gaurav krishnagaurav krishna

            264 bronze badges




            264 bronze badges















            • yea its blob, thanks

              – s656
              Mar 28 at 5:14

















            • yea its blob, thanks

              – s656
              Mar 28 at 5:14
















            yea its blob, thanks

            – s656
            Mar 28 at 5:14





            yea its blob, thanks

            – s656
            Mar 28 at 5:14


















            draft saved

            draft discarded















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55390453%2fupdate-now-getting-no-errors-and-success-but-still-no-image-in-the-data-base%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

            은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현