Re: [PHP-DB] Storing Images #2
-- I have my photos in /public_html/img/gid directory and with this path: img src='http://www.mydomain.com/img/{$gid}/{$photoFileName}' in getImage.php the server displays the photos. Now if I put my photos outside of the public_html like this: /hidden_images/img/gid what would be the correct path to the photos in the getImage.php script? Do you mean what url? You'll need a script to pull them from outside the document root. The advantage of this is you can do authentication checks before displaying the image. The disadvantage is the web-server isn't serving the images directly so there will be a slow down. So you point your images to getimage.php?image=123456 .. thank you for your useful comment, but I mean what url should I use for img src instead of img src='http://www.mydomain.com/img/{$gid}/{$photoFileName}' in the getImage.php script? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Storing Images #2
On 3 February 2010 16:07, wrote: I currently have all my images referenced by url in my database and stored in a folder/s and I think I will keep it that way... .. If you put the images OUTSIDE of the webroot/docroot/public_html folder (whatever you have), then a user cannot directly navigate to the file. e.g. /home/sites/your_site/public_html/images/image1.jpg http://www.yoursite.com/images/image1.jpg would probably work. But ... /home/sites/your_site/public_html/getImage.php /home/sites/your_site/hidden_images/image1.jpg Now, there is no way I can load image1.jpg from my browser. I have to use getImage.php, which I assume would require me to login or authenticate myself in some way. -- I have my photos in /public_html/img/gid directory and with this path: img src='http://www.mydomain.com/img/{$gid}/{$photoFileName}' in getImage.php the server displays the photos. Now if I put my photos outside of the public_html like this: /hidden_images/img/gid what would be the correct path to the photos in the getImage.php script? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] LIMITiT
Hi all, The following code is created by Dreamweaver 8 , it shows 18 records per page. I want to limit the total number of records to 54 that means it should show only the first 3 pages, but as it is not a simple query I can not use LIMIT , it is already used in sprintf. Could someone tell me how can I do this? $currentPage = $_SERVER[PHP_SELF]; $maxRows_showerPagination = 18; $MaxPerPage=$maxRows_showerPagination; $pageNum_showerPagination = 0; if (isset($_GET['pageNum_showerPagination'])) { $pageNum_showerPagination = $_GET['pageNum_showerPagination']; } $startRow_showerPagination = $pageNum_showerPagination * $maxRows_showerPagination; mysql_select_db($database_DB, $DB); $query_showerPagination = SELECT name, cat FROM theTable WHERE number 0 ORDER BY number DESC; $query_limit_showerPagination = sprintf(%s LIMIT %d, %d, $query_showerPagination, $startRow_showerPagination, $maxRows_showerPagination); $showerPagination = mysql_query($query_limit_showerPagination, $pager) or die(mysql_error()); $row_showerPagination = mysql_fetch_assoc($showerPagination);
[PHP-DB] character set collation
Hi everybody, 1- I have created a database in the remote server and I have the same database in my local machine ,which is configured as IIS server. 2- MySQL server in my computer is configured as follows: Default-character-set=latin1 for CLIENT SECTION Default-character-set=latin1 for SERVER SECTION 3- I have populated my local database and tested it , it works fine. 4- Using SELECT I put the data from my local database in a text file together with SQL commands and upload it to remote server (Import) 5- The above procedure was working well until they upgraded the phpMyAdmin to 2.8.0.1 6- The problem I am experiencing now is that: when I upload data to remote server using (Import)I see question marks ? instead of normal text in the description and title fields of the database. 7- It seems that it is character set collation problem but I cant figure it out! Any idea ? - Looking for last minute shopping deals? Find them fast with Yahoo! Search.
[PHP-DB] Re: record pointer
If I understand that correctly, you only need to add the extra condition to the WHERE clause of the main query. So: SELECT id, name, cat FROM table WHERE cat = (SELECT cat FROM table WHERE id = $ID) AND id = $ID; This should display all rows, before and including the row with the same 'cat' as 'id' has. For your example of $ID = 51 it should display: +-+--+ | id | cat | +-+--+ | 40 | FLK | | 41 | FLK | | 42 | FLK | | 44 | FLK | | 45 | FLK | | 46 | FLK | | 47 | FLK | | 48 | FLK | | 49 | FLK | | 50 | FLK | | 51 | FLK | +-+--+ O.K. this is the problem! it should display all rows, before and including AND AFTER the row ,starting from the specified row with the same 'cat' as 'id' has. - Shape Yahoo! in your own image. Join our Network Research Panel today!
[PHP-DB] Re: record pointer
Chris [EMAIL PROTECTED] wrote: Huh? You want before, after and including? So everything? Maybe give us an example of what you want to get out of the query rather than us guessing. I keep the path to my photos in this DB so it is a photo Gallery , when I click on a thumbnail I want to see the image detail and then scroll to the next or previous photos with the same category. - Luggage? GPS? Comic books? Check out fitting gifts for grads at Yahoo! Search.
[PHP-DB] record pointer
Hi all, My DB has the following columns: id, name ,cat. I want to select a cat i.e. cat=zzz when the query is finished I should see a specific record within this cat which is defined by id, like id=yyy Any idea how to do this? Is there a function or something like record pointer in MySQL ? cheers - Shape Yahoo! in your own image. Join our Network Research Panel today!
[PHP-DB] Re: record pointer
I am selecting by id Dan Shirah [EMAIL PROTECTED] wrote: Date: Thu, 5 Jul 2007 15:51:56 -0400 From: Dan Shirah [EMAIL PROTECTED] To: elk dolk [EMAIL PROTECTED] CC: php-db@lists.php.net Subject: Re: [PHP-DB] Re: record pointer Okay, in your first post you said you were selecting by category, now you're saying you are selecting by ID and want all corresponding records that have the same category as the selected ID. Which way are you trying to do this?? On 7/5/07, elk dolk wrote: O.K. the id column is primary key and it is auto_incerment .I think my explanation was not clear enough : this is my query : SELECT * FROM table WHERE ID=$ID this will find the record with the specified ID and I will be able to see it, now I want to be able to scroll up and down to all the records that belong to the same cat(egory)! Frank Flynn wrote: This is standard SQL: SELECT id, name ,cat FROM catTable WHERE cat = 'zzz'; This would return something like id name cat 1 fredzzz 5 fefezzz 18Mr. Puddles zzz 27Moris zzz and so on Your column 'id' is the pointer you're looking for. You should define it as 'PRIMARY KEY' and perhaps AUTO_INCREMENT (this means MySQL will automatically assign a value to it). Hi all, My DB has the following columns: id, name ,cat. I want to select a cat i.e. cat=zzz when the query is finished I should see a specific record within this cat which is defined by id, like id=yyy Any idea how to do this? Is there a function or something like record pointer in MySQL ? cheers - Get your own web address. Have a HUGE year through Yahoo! Small Business. - Fussy? Opinionated? Impossible to please? Perfect. Join Yahoo!'s user panel and lay it on us.
[PHP-DB] Re: record pointer
Thank you Niel I am very close now have a look : mysql select id,cat from table where cat=(select cat from table where id=49); +-+--+ | id | cat | +-+--+ | 40 | FLK | | 41 | FLK | | 42 | FLK | | 44 | FLK | | 45 | FLK | | 46 | FLK | | 47 | FLK | | 48 | FLK | | 49 | FLK | | 50 | FLK | | 51 | FLK | | 52 | FLK | | 53 | FLK | | 54 | FLK | | 55 | FLK | | 56 | FLK | | 57 | FLK | | 58 | FLK | | 59 | FLK | | 60 | FLK | +-+--+ 20 rows in set (0.00 sec) mysql select id,cat from table where cat=(select cat from table where id=51); +-+--+ | id | cat | +-+--+ | 40 | FLK | | 41 | FLK | | 42 | FLK | | 44 | FLK | | 45 | FLK | | 46 | FLK | | 47 | FLK | | 48 | FLK | | 49 | FLK | | 50 | FLK | | 51 | FLK | | 52 | FLK | | 53 | FLK | | 54 | FLK | | 55 | FLK | | 56 | FLK | | 57 | FLK | | 58 | FLK | | 59 | FLK | | 60 | FLK | +-+--+ 20 rows in set (0.02 sec) now I can select the whole cat when I enter an ID that is fine! but the query should stop at id=$id or in other words in the end it should POINT to id=$id in the above example the last record would be the record with id=51 do I need another SELECT here? Niel Archer [EMAIL PROTECTED] wrote: Date: Thu, 05 Jul 2007 22:17:15 +0100 From: Niel Archer [EMAIL PROTECTED] To: php-db@lists.php.net Subject: Re: [PHP-DB] Re: record pointer Hi O.K. the id column is primary key and it is auto_incerment .I think my explanation was not clear enough : this is my query : SELECT * FROM table WHERE ID=$ID this will find the record with the specified ID and I will be able to see it, now I want to be able to scroll up and down to all the records that belong to the same cat(egory)! Assuming that is correct now, use a sub-query: SELECT id, name FROM table WHERE cat = (SELECT CAT FROM table WHERE id=$ID); Niel -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - Moody friends. Drama queens. Your life? Nope! - their life, your story. Play Sims Stories at Yahoo! Games.
[PHP-DB] MySQL Error 1366
Hi All, I want to load data from dump file to MySQL table using LOAD DATA INFILE but there is Error 1366 : mysql LOAD DATA - INFILE 'D:/SITE/SOMETABLE.SQL' - INTO TABLE SOMETABLE - FIELDS TERMINATED BY ',' - OPTIONALLY ENCLOSED BY '' - LINES TERMINATED BY ')'; ERROR 1366 (HY000): Incorrect integer value: '--MySQL dump 10.10 -- --S' for column 'ID' at row 1 this is the header of my dump file: DROP TABLE IF EXISTS `sometable`; CREATE TABLE `sometableo` ( `ID` smallint(6) NOT NULL auto_increment, `Name` varchar(30) NOT NULL, `title` tinytext, `description` tinytext, `cat` tinytext, PRIMARY KEY (`ID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; LOCK TABLES `sometable` WRITE; /*!4 ALTER TABLE `sometable` DISABLE KEYS */; INSERT INTO `sometable` VALUES (79,'110_1099','AAA','AA','AAA'),(80,'110_1100','AAA','DFGDFGF','AAA'), any idea for solving the problem? - Sick sense of humor? Visit Yahoo! TV's Comedy with an Edge to see what's on, when.
[PHP-DB] Data Upload
Hi all, I am in the process of designing a web site with PHP_MySQL . Every week some data would be added to the database . The procedure of updating the database and uploading data is not clear for me 1 Can I update MySQL table offline and then copy it to the server via fpt? 2 What kind of server is recommended Windows or Linux? I appreciate all your opinions Fussy? Opinionated? Impossible to please? Perfect. Join Yahoo!'s user panel and lay it on us.http://us.rd.yahoo.com/evt=48516/*http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 hot CTA = Join Yahoo!'s user panel
[PHP-DB] 20K photos
Hi all, Imagine that you want to put some 2 historical photos On display in your website , you use PHP and MySQL. Preparing a photo album with 200 photos is no problem but for 2 photos! would you do it in the same way? Please comment. - Ahhh...imagining that irresistible new car smell? Check outnew cars at Yahoo! Autos.
[PHP-DB] IE6 PHP
Hi all, I have a bunch of thumbnail images that link to larger versions of the images and want to line them up in rows across the screen , using CSS I put them into a separate DIV. To get them to line up horizontally across the window I use CSS to FLOAT each DIV to the left, CSS looks like this: div.float { float: left; } and the HTML : div class=floatimg srcimage.jpg.../br //div Firefox and Netscape show the thumbnails in rows like this: [] [] [] [] [] [] [] [] [] [] [] [] but in IE6 there is a problem , the first row is O.K. but the second ant the third rows are not O.K. it looks like this: [] [] [] [] [] [] [] [] [] [] [] [] please comment - No need to miss a message. Get email on-the-go with Yahoo! Mail for Mobile. Get started.
[PHP-DB] widthheight already solved!
thank you all this code solved it: ?php echo img src='/album/img/{$photoFileName[2]}' width='60' height='70' border='0' / ;? - Expecting? Get great news right away with email Auto-Check. Try the Yahoo! Mail Beta.
[PHP-DB] table
I think I should be something like this: table width=50% border=0 cellspacing=7 cellpadding=0 tr td?php echo img src='/album/img/.$photoFileName[2].'/ ; ?/td td?php echo img src='/album/img/.$photoFileName[3].'/ ; ?/td /tr tr tdnbsp;/td td?php echo img src='/album/img/.$photoFileName[0].'/ ; ?/td /tr /table - Looking for earth-friendly autos? Browse Top Cars by Green Rating at Yahoo! Autos' Green Center.
[PHP-DB] tables
I think it should be something like this: table width=50% border=0 cellspacing=3 cellpadding=0 tr td?php echo img src='/album/img/.$photoFileName[2].'/ ; ?/td td?php echo img src='/album/img/.$photoFileName[3].'/ ; ?/td /tr tr tdnbsp;/td td?php echo img src='/album/img/.$photoFileName[0].'/ ; ?/td /tr /table - TV dinner still cooling? Check out Tonight's Picks on Yahoo! TV.
[PHP-DB] tables
Olavi Ivask wrote: how many pictures do you have in database? dont u want to use for/while ? this is my index.php and I don't want to use for/while because I'll have only 6 photos to show in it, which will be chosen randomly from the Database! - Finding fabulous fares is fun. Let Yahoo! FareChase search your favorite travel sites to find flight and hotel bargains.
[PHP-DB] width height
it might be a stupid question but I think it would be the last one! I am trying to define the height and width of picture in the following line: img src='/album/img/.$photoFileName[2]. / ; ?/td when I put it like this: table width=50% border=0 cellspacing=3 cellpadding=0 tr td width=90 height=70?php echo img src='/album/img/.$photoFileName[2]. width=90 height=70 border='0' / ; ?/td /tr tr td width=90 height=70nbsp;/td td width=90 height=70nbsp;/td /tr /table pnbsp;/p p I have this error: PHP Parse error: syntax error, unexpected T_LNUMBER, expecting ',' or ';' in C:\Inetpub\wwwroot\album\2dimArray2.php on line 44 please comment! - Bored stiff? Loosen up... Download and play hundreds of games for free on Yahoo! Games.
[PHP-DB] widthheight
thank you bastien, those wrappers are confusing for me, could you tell me where can I find more info. about them and based on your suggestion re-write this line for me? td width=90 height=70?php echo img src='/album/img/.$photoFileName[2]. width=90 height=70 border='0' / ?/td bastien wrote: you need to escape double quotes in an echo if you use double quotes as the wrapper. - Need Mail bonding? Go to the Yahoo! Mail QA for great tips from Yahoo! Answers users.
[PHP-DB] widthheight(solved)
thank you all this code solved it: ?php echo img src='/album/img/{$photoFileName[2]}' width='60' height='70' border='0' / ;? - Food fight? Enjoy some healthy debate in the Yahoo! Answers Food Drink QA.
[PHP-DB] echo
thanks to Chris and Dimiter, I think I am close but still the problem is not solved, when I add echo img src='/album/img/.$row[photoFileName].' / to the code as it was sugested by Dimiter there is parse Error : PHP Parse error: syntax error, unexpected $end in C:\Inetpub\wwwroot\album\show.php on line 44 line 44 is end of the code just after /html what does it mean? I am storing just the name of photos in the database and the photos are in /img folder ,and there is no permissions issue. My testing server is IIS And the path would be something like this : Inetpub\wwwroot\album\img as I am running out of time! could someone complete this code just with one echo and img src so that I can retrive my photos ? MySQL columns : photoID=seq number photoFileName=name of my photo like 3sw.jpg title=title description=short description - body ?php $link = mysql_connect('localhost', 'root', 'pw'); if (!$link) { die('Not connected : ' . mysql_error()); } echo 'connected!'; $db_selected = mysql_select_db('album', $link); if (!$db_selected) { die ('Can\'t use foo : ' . mysql_error()); } $query = SELECT * FROM photo; $result=mysql_query($query); while ($row = mysql_fetch_array($result)) { echo img src='/album/img/.$row[photoFileName].' / } mysql_free_result($result); ? /body /html - Looking for earth-friendly autos? Browse Top Cars by Green Rating at Yahoo! Autos' Green Center.
[PHP-DB] echo
thank you all, it did it! [EMAIL PROTECTED] You need a trailing you have echo img src='/album/img/.$row[photoFileName].' / it needs to be echo img src='/album/img/.$row[photoFileName].' /; - Bored stiff? Loosen up... Download and play hundreds of games for free on Yahoo! Games.
[PHP-DB] array
Hi all, I want to put result of query in a two dimensional array like this: title[0]=x description [0]=y title[1]=z description [1]=w . any idea would be appreciated $query = SELECT * FROM photo; $result=mysql_query($query); while ($row = mysql_fetch_array($result)) { $title=$row['title']; $description=$row['description']; } - Don't pick lemons. See all the new 2007 cars at Yahoo! Autos.
[PHP-DB] tables
Hi list, How can you show some pictures in separate tables in one page with echo? - Don't pick lemons. See all the new 2007 cars at Yahoo! Autos.
[PHP-DB] echo
Hi all, I am new to web programming. I have code to add pictures to a MYSQL database. Now I can't seem to figure out how to get them back out ! so we can see them. The MySQL doesn't seem to be a problem (yet), also I'm trying to learn PHP. What I usually do is to load the images in a folder img and then the name of the pic (i.e. myphoto.jpg) in the database, so i retrieve the name of the pic with: Code: ?php $connex = MySQL_connect(server,login,password); $sql_query = select picname from photos where...; $result = MySQL_query($sql_query,$connex); $row = MySQL_fetch_array($result); ? and then: Code: echo img src=.$row['photoFileName']. alt='photo'; but I can't see the photo Any pointers or code samples will be greatly appreciated... - Bored stiff? Loosen up... Download and play hundreds of games for free on Yahoo! Games.
[PHP-DB] echo
I am storing just the name of photos in the database and the photos are in /img folder , and there is no permissions issue. My testing server is IIS And the path would be something like this : Inetpub\wwwroot\album\img as I am running out of time! could someone complete this code just with one echo and img src so that I can retrive my photos ? MySQL columns : photoID=seq number photoFileName=name of my photo like 3sw.jpg title=title description=short description ?php $link = mysql_connect('localhost', 'root', 'pw'); if (!$link) { die('Not connected : ' . mysql_error()); } $db_selected = mysql_select_db('album', $link); $query = SELECT * FROM photo; $result=mysql_query($query); while ($row = mysql_fetch_array($result)) { echo??? } mysql_free_result($result); ? - Expecting? Get great news right away with email Auto-Check. Try the Yahoo! Mail Beta.