Jump to content

simcoweb

Members
  • Posts

    1,104
  • Joined

  • Last visited

Everything posted by simcoweb

  1. 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. :)
  2. 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.
  3. Ok... garoooovy! I'll work it up and see if it works. If it doesn't...i'll be back! Thanks!
  4. Ok, cool. Then what's the code needed in the 'getdbimage.php' file?
  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. Ok, will do now but just a wee tad bit confused as to his suggestion. He says to 'switch to this' and places this: [quote]$eg_Result2['[/quote] above his suggestion. Not sure what he's implying there. Clarification please?
  9. 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.
  10. 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 :)
  11. Thanks, Barand. That speck of code wasn't even necessary since the $row variable wasn't being used. I commented it out and the script is now producing the display of all the data rows.
  12. 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?
  13. 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?
  14. 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?
  15. 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?
  16. 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]
  17. Will there be multiple config_name and config_value entries or just one that you change the value you of from time to time?
  18. Cool... found it over at Dynamic Drive in case anyone's interested: http://www.dynamicdrive.com/dynamicindex11/highlighttable.htm
  19. I've seen this effect in many places including using PHYMyAdmin. Is this a Javascript or PHP coding element? And, anyone have an example or place to get it? Thanks in advance!
  20. 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?
  21. 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 :)
  22. Cool. Moving that 'extract' into the 'while' statement produced the results. Now I have to figure out why in the spot where their image is supposed to show up that it's printing the /tmp name for each one. That display is back up. I just hadn't uploaded the 'fixed' version when you tried. http://www.plateauprofessionals.com/display.php
  23. Here's the whole page: [code]<?php // test to display addbiz results include 'config.php'; include 'header.php'; mysql_connect($dbhost, $dbuser, $dbpass) or die('No database here, boss'); mysql_select_db($dbname) or die('That database can not be found, boss.'); $sql=("SELECT * FROM members"); $result = mysql_query($sql) or die('Can not find that database today'); // insert extract function extract(mysql_fetch_array($result,EXTR_SKIP)); while ($row = mysql_fetch_assoc($result)) {   echo <<<HTML <div align='center'> <table border='0' cellpadding='0' style='border-collapse: collapse' width='530'> <tr><td colspan='2' background='http://www.plateauprofessionals.com/images/top2.gif' width='530' height='35' style='padding: 10px'><h2>$name</h2> </td> </tr><tr> <td height='15' colspan='2'> </td> </tr> <tr> <td style='padding-left: 10px; padding-right: 10px; padding-top:5px; padding-bottom:5px' width='229' valign='top'>$image</td> <td style='padding-left: 10px; padding-right: 10px' width='261'> <div align='center'> <table border='0' cellpadding='0' style='border-collapse: collapse' width='100%'> <tr> <td style='border-left-width: 1px; border-right-style: solid; border-right-width: 1px; border-top: 1px dotted #666633; border-bottom-width: 1px; padding: 4px' width='46%' bgcolor='#E3E1E1'><font class='bodytext'> <i>• $title</i></td> </tr><tr> <td style='border-left-width: 1px; border-right-style: solid; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px dotted #666633; padding: 4px' width='46%' bgcolor='#EFEDED'> <font class='bodytext'>• $phone</td></tr> <tr> <td style='border-left-width: 1px; border-right-style: solid; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px dotted #666633; padding: 4px' width='46%' bgcolor='#E3E1E1'> <font class='bodytext'>• $email</td> </tr><tr> <td style='border-left-width: 1px; border-right-style: solid; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px dotted #666633; padding: 4px' width='46%' bgcolor='#EFEDED'> • <a class="body" href="$url">Click Here To Visit My Site</a></td> </tr> <tr> <td style='border-left-width: 1px; border-right-style: solid; border-right-width: 1px; border-top-width: 1px; border-bottom: 1px dotted #666633; padding: 4px' width='46%' bgcolor='#E3E1E1'> • <a class="body" href='contact.php'>Click here to contact $name</a> </td> </tr> </table> </div> &nbsp;</td> </tr> <tr> <td style='padding: 10px' colspan='2'> <font class='bodytext'><b>About My Services</b></td> </tr> <tr> <td style='padding: 10px' colspan='2' class='bodytext' bgcolor='#e9efef' width='500'>$details</td></tr> <tr><td style='padding: 10px' colspan='2'> <font class='bodytext'><b>My Specialties</b></td> </tr> <tr><td style='padding: 10px' colspan='2' class='bodytext' bgcolor='#edecde' width='500%'>$specialties</td> <tr> <td style='padding-left: 0px; padding-right: 0px; padding-top: 4px; padding-bottom: 4px' background='images/bottom.gif' height='37' colspan='2'> <p align='center' class='bodytext'>You can use our <a class="body" href='search.php'>key word search</a> option also.</td> </tr> </table> </div> HTML; } include 'footer.php'; ?> [/code]
×
×
  • 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.