Jump to content

Search the Community

Showing results for tags 'broken image mysql'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. Hey there! I have this big project due 5 days and I really need some help. I've made a imagesharing website where you upload images to a MySQL database into a table called images (with id, name and image) This is the uploading form code: <form action="laddaupp.html" method="POST" enctype="multipart/form-data"> <p> Ladda upp här </p> <input type="file" name="image" /> <input type="submit" value="Ladda upp" /> </form> <?php define('DB_NAME','xxxxxx'); define('DB_USER','xxxxxxxxx'); define('DB_PASSWORD','xxxxxxxx'); define('DB_HOST','xxxxxxxx.com'); //Ansluta mysql_connect(DB_HOST, DB_USER, DB_PASSWORD) or die (mysql_error()); mysql_select_db(DB_NAME) or die (mysql_error()); $file= $_FILES['image']['tmp_name']; if(!isset($file)) echo "Välj en bild"; else { $image = addslashes(file_get_contents($_FILES['image']['tmp_name'])); $image_name = addslashes($_FILES['image']['name']); $image_size = addslashes(getimagesize($_FILES['image']['tmp_name'])); if($image_size==FALSE) echo "Det är ingen bild"; else { if(!$insert = mysql_query("INSERT INTO images VALUE ('','$image_name','$image')")) echo "Problem med uppladdning"; else { $lastid = mysql_insert_id(); echo "Klart! <p /> Bilden du laddade upp: <p /> <img src=get.php?id=$lastid>"; } } } ?> and this is the page which I'm trying to view the images on: <?php define('DB_NAME','xxxxxxx'); define('DB_USER','xxxxxxx'); define('DB_PASSWORD','xxxxxx'); define('DB_HOST','xxxxxxxxxxxxxx.com'); mysql_connect(DB_HOST, DB_USER, DB_PASSWORD) or die (mysql_error());mysql_select_db(DB_NAME) or die (mysql_error()); $res=mysql_query("SELECT * FROM images");echo "<table>";while($row=mysql_fetch_array($res)){echo "<tr>";echo "<td>";?> <img src="data:image/jpeg;base64,base64_encode($row['image'])"> <?php echo "</td>";echo "<td>"; echo $row["name"]; echo "</td>";echo "</tr>";}echo "</table>";mysql_close(); ?> When I open this file I get this: Why do my images get broken?? Could someone please help me I'd be really happy!
×
×
  • 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.