0

Hi..Good 'day! wanna ask that is there any code in uploading image in php..i wanna add field name in my candidate table in my database..and i wanna add there image but i do not know what's the right data type am going to use..as well as the code..

Edited by takeshi: n/a

2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by takeshi
0

http://www.wellho.net/solutions/php-example-php-form-image-upload-store-in-mysql-database-retreive.html

May be helpful.

Ok..it works well..hmmm do you know how to re-encode that code you've gave?i mean,i want to add that code in my program which is adding record..i already added it but when i view all the records together with their image,there's an error..
here's my code in view_candidates:

<?php
    include('connect-db.php');

   
    $result = mysql_query("SELECT * FROM candidates") 
        or die(mysql_error());  
        
    
   echo "<table width='600' cellspacing='0' cellpadding='0' border='1' align='center'>";
    echo "<tr> <th bgcolor='lightblue'>Name</th><th bgcolor='lightblue'>Position</th> <th bgcolor='lightblue'>PartyName</th> 
<th bgcolor='lightblue'>Image</th><th bgcolor='lightblue'>Action</th></tr>";

    // loop through results of database query, displaying them in the table
    while($row = mysql_fetch_array( $result )) {
        
        // echo out the contents of each row into a table
       
        echo '<td><center>' . $row['name'] . '</td>';
        echo '<td><center>' . $row['position'] . '</td>';
	echo '<td><center>' . $row['partyname'] . '</td>';
        echo '<td><center>' . $row['imagedata'] . '</td>';
        echo '<td><center><a href="edit_candidates.php?id=' . $row['id'] . '">Modify</a>&nbsp;&nbsp;&nbsp;<a href="delete_candidates.php?id=' . $row['id'] . '">Delete</td>'; 
        echo "</tr>";  
    } 

   
    echo "</table>";
?>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.