how to upload image into database and how to display image on table?

how to upload image in database and i dont konw how to display image in table can anyone help me please?

<?php
/**
* Template Name: ICO New Page
*/
get_header(); ?>
<?php
require_once(‘/../../../../wp-config.php’);
extract($_POST);
if ( isset( $_POST[‘submit’] ) ){

$file = addslashes(file_get_contents($_FILES[“logo”][“tmp_name”])); //image name

$result=$wpdb->query(“INSERT INTO ico_calendar (token_id, coin_name,logo,type,coin,start_date,end_date,description,link,comments) VALUES (‘$token_id’, ‘$coin_name’,’$file’,’$type’,’$coin’,’$start_date’,’$end_date’,’$description’,’$link’,’$comments’)” );

if($result)
{
echo ” Data inserted Successfully”;
}else
{
echo “Data insertion failed”;
}
}

?>
<div class=”iump-register-form ihc-register-7″>
<form action=”” id=”ico” method=”post” enctype=”multipart/form-data”>

<label for=”token_id”>Token ID:</label>
<input type=”text” name=”token_id” id=”token_id” value=””/>
<label for=”coin_name”>Coin Name:</label>
<input type=”text” name=”coin_name” id=”coin_name” value=”” />
<label for=”logo”>Logo:</label>
<input type=”file” name=”logo” id=”logo” value=”” />
<label for=”type”>Type:</label>
<input type=”text” name=”type” id=”type” value=”” />
<label for=”coin”>Coin:</label>
<input type=”text” name=”coin” id=”coin” value=”” />
<label for=”start_date”>Start Date:</label>
<input type=”date” name=”start_date” id=”start_date” value=”” />
<label for=”end_date”>End Date:</label>
<input type=”date” name=”end_date” id=”end_date” value=”” />
<label for=”description”>Description:</label>
<input type=”text” name=”description” id=”description” value=”” />
<label for=”link”>Link:</label>
<input type=”text” name=”link” id=”link” value=”” />
<label for=”comments”>Comments:</label>
<input type=”textarea” name=”comments” id=”comments” value=”” />
<button type=”submit” name=”submit”>Submit</button>

</form>
</div>

<?php get_footer(); ?>

Read more here:: how to upload image into database and how to display image on table?

Leave a Reply

Your email address will not be published. Required fields are marked *