[PHP-DB] concatenating (was: RE: [PHP-DB] Retrieving/Displaying hyperlinked images with PHP)
Can somebody explain to me the rule on concatenating? So far, I haven't had to use those mysterious-looking dots. ;) My code goes like this: echo tdimg src=\../site/products/$prod_sku.gif\ border=0/td/tr; Does it work because I'm lucky? Honestly I haven't been impressed with the documentation I've found online. Jen Swofford [EMAIL PROTECTED] [snip] // Then show image and/or details echo img src=/image_folder/.$row[product_image].; [snip] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] concatenating (was: RE: [PHP-DB] Retrieving/Displaying hyperlinked images with PHP)
Well, the string concatenation can be used to force PHP read and print a variable within a echoed or printed string. As far as I know, it should be used to make PHP handle a function inside a string. i.e. echo your total is:. total_function(); In your example, you might use as well: echo img src=\../site/products/ . $prod_sku.gif . \; having the same results. Notice how the HTML part is always enclosed by quotes. PHP server reads this as: echo img src=\../site/products/whatever.gif\; Hope this works, C. -Original Message- From: Jen Swofford [mailto:[EMAIL PROTECTED]] Sent: Sunday, July 07, 2002 2:31 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] concatenating (was: RE: [PHP-DB] Retrieving/Displaying hyperlinked images with PHP) Can somebody explain to me the rule on concatenating? So far, I haven't had to use those mysterious-looking dots. ;) My code goes like this: echo tdimg src=\../site/products/$prod_sku.gif\ border=0/td/tr; Does it work because I'm lucky? Honestly I haven't been impressed with the documentation I've found online. Jen Swofford [EMAIL PROTECTED] [snip] // Then show image and/or details echo img src=/image_folder/.$row[product_image].; [snip] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Retrieving/Displaying hyperlinked images with PHP
I am trying to build a product detail page that pulls data from a MYSQL database using PHP. The data for the page includes product images, which I am trying to link to (i.e. from their location on the web server) instead of loading the images into the database. However, I cannot find any sample code that seems to work. Two questions: 1. Is this possible (i.e. to store the HYPERLINK to the image in the database , and as the results are returned to the product detail screen, the image file will be displayed)? OR RATHER do I need to store the physical image file in the database location and query it that way? 2. The code sample below contains several lines that show a field populated with text that I am returningthe line under the //Test comment is the field that I'm trying to pull an image back for: printf(REL_PLAN7: %sbr\n, mysql_result($result,0,REL_PLAN7)); printf(REL_PLAN8: %sbr\n, mysql_result($result,0,REL_PLAN8)); printf(REL_PLAN9: %sbr\n, mysql_result($result,0,REL_PLAN9)); //test printf(mysql_result($result,0,a href=FRONT_RENDFRONT_REND/a); NOTE: FRONT_REND is the name of the database field, and it contains a full web address, not relative. Any help would be GREATLY appreciated. Thanks. Mark -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Retrieving/Displaying hyperlinked images with PHP
Maybe I don't understand what your need is, but here's a shot. What you want to do, I've accomplished before just by placing a field in the database which points to the image name called i.e. product_image. What this field contains, is just the name of the picture i.e. prod_001.jpg. When the *details.php* page is displayed, I just make PHP print the image like this: // First, make array of product from DB $row = mysql_fetch_array($query); // Then show image and/or details echo img src=/image_folder/.$row[product_image].; and that's it. Like this, you just have to specify the name of each image when inserting a new product. You can also make more than one image field if needed i.e. several angles of a vehicle. Hope this helps you, C. -Original Message- From: markbm [mailto:[EMAIL PROTECTED]] Sent: Saturday, July 06, 2002 8:35 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Retrieving/Displaying hyperlinked images with PHP I am trying to build a product detail page that pulls data from a MYSQL database using PHP. The data for the page includes product images, which I am trying to link to (i.e. from their location on the web server) instead of loading the images into the database. However, I cannot find any sample code that seems to work. Two questions: 1. Is this possible (i.e. to store the HYPERLINK to the image in the database , and as the results are returned to the product detail screen, the image file will be displayed)? OR RATHER do I need to store the physical image file in the database location and query it that way? 2. The code sample below contains several lines that show a field populated with text that I am returningthe line under the //Test comment is the field that I'm trying to pull an image back for: printf(REL_PLAN7: %sbr\n, mysql_result($result,0,REL_PLAN7)); printf(REL_PLAN8: %sbr\n, mysql_result($result,0,REL_PLAN8)); printf(REL_PLAN9: %sbr\n, mysql_result($result,0,REL_PLAN9)); //test printf(mysql_result($result,0,a href=FRONT_RENDFRONT_REND/a); NOTE: FRONT_REND is the name of the database field, and it contains a full web address, not relative. Any help would be GREATLY appreciated. Thanks. Mark -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Retrieving/Displaying hyperlinked images with PHP
Sorry. The code down there should read: [snip] // Then show image and/or details echo img src=/image_folder/.$row[product_image].; [snip] -Original Message- From: César Aracena [mailto:[EMAIL PROTECTED]] Sent: Sunday, July 07, 2002 12:46 AM To: 'markbm'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Retrieving/Displaying hyperlinked images with PHP Maybe I don't understand what your need is, but here's a shot. What you want to do, I've accomplished before just by placing a field in the database which points to the image name called i.e. product_image. What this field contains, is just the name of the picture i.e. prod_001.jpg. When the *details.php* page is displayed, I just make PHP print the image like this: // First, make array of product from DB $row = mysql_fetch_array($query); // Then show image and/or details echo img src=/image_folder/.$row[product_image].; and that's it. Like this, you just have to specify the name of each image when inserting a new product. You can also make more than one image field if needed i.e. several angles of a vehicle. Hope this helps you, C. -Original Message- From: markbm [mailto:[EMAIL PROTECTED]] Sent: Saturday, July 06, 2002 8:35 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Retrieving/Displaying hyperlinked images with PHP I am trying to build a product detail page that pulls data from a MYSQL database using PHP. The data for the page includes product images, which I am trying to link to (i.e. from their location on the web server) instead of loading the images into the database. However, I cannot find any sample code that seems to work. Two questions: 1. Is this possible (i.e. to store the HYPERLINK to the image in the database , and as the results are returned to the product detail screen, the image file will be displayed)? OR RATHER do I need to store the physical image file in the database location and query it that way? 2. The code sample below contains several lines that show a field populated with text that I am returningthe line under the //Test comment is the field that I'm trying to pull an image back for: printf(REL_PLAN7: %sbr\n, mysql_result($result,0,REL_PLAN7)); printf(REL_PLAN8: %sbr\n, mysql_result($result,0,REL_PLAN8)); printf(REL_PLAN9: %sbr\n, mysql_result($result,0,REL_PLAN9)); //test printf(mysql_result($result,0,a href=FRONT_RENDFRONT_REND/a); NOTE: FRONT_REND is the name of the database field, and it contains a full web address, not relative. Any help would be GREATLY appreciated. Thanks. Mark -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php