Closed Thread
Page 15 of 22 FirstFirst ... 51314151617 ... LastLast
Results 141 to 150 of 214

Thread: Tutorial: Storing Images in MySQL with PHP / Part II / Display your images

  1. #141
    Jaan Guest

    Re: Tutorial: Storing Images in MySQL with PHP / Part II / Display your images

    Hehe, no problem

  2. CODECALL Circuit advertisement

     
  3. #142
    kasha is offline Newbie
    Join Date
    Mar 2010
    Posts
    9
    Rep Power
    0

    Re: Tutorial: Storing Images in MySQL with PHP / Part II / Display your images

    I keep getting the msg tht no image has been selected, and i have...please advise....

  4. #143
    k1net1cs is offline Newbie
    Join Date
    Oct 2009
    Posts
    20
    Rep Power
    0

    Re: Tutorial: Storing Images in MySQL with PHP / Part II / Display your images

    Did you type the URL correctly?

  5. #144
    Jaan Guest

    Re: Tutorial: Storing Images in MySQL with PHP / Part II / Display your images

    Can you show us your code ?

  6. #145
    kasha is offline Newbie
    Join Date
    Mar 2010
    Posts
    9
    Rep Power
    0

    Re: Tutorial: Storing Images in MySQL with PHP / Part II / Display your images

    Why wont u post my msgs!!!!!!!

  7. #146
    Jaan Guest

    Re: Tutorial: Storing Images in MySQL with PHP / Part II / Display your images

    Well.. you can post them here ? You have already posted 2 messages..

  8. #147
    kasha is offline Newbie
    Join Date
    Mar 2010
    Posts
    9
    Rep Power
    0

    Re: Tutorial: Storing Images in MySQL with PHP / Part II / Display your images

    add.html
    Code:
    <title>Upload form</title>
    
    <form id='Upload' enctype="multipart/form-data" action="insert.php" method="post" name="changer">
    <input name="MAX_FILE_SIZE" value="102400" type="hidden">
    
    <h1> Upload Form </h1>
    
    <label for="file">File to upload:</label>
    <input id="file" type="file" name="file">
    
    <label for="submit">Press to...</label>
    <input id="submit" type="submit" name="submit" value="Upload me!"
    
    </head>
        
        <body>
       
        
        </form>
        
        
        </body>
    </html>
    Last edited by Jaan; 03-01-2010 at 05:14 PM. Reason: Please use code tags when you are posting your codes!

  9. #148
    k1net1cs is offline Newbie
    Join Date
    Oct 2009
    Posts
    20
    Rep Power
    0

    Re: Tutorial: Storing Images in MySQL with PHP / Part II / Display your images

    What the...?
    That is a serious case of malformed HTML over there.

    I'll try to "fix" the HTML code, but this still won't fix anything since this is just the upload form and nothing else.

    HTML Code:
    <html>
    
    <head>
    <title>Upload form</title>
    </head>
    
    <body>
    <form id='Upload' enctype="multipart/form-data" action="insert.php" method="post" name="changer">
    <input name="MAX_FILE_SIZE" value="102400" type="hidden">
    
    <h1> Upload Form </h1>
    
    <label for="file">File to upload:</label>
    <input id="file" type="file" name="file">
    
    <label for="submit">Press to...</label>
    <input id="submit" type="submit" name="submit" value="Upload me!"
    </form>
    </body>
    
    </html>

  10. #149
    kasha is offline Newbie
    Join Date
    Mar 2010
    Posts
    9
    Rep Power
    0

    Re: Tutorial: Storing Images in MySQL with PHP / Part II / Display your images

    Hi guys! Finally this **** thing lets me sign in and type properly. I just want to say that i thought i had pasted all my code but obviously that didnt happen...

    Anyway i have restarted alllll my code over again which is a good thing as my understanding of php has slightly increased.
    This code wont work at all! I have tried and re-checked everything soo many time still no luck. Im still a newbie to this so maybe someone else can tell what im doing wrong. I realllly hope this works

    Index.php:

    Code:
    <?php

    require_once("database.php");

    if(isset(
    $database)) {echo "true"; } else {echo "false"; }  
    echo 
    "<br />";

    echo 
    "is this working?";

    ?>
    database.php
    Code:
    <?php
    require_once("config.php");

    class 
    MySQLDatabase {
        
        private 
    $connection;
        
        function 
    __construct() {
            
    $this->open_connection();
        }
        
        public function 
    open_connection() {
            
    $this->connection mysql_connect(DB_SERVERDB_USERDB_PASS);
            if (!
    $this->connection) {
                die(
    "Database connection failed: " mysql_error());
            }else {
                
    $db_select mysql_select_db(DB_NAME$this->connection);
                if (!
    db_select) {
                    die(
    "Database selection failed: " mysql_error())
                }
            }
        }

        public function 
    close_connection(){
        if(isset(
    $this->connection)) {
            
    mysql_close($this->connection);
            unset(
    $this->connection);
        }
      }
    }

        public function 
    query ($sql){
         
    $result mysql_query($sql$this->connection);
         
    $this->confirm_query($result);
         return 
    $result;
      }

        public function 
    mysql_prep$value ){
        
    $magic_quotes_active get_magic_quotes_gpc();
        
    $new_enough_php function_exists ("mysql_real_escape_string");
        if(
    $new_enough_php) {
            if(
    $magic_quotes_active ) { $value stripslashes($value); }
            
    $value mysql_real_escape_string($value);
        } else {
            if(
    $magic_quotes_active) {$valueaddslashes($value); }
        }
        return 
    $vlaue;
        }


        private function 
    confirm_query ($result) { 
        if (!
    $result){
            die(
    "Database query failed: " .mysql_error() )
        }
    }
     
    }

    $database = new MySQLDatabase();
    $db =& $database;

    ?>
    config.php:

    Code:
    <?php

    //Db constants
    defined ('DB_SERVER') ? null define ="DB_SERVER""localhost"); // Host name
    defined ('DB_USER') ? null define ="DB_USER""root"); // Mysql username
    defined ('DB_PASS') ? null define ="DB_PASS""root"); // Mysql password
    defined ('DB_NAME') ? null define ="DB_NAME""User"); // Database name


    ?>
    THANKS IN ADVANCE FOR ANY HELP/ADVICE ITS MUCH APPRECIATED.


    P.S. i've been using a video tutorial, by Lynda.com...thought i'd mention it incase anyone else has used it.

  11. #150
    kasha is offline Newbie
    Join Date
    Mar 2010
    Posts
    9
    Rep Power
    0

    Re: Tutorial: Storing Images in MySQL with PHP / Part II / Display your images

    i realise its slightly off-topic opologies if i posted it in the wrong topic thread.

Closed Thread
Page 15 of 22 FirstFirst ... 51314151617 ... LastLast

Thread Information

Users Browsing this Thread

There are currently 2 users browsing this thread. (0 members and 2 guests)

Similar Threads

  1. Replies: 3
    Last Post: 02-07-2011, 11:29 AM
  2. Tutorial: Storing Images in MySQL with PHP
    By Jordan in forum PHP Tutorials
    Replies: 47
    Last Post: 01-04-2011, 08:37 PM
  3. Beginner Storing images in XML file - Part II - Displaying image
    By Jaan in forum PHP Tutorials
    Replies: 6
    Last Post: 01-04-2011, 08:35 PM
  4. display images sequentially using PHP and MySQL
    By jhanjon in forum PHP Development
    Replies: 2
    Last Post: 10-08-2009, 12:11 PM
  5. Replies: 2
    Last Post: 07-16-2009, 12:48 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts