#31
  1. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    ERROR 2000


    Whill i was creating the table in my database i got the following msg
    <br>

    <br>
    mysql> CREATE TABLE blade(
    <br>
    -> naam CHAR(20),
    <br>
    -> telefoon CHAR(20),
    <br>
    -> email CHAR(20),
    <br>
    -> );
    <br>
    ERROR 2000: You have an error in your SQL syntax near ')' at line 5
    <br>

    <br>
    can anybody please tell me what I'm doing wrong??
    <br>

    <br>
    Thanks greetings Arhur
  2. #32
  3. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: image on DB vs. filesys.


    I'd rather prefer information on how to get the images OUT of the db. They are to be used on a web page, right?
    <br>
    <br>
    Since the images are not sent together with the html page but in subsequent requests, is it possible to let the web server get them out from the db?
    <br>
    <br>
    btw, BLOB is for Binary Large OBject
    <br>
    <br>
    // Martin
  4. #33
  5. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: ERROR 2000


    You should not have a comma (,) after the email CHAR(20) line. All of the lines in a table definition have commas after them except the last one.
    <br>
    <br>
    Hope this helps.
  6. #34
  7. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: image on DB vs. filesys.


    Here is some source code that should do it... Basically write to a temp file and then read the temp file ... may be deleted later!

    <!-- Code -->
    <p><pre><font color=#000000><xmp>
    <html>
    <body>
    <?php mysql_connect("host","root","pass");
    $result= mysql_db_query("pictures","select * from pix");
    while ($row=mysql_fetch_array($result)){
    $filename = "/home/httpd/htdocs/images/$row[student_number].jpg";
    echo $filename."";
    $fp=fopen($filename,"w");
    fwrite($fp,$row[pic]);
    fclose($fp);
    echo "<div align=center><img src=\"images/$row[student_number].jpg\" width=100></div>";
    }
    mysql_free_result($result);
    ?>
    </body>
    </html>
    </xmp></font></pre><p>
    <!-- Code -->
  8. #35
  9. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: newbie problems


    Same Here
  10. #36
  11. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: problem of giving .phtml file as world readable


    PHP tags are parsed on the server. They deliever html to the client. You don't need to worry about a someone seeing your passwords. They will not show up to the user.
  12. #37
  13. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: problem of giving .phtml file as world readable


    i know that but what if ne user having account on my sever .....i mean evn he is hosting on same server
  14. #38
  15. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: Next part?


    Yes,
    <br>
    <br>
    The next part will be most useful, as was this part.
    <br>
    <br>
  16. #39
  17. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: graphics


    I think, like the rest of us who arent that good yet with PHP and MySQL, you will have to wait for part 2.
  18. #40
  19. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: problem of giving .phtml file as world readable


    Try this:
    <?
    echo $REMOTE_HOST, REMOTE_ADDR
    ?>
    save to a .phtml file and view it via a web browser, the source will just show the IP addr, and the IP NAME, not the PHP tags, ALL of these are masked server side, so the sclient doesn't even know that they are there
  20. #41
  21. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: problem of giving .phtml file as world readable


    i mean the other guy who is also hosting the site on my server
    <br>
    he cxan very well read the DB passwd frm my .phtml file by telnetting to my server
    <br>
    ranjeet
    <br>
    ranjeet@india.com
  22. #42
  23. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: problem of giving .phtml file as world readable


    Then if that's the case, then need to talk to him as this is theonly wasy of getting MySQL passwords into the files.

    If you dont trust him, then well....
  24. #43
  25. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: Next part?


    Sorry, Ive been swamped with work... 5 jobs going on at once. Does anyone want to help out with the next part of the tut? Im getting so much email asking for the next part but I cant find the time, if you want to help email me info@endura.co.nz and i send you what i have so far OK
    <br>
    <br>
    Cheers
  26. #44
  27. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: image on DB vs. filesys.


    first: uploading the pic:



    <!-- Code -->
    <p><pre><font color=#008000><xmp>
    <?
    If($Picture != "none") {
    $PSize = filesize($Picture);
    $mysqlPicture = addslashes(fread(fopen($Picture, "r"), $PSize));
    mysql_connect($host,$username,$password)
    or die("Unable to connect to SQL server");
    @mysql_select_db($db)
    or die("Unable to select database");
    mysql_query("INSERT INTO Images (Image) VALUES '($mysqlPicture')")
    or die("Can't Perform Query");
    }
    else {
    echo"You did not upload any picture";
    }
    ?>
    </xmp></font></pre><p>
    <!-- Code -->


    next we create an image-tag:


    <!-- Code -->
    <p><pre><font color=#008000><xmp>

    <HTML>
    <BODY>
    <?
    mysql_connect($host,$username,$password)
    or die("Unable to connect to SQL server");
    @mysql_select_db($db)
    or die("Unable to select database");
    $result=mysql_query("SELECT * FROM Images")
    or die("Can't Perform Query");
    While($row=mysql_fetch_object($result)) {
    echo "<IMG SRC=\"SecondType.php3?PicNum=$row->PicNum\">";
    }
    ?>
    </BODY>
    </HTML>

    </xmp></font></pre><p>
    <!-- Code -->


    And SecondType.php3 gets the image for us:


    <!-- Code -->
    <p><pre><font color=#008000><xmp>

    <?
    $result=mysql_query("SELECT * FROM Images WHERE PicNum=$PicNum")
    or die("Can't perform Query");
    $row=mysql_fetch_object($result);
    Header( "Content-type: image/gif");
    echo $row->Image;
    ?>

    [\code]
    </xmp></font></pre><p>
  28. #45
  29. No Profile Picture
    guest
    Guest
    Devshed Newbie (0 - 499 posts)

    Re: problem of giving .phtml file as world readable


    If this guy is not trusted, why give him access to be able to telnet into your system.....

    will it still be vulnerable

IMN logo majestic logo threadwatch logo seochat tools logo