Jump to content

simcoweb

Members
  • Posts

    1,104
  • Joined

  • Last visited

Posts posted by simcoweb

  1. Not much hair left! This is getting really frustrating as i've tried SOOOOOOOO many angles on this.

    Ok, here's the latest. First, here's the 'official' display page for the profiles and images utilizing some dummy people entered into the database. The first entry has an image file named in the 'imageName' field. The others don't. I'm using this tag to summon the pic:

    <?php echo '<img src="http://www.plateauprofessionals.com/images/photo/' . $image . '" width='150' height='175'>'; ?>

    You can view the page here: http://www.plateauprofessionals.com/display.php

    For some reason it's displaying the ';? where the image should display. That's problem #1

    Now, when I change the image tag to remove the <?php echo code and just have the following:

    [quote]http://www.plateauprofessionals.com/images/photo/' .  $image . '[/quote]

    Then the red x box shows but no image. So, if you check the properties (right click/properties) it shows this URL to the image:

    [quote]http://www.plateauprofessionals.com/images/photo/'%20.%20%20.%20'[/quote]

    I've even created a second sql query just for the images:

    [code]$sql2=("SELECT imageName FROM members WHERE imageName='memberid'");
    $result2 = mysql_query($sql2) or die(mysql_error());[/code]

    And set a variable as: $image = $sql['imageName'];

    No matter what i've done/do I can't get this simple friggin image to show up. Help?



  2. http://www.plateauprofessionals.com/images/photo/42-15602495.jpg is the direct link.

    Also, I rewrote the 'getimage.php' so it would just display the entries in the 'File1' image field. There's only 3 entries in that field in that table. It displays the image names. Check it out:

    http://www.plateauprofessionals.com/getimage.php

    Here's the code for it. Excuse the sloppiness as i've made several revisions to it:

    [code]<?php

    include 'config.php';
    mysql_connect($dbhost, $dbuser, $dbpass) or die(mysql_error());
    mysql_select_db($dbname) or die(mysql_error());

    $sql = "SELECT File1 FROM  plateau_pros";
    mysql_query($sql);
    $Result = mysql_query($sql);

    echo "<table>";
    while ($a_row = mysql_fetch_array( $Result ))
    {
      echo "<tr><td>" . $a_row['File1'] . "</td></tr>\n";
    }
    echo "</table>";

    ?>[/code]
  3. Yeah, as I explained originally I was storing the image [i]name[/i] in a MySQL database field as part of the person's profile. So, basically the table fields are:

    id (auto incremented)
    name
    email
    address
    city
    state
    zip
    business
    title
    cell
    [b]photo[/b]

    (or, in this case the photo field is labeled File1)

    The file upload function basically is parking the uploaded photo in to a folder /images/photo while the MySQL query upon submitting the registration form is inserting the [i]name[/i] of the file into the table field. The file upload and data insertion are all included in the one 'register.php' script.

    So, at this point i'm simply trying to get that damn picture that's sitting in the /images/photo folder to show up when someone wants to view 'X' profile. :)
  4. Of course I can't get it to work :(

    Here's the code I wrote for the 'getimage.php' file:

    [code]<?php
    header("content-type: 'image/jpeg'");
    include 'config.php';
    mysql_connect($dbhost, $dbuser, $dbpass) or die(mysql_error());
    mysql_select_db($dbname) or die(mysql_error());

    $sql = "SELECT File1 FROM  plateau_pros WHERE egnID='".$userid ."'";
    mysql_query($sql);

    echo $userid['File1'];
    ?>[/code]

    I've tried a variety of <img src tags but here's what I have there now. The 13 is the id of the member.

    [code]<image src="http://www.plateauprofessionals.com/getimage.php?id=13">[/code]

    I know i'm missing something. All that shows is the broken image icon (red x) and when I right click on that and hit View Image it tries to download the getimage.php file. Any guidance is greatly appreciated.
  5. Ok, I think I understand that. But here's the additional explanation that needs to be relayed to you before we settle on a course of action.

    This is a 'profile' page that the image will be displayed on. Basically a photo of the individual. When a visitor to the site wants to view the profiles they would first click on a category which then displays then profiles within that category. Then select an individual from the list and display/view their entire profile. Kind of like how a dating site would work only this isn't a dating site. It's more like a directory of people providing professional services in 4 main categories.

    So, when it displays the profile it has to display the image. If i'm understanding your suggestion correctly then when they clicked on the link in the listing page it would need to pass an ID variable to the full profile page where the 'getdbimage.php' file would pick it up?

    I'm not 100% on how to 'connect' the uploaded pic to the person's profile so it would pass that info along.
  6. Ok, I'm switching gears here. All I want to do is provide the easiest method of uploading and storing an image then displaying that image in an HTML page. I have the script uploading the image no problem. The part that's causing the problem is displaying the image. Here's my upload code:

    [code]// Upload File
    $eg_success_photo = false;
    if(!empty($_FILES['photo']['name']))
    {
    // Check file is not larger than specified maximum size
    $eg_allowUpload = $_FILES['photo']['size'] <= 100000 ? true : false;
    // Check file is of the specified type
    if($eg_allowUpload)
    $eg_allowUpload = preg_match('/\\.(gif|jpg|jpeg|png)$/i', $_FILES['photo']['name']) ? true : false;

    if($eg_allowUpload)
    {
    if(is_uploaded_file($_FILES['photo']['tmp_name']))
    {
    $eg_uploaddir = $_SERVER['DOCUMENT_ROOT']."/images/photo/";

    $eg_uploadphoto = $eg_uploaddir.rawurlencode($_FILES['photo']['name']);
    // Create a unique filename for the uploaded file
    $eg_i = 1;
    while (file_exists($eg_uploadphoto))
    {
    $eg_separated_filename = explode(".",$eg_uploadphoto);
    if (substr($eg_separated_filename[0],-1) == $eg_i)
    {
    $eg_separated_filename[0] = substr($eg_separated_filename[0], 0, (strlen($eg_separated_filename[0])-1));
    $eg_i++;
    }
    $eg_separated_filename[0] = $eg_separated_filename[0] . "$eg_i";
    $eg_uploadphoto = implode(".",$eg_separated_filename);
    }

    $eg_success_photo = move_uploaded_file($_FILES['photo']['tmp_name'], $eg_uploadphoto);
    }

    }

    }[/code]


    Now, what I need is the proper coding to display the image in the HTML area. Thanks in advance.
  7. This is what I get:

    [quote]Parse error: parse error, unexpected ',' in /home2/wwwplat/public_html/members.php on line 45[/quote]

    This is what I have for code:

    [code]$sql="SELECT `plateau_pros`.`egnID`, `plateau_pros`.`File1` FROM `plateau_pros`  WHERE `plateau_pros`.`egnID` = '".@$eg_Result1['File1']."'", $eg_objConn1);
    $eg_Result2 = @mysql_fetch_array($eg_recResult2, MYSQL_ASSOC;[/code]

    Line 45 is the $sql=
  8. Barand:

    Ok, I changed this section to this:

    [code]$eg_recResult2 = mysql_query("SELECT `plateau_pros`.`egnID`, `plateau_pros`.`File1` FROM `plateau_pros`  WHERE `plateau_pros`.`egnID` = '".@$eg_Result1['File1']."'", $eg_objConn1);
    $eg_Result2 = @mysql_fetch_array($eg_recResult2, MYSQL_ASSOC);

    $image = $eg_Result2['File1'];[/code]

    and my call for this pic to this:
    [code]<?php echo "<img src='http://www.plateauprofessionals.com/images/photo/$image' width='150' height='175'>"; ?>[/code]

    Still no pic displayed.

    Crayon, haven't tried your suggestion yet but will.
  9. Ok, summary:

    I have a file called 'register.php' where person enters everything about their business plus sets username/password/confirmpass PLUS selects an image to upload ( a photo of themselves ). This all seems to work fine as all the data is being inserted properly (although it's not checking for dupes and allowing the same username to be added over and over..but that's another issue).

    Now, I have page called 'members.php' that is to display their photograph and some other misc. crap. The key element is the photo. In the MySQL database in a table field is their photo's name. I have the query in the page to summon the table/field for it as so:

    [code]// Get Record Set
    $eg_recResult2 = mysql_query("SELECT `plateau_pros`.`egnID`, `plateau_pros`.`File1` FROM `plateau_pros`  WHERE `plateau_pros`.`egnID` = '".@$eg_Result1['File1']."'", $eg_objConn1);
    $eg_Result2 = @mysql_fetch_array($eg_recResult2, MYSQL_ASSOC);[/code]

    The code i'm trying to use for calling and displaying the image in the page has ranged from using an echo statement to whatever:

    tried this:
    [code]<?= @$eg_Result2['File1'] ?>[/code]

    tried this:
    [code]<? echo "<img src='http://www.plateauprofessionals.com/images/photo/$image' width='150' height='175'>";?>[/code]

    using this variable set: $image = ($eg_Result2['File1']['name']);

    I know this is basic stuff but honestly I can not find any tuts on a simple explanation on how to properly do this. Most want to splash a bunch of code up there and say 'and this is how we do it'. If I had some explanations on the steps for each part of the code then I would never have to ask this question again. Seriously, i've ready 100 image upload-to-mysql/dispaly-from-mysql tutorials and none of them explain it...they just show it.

    Anyway, I get lightning fast answers here which makes it the hottest php resource i've encountered. Any help IS ALWAYS appreciated :)

  10. On this page: [url=http://www.highlandbluffsresort.com/phase-two.php]http://www.highlandbluffsresort.com/phase-two.php[/url] the first item in the list of lots should be Lot #2. Instead it's showing Lot#3 as the first item. When I view the database in PHPMyAdmin it clearly shows lot #2 as the first row. I can't understand why it doesn't show in the posted results in the page. Here's the code:

    [code]$sql=("SELECT * FROM phase_two");
    $results=mysql_query($sql);
    $row = mysql_fetch_row($results);
    $num_rows = mysql_num_rows($results);
    if ($num_rows == 0) {
    echo "<font class='bodytext'><center>We are sorry. The lot information is unavailable at this time.<br /> Please contact us for details on available lots.<br />";
    } else {

    echo "
    <table width='700' border='0' align='center' onMouseover=\"changeto(event, 'darkkhaki')\" onMouseout=\"changeback(event, 'lightgoldenrodyellow')\">
    <tr>
    <th><font face=\"Verdana\" size=\"2\">Lot #</th>
    <th><font face=\"Verdana\" size=\"2\">Sq. Ft.</th>
    <th><font face=\"Verdana\" size=\"2\">Street</th>
    <th><font face=\"Verdana\" size=\"2\">Frontage</th>
    <th><font face=\"Verdana\" size=\"2\">Location</th>
    <th><font face=\"Verdana\" size=\"2\">View</th>
    <th><font face=\"Verdana\" size=\"2\">Acres</th>
    <th><font face=\"Verdana\" size=\"2\">Price</font></th>
    <th><font face=\"Verdana\" size=\"2\">&nbsp;</th>
    </tr>";
    while ($a_row = mysql_fetch_array( $results )) {
    echo "
    <tr bgcolor=\"lightgoldenrodyellow\">
    <td style=\"text-align: center;\"><font face=\"Verdana\" size=\"1\">" . $a_row['lot'] . "</td>
    <td style=\"text-align: center;\"><font face=\"Verdana\" size=\"1\">" . $a_row['sq_feet'] . "</td>
    <td style=\"text-align: center;\"><font face=\"Verdana\" size=\"1\">" . $a_row['street'] . "</td>
    <td style=\"text-align: center;\"><font face=\"Verdana\" size=\"1\">" . $a_row['frontage'] . "</td>
    <td style=\"text-align: center;\"><font face=\"Verdana\" size=\"1\">" . $a_row['location'] . "</td>
    <td style=\"text-align: center;\"><font face=\"Verdana\" size=\"1\">" . $a_row['view'] . "</td>
    <td style=\"text-align: center;\"><font face=\"Verdana\" size=\"1\">" . $a_row['acres'] . "</td>
    <td style=\"text-align: center;\"><font face=\"Verdana\" size=\"1\">\$" . $a_row['sale_price'] . "</td>
    <td style=\"text-align: center;\"><font face=\"Verdana\" size=\"1\"><a href=\"contact-p2.php?id=" . $a_row['lot'] . "\">Contact</a></td>
    </tr>";
    }

    print "</table>\n";
    echo "<br>";
    }
    //print "</table>\n";[/code]


    I can't see anything here that would tell it to ignore row 1 of the table. Ideas?
  11. Ok, cool. Just another note on that.. the sample url I pointed out...there's no submit button in the text field. The sample text being typed in just automatically displays in the large text area box. I can see it's an image now by right clicking on it (the displayed sample text). There must be some code that detects if the text field has anything present then goes ahead and displays it after a specific time delay. Any thoughts on that?
  12. AndyB, but in that example url I posted it doesn't appear to be using an image. It appears to be a textarea type display. In the font listings where it has 'Sample Text' next to each one I would assume that's using the GD library method. But the dynamic display of a string of text typed by the visitor is something else i'm assuming?
  13. I'm in the process of creating a font display and download system but haven't any idea what is used for creating the realtime font examples where people type in some text in a form field and the text is displayed in the font they've chosen to sample. Here's a link to an example:

    [url=http://fontso.com/font-preview.php?f=99666]http://fontso.com/font-preview.php?f=99666[/url]

    Anyone have any idea what programming language this is done in?

  14. I tried to upload a .jpg and got this:

    [code]Possible file upload attack!
    Here is some more debugging info:Array
    (
        [userfile] => Array
            (
                [name] => badboys2.sized.gif
                [type] =>
                [tmp_name] =>
                [error] => 2
                [size] => 0
            )

    )[/code]
  15. Ok, thanks for that suggestion. I used your code and now the results don't display. Just blanks below the headings. Here's a view:

    http://www.highlandbluffsresort.com/phase-one-test.php

    It should look like this previous version (the results, not the entire page):

    http://www.highlandbluffsresort.com/phase-one.php

    There's no errors when using your code but no results display. Ideas?
  16. Ok, here's what I have. A list of lots available for purchase. Each lot has an ID#. The database has 4 fields:

    unit
    location
    view
    sales_price

    I'm using this code to display the results of the query in a simple table layout:

    [code]$sql=("SELECT * FROM phase_one");
    $results=mysql_query($sql);
    $row = mysql_fetch_row($results);
    $num_rows = mysql_num_rows($results);
    if ($num_rows == 0) {
    echo "<font class='bodytext'><center>We are sorry. The lot information is unavailable at this time.<br /> Please contact us for details on available lots.<br />";
    } else {
    echo "<table width='650' border='0'>\n";
    echo "<th>Unit No.</th><th>Location</th><th>View</th><th>Sale Price</th>";
    while ($a_row = mysql_fetch_row( $results )) {
    echo "<tr>\n";
    foreach ($a_row as $field)
    print "\t<td><center>$field</td>\n";

    print "</tr>\n";
    }
    }
    print "</table>\n";[/code]

    What I want to do is have a 5th column in the results that has a 'Contact' link pointing to contact.php that would then have the lot # pre-populated in the RE: field of the form.

    I've tinkered with this and have come to the conclusion that I can't do it using this type of 'foreach' method. Or, can I? Would I need to switch from mysql_fetch_row to mysql_fetch_array then extract the array to set field variables and lay out the HTML manually and insert the $vars into the respective <td>'s? 

    A little help with this one, puhleeeeeeez :)
×
×
  • 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.