RE: [PHP] Getting uploaded filename & directory
> In setting up a form to allow a user to upload a file, > upon submission of that form, you can get the actual > file name that is being uploaded by accessing the > variable: > > $userfile_name > > (assuming the form element's name where the user > specifies the file is "$userfile"). > > Is there a way to get the full path as well? ie: > > "c:\program files\this directory\uploaded_file.txt" > > ? I tried echoing out $userfile to no avail. I also tried > some javascript that when the form was submitted, > the value for the userfile element was copied to a hidden > form element, but that didn't work either. > > Any ideas? Suggestions? It's not very secure, I think it isn't possible to get a full path Lubo Gabal -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] problem with getting data from NNTP server
I have script for getting header of article from NNTP server using sockets: "; } ?> output have look so: ... Path: csnews.vslib.cz!not-for-mail From: "Antonin Mohaupt" <[EMAIL PROTECTED]> Newsgroups: cz.comp.lang.php ... but it is only ... Path: csnews.vslib.cz!not-for-mail From: "Antonin Mohaupt" Newsgroups: cz.comp.lang.php ... What's the problem ? I tried higher raise length of data (second argument of fgets()), but with no result. When I am doing it by telnet, all is ok. What to do ? Luboslav Gabal -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] dynamic menu possible?
> What I want to do is have a drop-down menu where the options are files This is matter of HTML or JavaScript > located in a folder on the server that changes as items are added to or > removed. Then the user can select an item from the menu, submit, and that > page will load. This is script for writing all files located in a folder: $folder = "c:/borland/"; $dir = opendir($folder); while ($file = readdir($dir)) { echo $file.""; } > Did that make sense? > So I have 1.htm and 2.htm and 3.htm in a folder. A selectable menu reads the > folder and lists those three files as options. The user can click on it and > submit and that page will load. And if I add 4.htm, the menu will add that > to the drop down on its own. > > That that's not possible, how close can I get to something like that? > An example of something close to that I found on www.megatokyo.com . They > have a dropdown menu where a user selects an item and gets sent to that > page. A URL from one attempts shows as > http://www.megatokyo.com/index.php?date=2001-09-04 . How is that done? > > Again, if I could just be pointed to the related PHP concepts I'll take it > from there. Try to start here: http://www.php.net/manual/en/ref.dir.php http://www.php.net/manual/en/ref.filesystem.php Lubo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Comining variables into a single string
> Greetings to All: > > I'm inexperienced, although enthusiastic about using PHP. I want to write > data more effectively to a file. > > This doesn't work: fputs($frank, "Testing " $whatever " more testing > \n\n\n"); > Right now, all I know is using three separate fputs statements. I'd like to > use just one. fputs($frank, "Testing ".$whatever." more testing\n\n\n"); see http://www.php.net/manual/en/language.operators.string.php Luboslav Gabal -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Help with database queries
> Hi, > > need some help with the code below. I am thinking of reusing this for > building a thumbnail gallery from a database. > > First, is the code actually good? Do i do something that will slow down the > responses? > > Second, can anyone help me with a code sample to implement that will limit > how many records the query is displaying? (break the database response into > pages) > > Third, any good ideas on how to do this the easiest way is appreciated :) > > Thanks! > - Daniel > > > $db = mysql_connect("localhost", "xxx", "xxx"); > > mysql_select_db("xxx",$db); > > $result = mysql_query("SELECT * FROM film WHERE artnr LIKE '$avd'",$db); > > if ($myrow = mysql_fetch_array($result)) { > > echo "\n"; > echo "Art.nr\n"; > echo "Titel\n"; > echo "\n"; > > do { > > printf("%s > %s > %smin > \n", $myrow["artnr"], $myrow["titel"], $myrow["dur"]); use fullstops instead of commas: printf($myrow["artnr"].$myrow["titel"].$myrow["dur"]); > > } while ($myrow = mysql_fetch_array($result)); > echo "\n"; > > } else { > echo "No records available..."; > } If you want to limit record outputed at the page, try change mysql query: SELECT * FROM film WHERE artnr LIKE '$avd' LIMIT 0, 10 where first number is row with record and second is number of getting records, or you can to use function mysql_data_seek(), which move pointer to database on selected row: mysql_data_seek($result, 10); this move your internal result pointer to 10. line. Now, when you can output ten next lines, you can do it so: for ($i = 0; $i < 10; $i++) { $row = mysql_fetch_array($result); echo $row["titel"]; // this outputs you "titel" from 11. row of table } // then will be next 9 rows outputed Luboslav Gabal -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Counting
> I'm using php/mysql. I want to be able to count the number of records that > match something. > I've used mysql_num_rows() and it does work, but is there a better way? > Something like COUNT(*)? I've tried to use it, but all I get is Resource ID > #1 or something similar. Any ideas for the best way to do this? > > Max $result = mysql_db_query($database, "SELECT COUNT(*) AS count FROM table;"); $count = mysql_fetch_array($result); echo $count["count"]; Luboslav Gabal -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] NEED HELP: select box repeat
> OK I am trying to write a script that will bring data out of a database into > a select box. But what I need it to do is repeat 5 times or more depending > on what it brings out. I can only get it to display one select box. Here is > what I got so far: > > require 'common.inc'; > // Connect to the Database > if (!($link = mysql_pconnect($DB_SERVER, $DB_LOGIN, $DB_PASSWORD))){ > DisplayErrMsg(sprintf("internal error %d:%s\n", > mysql_errno(), mysql_error())); > exit() ; > } > ?> > > > Flavors Select > > > > // Send the Query to the Server, to get the list of flavors > if (!($result = mysql_db_query($DB,"SELECT * FROM extras WHERE name='$flav' > ORDER BY 'choice'"))) > { > DisplayErrMsg(sprintf("internal error %d:%s\n", > mysql_errno(), mysql_error())); > return 0 ; > } > ?> > > > > > { > ?> > "> > } // End of while loop > ?> > > > > > > } > ?> Try to check if query doesn't return only one row, for example: echo mysql_num_rows($result); Luboslav Gabal -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Help with database queries
- Pôvodná správa - Od: "Luboslav Gabal ml." <[EMAIL PROTECTED]> Komu: "Daniel Alsén" <[EMAIL PROTECTED]>; "PHP" <[EMAIL PROTECTED]> Odoslané: 17. zárí 2001 23:39 Predmet: RE: [PHP] Help with database queries > > Hi, > > > > need some help with the code below. I am thinking of reusing this for > > building a thumbnail gallery from a database. > > > > First, is the code actually good? Do i do something that will slow down > the > > responses? > > > > Second, can anyone help me with a code sample to implement that will limit > > how many records the query is displaying? (break the database response > into > > pages) > > > > Third, any good ideas on how to do this the easiest way is appreciated :) > > > > Thanks! > > - Daniel > > > > > > $db = mysql_connect("localhost", "xxx", "xxx"); > > > > mysql_select_db("xxx",$db); > > > > $result = mysql_query("SELECT * FROM film WHERE artnr LIKE '$avd'",$db); > > > > if ($myrow = mysql_fetch_array($result)) { > > > > echo "\n"; > > echo "Art.nr\n"; > > echo "Titel\n"; > > echo "\n"; > > > > do { > > > > printf("%s > > %s > > %smin > > \n", $myrow["artnr"], $myrow["titel"], $myrow["dur"]); > > use fullstops instead of commas: > > printf($myrow["artnr"].$myrow["titel"].$myrow["dur"]); > I take it back :-). My mistake ... But the rest is right (I believe :-)) > > > > } while ($myrow = mysql_fetch_array($result)); > > echo "\n"; > > > > } else { > > echo "No records available..."; > > } > > If you want to limit record outputed at the page, try change mysql query: > > SELECT * FROM film WHERE artnr LIKE '$avd' LIMIT 0, 10 > > where first number is row with record and second is number of getting > records, > or you can to use function mysql_data_seek(), which move pointer to database > on > selected row: > > mysql_data_seek($result, 10); > > this move your internal result pointer to 10. line. Now, when you can output > ten next > lines, you can do it so: > > for ($i = 0; $i < 10; $i++) { > $row = mysql_fetch_array($result); > echo $row["titel"]; // this outputs you "titel" from 11. row of table > } // then will be next 9 rows outputed > > Luboslav Gabal -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] closing persistance connection
How to close persistance connection to MySQL server ? Luboslav Gabal -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]