[PHP-DB] build drop-down pick from MYSQL table
Im very new to PHP (coming from shell programming) and have a very easy question :-) I have found examples of building a dropdown list, and have found examples of reading a mysql table, but am looking for examples of creating a drop-down list with the results of a mysql query. Ie, I have an admin screen where partners are added, and want to store the partners in a mysql table (maintained by an admin page). In my add account page I want to build a dropdown list using the output from the partners mysql table. Thanks in advance for the help, and if you reply, please tell me where your favorite php-mysql tutorial is. Quentin
[PHP-DB] substring_index Part 2
Thanks for the help on the earlier ?. Now that I have the select statement working I can't get any results displayed. $result = mysql_query("SELECT substring_index(body, \".\" ,2) FROM news",$db) or die ("Invalid Query"); if ($myrow = mysql_fetch_array($result)) { do { printf("%s\nbr", $myrow["headline"]); printf("%s\n", $myrow["body"]); } while ($myrow = mysql_fetch_array($result)); I've tried different mysql functions like mysql_result and mysql_fetch_row, All I get is a blank page in the browser or a wrong parameter count for mysql_result(). I know there are records to display i've done the query using the mysql client. Thanks again for the help, Mike
Re: [PHP-DB] build drop-down pick from MYSQL table
on 4/12/01 8:40 AM, Quentin Krengel ([EMAIL PROTECTED]) wrote: I have found examples of building a dropdown list, and have found examples of reading a mysql table, but am looking for examples of creating a drop-down list with the results of a mysql query. Ie, I have an admin screen where partners are added, and want to store the partners in a mysql table (maintained by an admin page). In my "add account page" I want to build a dropdown list using the output from the "partners" mysql table. You might want to try a little script I wrote called s2s. You can view/download it here: http://webdevel.burney.ws/code/id?14 It may work for you "out of the box" but if not, it shouldn't be hard to modify for your use. Thanks in advance for the help, and if you reply, please tell me where your favorite php-mysql tutorial is. I like devshed.com tutorials. The format they use is very nice and easy to follow. Hope it helps, Paul Burney ++ Paul Burney Webmaster and Open Source Developer Educational Technology Unit Graduate School of Education and Information Studies University of California, Los Angeles (310) 825-8365 [EMAIL PROTECTED] http://www.gseis.ucla.edu/ ++ -- PHP Database 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-DB] substring_index Part 2
on 4/12/01 9:53 AM, Mike Baerwolf ([EMAIL PROTECTED]) wrote: $result = mysql_query("SELECT substring_index(body, \".\" ,2) FROM news",$db) or die ("Invalid Query"); if ($myrow = mysql_fetch_array($result)) { do { printf("%s\nbr", $myrow["headline"]); printf("%s\n", $myrow["body"]); } while ($myrow = mysql_fetch_array($result)); Maybe it's because the if statement doesn't have an ending }. Of course, it could have been snipped for brevity. I assume that somewhere in the code you have the connection made and the database selected. Can you try this? ?php if (mysql_num_rows($result) 0) { while ($myrow = mysql_fetch_array($result)) printf("%s\nbr", $myrow['headline']); printf("%s\n", $myrow['body']); } } else { echo 'No results found!'; } ? The above is untested but I think it will work. :) Hope that helps, Paul Burney ++ Paul Burney Webmaster and Open Source Developer Educational Technology Unit Graduate School of Education and Information Studies University of California, Los Angeles (310) 825-8365 [EMAIL PROTECTED] http://www.gseis.ucla.edu/ ++ -- PHP Database 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-DB] Fatal error: Call to unsupported or undefined function mysql_connect()
I'm trying to connect to mySQL DB by Web page and when I use mysql_connect() this append: Fatal error: Call to unsupported or undefined function mysql_connect() thanks! Franky [EMAIL PROTECTED] -- PHP Database 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-DB] Fatal error: Call to unsupported or undefined function mysql_connect()
Such patience! You waited nearly 7 whole minutes before reposting your message! I don't run MySQL, so I'm not sure... but it looks like you probably don't have MySQL support in your version of PHP. Try: ?php phpinfo(); ? ...and see if it says you do. At 12:44 PM 4/13/01 -0400, franky wrote: I'm trying to connect to mySQL DB by Web page and when I use mysql_connect() this append: Fatal error: Call to unsupported or undefined function mysql_connect() thanks! Franky [EMAIL PROTECTED] -- PHP Database 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] - Brian S. Dunworth Sr. Software Development Engineer Oracle Database Administrator The Printing House, Ltd. (850) 875-1500 x225 [EMAIL PROTECTED] - -- PHP Database 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-DB] Fatal error: Call to unsupported or undefined function mysql_connect()
Such patience! You waited nearly 7 whole minutes before reposting your message! I don't run MySQL, so I'm not sure... but it looks like you probably don't have MySQL support in your version of PHP. Try: ?php phpinfo(); ? Also, include some more code.. Or even better, check out some of the fine tutorials at www.devshed.com www.phpbuilder.com www.phpnewbie.com If you're still not successful in connecting we'll be glad to check your code. Bye, B. -- PHP Database 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-DB] add php to apache
Can I add to the actual serveur apache? With somthing like this: ./configure --with-php=../php or more complicate... Franky [EMAIL PROTECTED] -- PHP Database 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-DB] add php to apache
./configure --with-php=../php or more complicate... More complicated. You really should check www.devshed.com you can find more on how to install MySQL, PHP and Apache. Bye, B. -- PHP Database 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-DB] sessions and page has expired warning
Here, I think you may be over - using session variables a bit...have not used them in php, as I have version 3, which doesn't support them. However, by day I am an ASP developer, and article after article I read warns about session variables! They are great, but can hog memory, especially if you have many users concurrently, so I would use them sparingly, just when you have to. The "back" button problem - here is where a session variable might be usefull, if you want to force a particular order of website traversal and not allow them to go back - when leaving, say page 1 - set a session variable $visitedPageOne = true On the top of that page, first thing - check for the value of $visitedPageOne, if true, redirect to the next page, ect. Phil J. olinux wrote: I am using sessions to store variables until all forms have been filled out. at this point they are put into the db. I would like to know how i can eliminate the problem that occurs when the user presses the back button. I receive a "warning, page has expired... press refresh" I know that pressing refresh works fine, but some people do not understand and get confused. How can i fix this? thanks much olinux -- PHP Database 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-DB] oracle 8i client/ PHP 4.0.4pl1 breaks
Here's the scoop: Goal: to connect apache 1.3.19/PHP to remote Oracle server. Background: I downloaded Oracle 8.1.7 and installed the default Client configuration. Machine is an SMP Mandrake 7.0 Linux 2.2.14. PHP is 4.0.4pl1. Synopsis: I configure and make php even with the cleanest configuration-- ./configure --with-apxs --without-xml --with-oracle=/var/oracle --with-oci8=/var/oracle --without-mysql It finds everything, make runs fine, install runs fine. I try to load apache, it immediately dies without a trace in the logs. Seems to be the libphp4.so the's the cause. Should I suspect bad Oracle link libraries? Dave Thomas Chief Software Architect BCD Enterprises, Inc. -- PHP Database 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-DB] Uploading file into database
Hi, ok, first of all make sure your form tag is like : form method="POST" name="ImageForm" action="UploadImage.php3" ENCTYPE="multipart/form-data" The ENCTYPE is important! Next, make sure you have a field like: input type="file" size="50" name="txtImage" type="file" is important! This will present a browse button for the user to browse their drives something like this seems to work - drop the addslashes if it is not a binary file, such as an image $filecontents = addslashes(fread(fopen($txtImage, "r"), filesize($txtImage))); $thisfiletype = $txtImage_type; $db = mysql_select_db("somedb", $someconnection) or die ("db"); $sql = "INSERT INTO Images (..all the fields...) VALUES ('$filecontents',...and all the rest of the fields')"; $sql_result = mysql_query($sql,$someconnection) or die ("could not insert into DB"); mysql_close($someconnection); -- Hope this helps.. Phil J. Zeus wrote: I'm trying to do a filexchange script. Does anyone know how to upload a file into the database such that when I do a 'select *' query, I can click on a link the download that file. -- PHP Database 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]