Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Jun 2005
    Posts
    91
    Thanks
    19
    Thanked 0 Times in 0 Posts
    PHP Code:
    $conn = @mysql_connect($host$user$pass) or die("host, user, pass .");
    mysql_select_db($db$conn) or die("$db ??.");
        for (
    $i=1$i<=1$i++) {
        
    $row mysql_fetch(" select up_file, content from $up_load where files = '$up_files' and up_id = '$up_id' and file_no = '$i' ");
        if  (
    eregi('\.jpg'$row[up_file]))  echo $row[up_file]. "<p>";
        } 

    What am i missing?

  • #2
    Regular Coder
    Join Date
    Mar 2004
    Location
    Australia
    Posts
    217
    Thanks
    0
    Thanked 1 Time in 1 Post
    PHP Code:
    $conn = @mysql_connect($host$user$pass) or die("host, user, pass .");
    mysql_select_db($db$conn) or die("$db ??.");
        for (
    $i 1$i <= 1$i++) 
        {
            
    $row mysql_fetch(" SELECT `up_file`, `content` FROM '$up_load' WHERE `files` = '$up_files' AND `up_id` = '$up_id' AND `file_no` = '$i' ");
                if  (
    eregi('\.jpg'$row["up_file"]))  
                {
                    echo 
    $row["up_file"]. "<p>";
                }
        } 
    Sorry i had too format it neatly to understand what you were doing :O all i could see while i had a quick look was $row[up_file] should have been $row["up_file"]...

    if it still doesnt work have a look to see what the path of the image is thats trying to be included (right click and properties)... it may be looking to a different path also.

  • #3
    New Coder
    Join Date
    Jun 2005
    Posts
    91
    Thanks
    19
    Thanked 0 Times in 0 Posts
    Dear Serex,

    Thanks a lot.

    I will study.

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Whew.
    1. $row[var] == $row['var'] == $row["var"], so long as var is only string or numeric data. "var" will probably give you troubles though with numeric. For stricter reasoning, you should enclose all strings within a set of single (or double, however for size and output times I recommend single) quotations, and numeric or constant data without quotations. This will keep notices away from your output as well. More information about 'why its bad...' here.

    2. mysql_fetch() does not exist. If you have php5.x, you can use mysqli_fetch, though its more of a OOP style class, and not quite the same for that. Otherwise, you are using a user defined function which I do not see declared. Assuming you are meaning to use mysql_fetch[row|array|assoc].

    3. There is no content type header. If you use binary data, I would recommend this to be added.

    4. I don't know what you are looking for. I'd say your looking for a binary data image, though you won't get it to work very well with the html in there. You would need two scripts to process this, one to output data to the browser directly, and another to create the call. Ex: <img src="myimage.php?imageid=4" /> for instance. I don't recommend combining both into one script if this is what you are doing. If you are retrieving file links, that is a completely different scenario.
    If you provide more information for what it is you are retrieving and how the variables are being created, we can help you more with putting this together.


  •  

    Posting Permissions

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