Re: [PHP-DB] New to PHP/MySQL - Need help with images
Thomas wrote: I'm attempting to make a table with one row and 3 columns holding three different images. I want each image URL to be called from my database. Everything is set-up in my database. When I use the following code, it places the same picture across the three columns and does this three times (creating three rows.) I want a different picture to be placed across the three columns and to have only one row. What can I do? Here is the code: $result = @mysql_query('SELECT image FROM specials'); You're only querying one database field here. If you want more than one image to be loaded from the database, you need to include more fields. So you'll end up with something like this: '; while ($row = mysql_fetch_assoc($result)) { echo ''; echo '' . $row['image1'] . ''; echo '' . $row['image2'] . ''; echo '' . $row['image3'] . ''; echo ''; } echo ''; ?> -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] New to PHP/MySQL - Need help with images
how about like this: echo "\n"; $result = @mysql_query("SELECT image FROM specials"); while($row = mysql_fetch_row($result)) { echo "\n"; } echo "\n\n"; hope it helps! matt On Jan 5, 2008 4:51 PM, Thomas <[EMAIL PROTECTED]> wrote: > I'm attempting to make a table with one row and 3 columns holding three > different images. I want each image URL to be called from my database. > Everything is set-up in my database. When I use the following code, it > places the same picture across the three columns and does this three times > (creating three rows.) I want a different picture to be placed across the > three columns and to have only one row. What can I do? > > Here is the code: > > $result = @mysql_query('SELECT image FROM specials'); > $num=mysql_numrows($result); > $i = 0; > while ($i < $num) { > $image=mysql_result($result,$i,"image"); > ?> > > > > "> > > > "> > > > "> > > > $i++; > } > echo ""; > ?> > > -- > Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
Re: [PHP-DB] New To PHP
Thanks again for all of your help. Not having any programming background makes for a lot of fun with PHP. T At 01:59 PM 4/15/04 +0100, Mikael Grön wrote: What I did to learn PHP was to surf to http://www.hotscripts.com/ and look at other peoples code. Writing it yourself looking at the hotscript codes also helps you understand the logic of it. Mike On Apr 15, 2004, at 12:53, Tom Cloyes wrote: I ma trying to learn PHP and am having difficulty with understanding it. Is there a good PHP creator that will create PHP which will let me specify what all I need to have done so that I can go back and try to figure out just how it all fits together? Thanks, Tom KI8IZ http://www.wooster-isp.net Tom KI8IZ http://www.wooster-isp.net -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] New To PHP
Lisi, Thank you for your reply, and I've bookmarked both sites as well as downloaded a few scripts that look promising. I've also found another creator that may just be what I'm looking for - dbquiksite - http://www.dbqwiksite.com/. Thanks again, T At 03:20 PM 4/15/04 +0200, [EMAIL PROTECTED] wrote: Not sure about a creator but there are plenty of existing scripts on the Net you can download and browse to see how they fit together. You can install and run them, play around with the code, and see the effects of your changes. Try hotscripts.com/PHP/ or php.resourceindex.com to start with. -Lisi = = = Original message = = = I ma trying to learn PHP and am having difficulty with understanding it. Is there a good PHP creator that will create PHP which will let me specify what all I need to have done so that I can go back and try to figure out just how it all fits together? Thanks, Tom KI8IZ http://www.wooster-isp.net -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. Tom KI8IZ http://www.wooster-isp.net -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] New To PHP
Nice resource! Thanks for sharing! Mark -Original Message- From: Mikael Grön [mailto:[EMAIL PROTECTED] Sent: Thursday, April 15, 2004 9:00 AM To: Tom Cloyes; [EMAIL PROTECTED] Subject: Re: [PHP-DB] New To PHP What I did to learn PHP was to surf to http://www.hotscripts.com/ and look at other peoples code. Writing it yourself looking at the hotscript codes also helps you understand the logic of it. Mike On Apr 15, 2004, at 12:53, Tom Cloyes wrote: > I ma trying to learn PHP and am having difficulty with understanding > it. Is there a good PHP creator that will create PHP which will let me > specify what all I need to have done so that I can go back and try to > figure out just how it all fits together? > Thanks, > > Tom > KI8IZ > http://www.wooster-isp.net -- 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] New To PHP
Mark, Thanks for responding. I have read the books: PHP4 A Beginners Guide by McCarty from Osborne Mastering PHP 4.1 by Allen and Hornberger from Sybex and have poked around in PHP Cookbook by Sklar and Trachtenberg from O'Reilly Also have read books on MySQL, and am left scratching my head. Have found a couple of programs that look promising, and the first one I've tried - phpmaker - http://www.hkvstore.com/ - is a cookie-cutter type that really makes a lot of code. Will have to work with it to see if I can get it to do what I need it to do. Was wondering if any of you had experience with one of these or do you hand code everything. My client wants to go live in a month and the only thing left is the one database and the interaction with it, that and the integration with Xoops. I will look into the book you recommended and continue to poke around. Any pointers will be gladly accepted. Thanks, T At 08:11 AM 4/15/04 -0400, Galbreath, Mark A wrote: I found Lerdorf and Tatroe's "Programming PHP" (O'Reilly 2002) extremely helpful in understanding the "why" of PHP. Mark -Original Message- From: Tom Cloyes [mailto:[EMAIL PROTECTED] Sent: Thursday, April 15, 2004 7:54 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] New To PHP I ma trying to learn PHP and am having difficulty with understanding it. Is there a good PHP creator that will create PHP which will let me specify what all I need to have done so that I can go back and try to figure out just how it all fits together? Thanks, Tom KI8IZ http://www.wooster-isp.net -- 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 Tom KI8IZ http://www.wooster-isp.net -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] New To PHP
What I did to learn PHP was to surf to http://www.hotscripts.com/ and look at other peoples code. Writing it yourself looking at the hotscript codes also helps you understand the logic of it. Mike On Apr 15, 2004, at 12:53, Tom Cloyes wrote: I ma trying to learn PHP and am having difficulty with understanding it. Is there a good PHP creator that will create PHP which will let me specify what all I need to have done so that I can go back and try to figure out just how it all fits together? Thanks, Tom KI8IZ http://www.wooster-isp.net -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] New To PHP
I found Lerdorf and Tatroe's "Programming PHP" (O'Reilly 2002) extremely helpful in understanding the "why" of PHP. Mark -Original Message- From: Tom Cloyes [mailto:[EMAIL PROTECTED] Sent: Thursday, April 15, 2004 7:54 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] New To PHP I ma trying to learn PHP and am having difficulty with understanding it. Is there a good PHP creator that will create PHP which will let me specify what all I need to have done so that I can go back and try to figure out just how it all fits together? Thanks, Tom KI8IZ http://www.wooster-isp.net -- 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] New to PHP & mySQL
> The one thing I cannot get into my head is how can you tell the database > that all the days between the "start" and "end" dates are booked. > Also when > people search for a caravan on a specific date and say they want it for 7 > day the database/PHP checks to see if the entire period is > totally free for > them and does not colide with another booking. Ray, it looks like you've done some great work so far. This one point that you are struggling with may not be as difficult as you are imagining as well. When a potential customer is searching for availability, they are going to have to select a start date and an end date for the period they are looking to book. Then, you just take those two dates, and compare them against the previous bookings for the same villa... (if you do it in one step, you can tell them "those dates are not available" - if you perform it in two steps, you can give the customer more information about whether the start date, or the end date (or both) were the source of the conflict. ) i.e. if they want to book the Healy on 4/10 - 4/20, it could tell them that it is not available until 4-15... instead of telling them that the dates "just won't work" - does that make sense? So, using your example, the Healy is booked from 4/1 - 4/15... When a customer runs a query to find availability, they will select a start_date of 4/10 and an end date of 4/20 (hehe, I just said 420...) [one step method] (of course convert the requested $start_date and $end_date into -MM-DD format) '$start_date') OR (booking_start < '$end_date' AND booking_end > '$end_date')) AND villa_id = '$requested_villa_id'"; $query = mysql_query($sql); $is_it_booked = mysql_fetch_object($query); print "number of reservations during this date = ".$is_it_booked->how_many_booked; ?> This checks if the start date is between the booked dates OR the end date is between the booked dates If rows are returned, then the dates are not available. Does this help? -Mark -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] New to PHP Need Help
Jason, If you don't have one, I would also recommend a good book that combines PHP and MYSQL interaction. I would strongly suggest the one I cut my PHP teeth on: PHP Essentials by Julie Meloni -Original Message- From: Julie Meloni [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 04, 2002 10:18 AM To: Jason Tobias Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] New to PHP Need Help JT> $Location_Info = mysql_fetch_row($result); JT> echo "$Location_Info"; After you fetch the row, you have to extract the elements from the array that makes up the row. For more than one row in your result, you have to call mysql_fetch_row() again. >From http://www.php.net/manual/en/function.mysql-fetch-row.php : mysql_fetch_row -- Get a result row as an enumerated array Examples of using this function follow on the manual page. I would venture to guess that what you really want to use would be mysql_fetch_array(), which also produces an array of results, but _all_ of the rows, not just the first one (and thus does not require additional calls to the function). >From http://www.php.net/manual/en/function.mysql-fetch-array.php : mysql_fetch_array -- Fetch a result row as an associative array, a numeric array, or both. With examples also on the manual page. - Julie --> Julie Meloni --> [EMAIL PROTECTED] --> www.thickbook.com Find "Sams Teach Yourself MySQL in 24 Hours" at http://www.amazon.com/exec/obidos/ASIN/0672323494/thickbookcom-20 -- 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] New to PHP Need Help
JT> $Location_Info = mysql_fetch_row($result); JT> echo "$Location_Info"; After you fetch the row, you have to extract the elements from the array that makes up the row. For more than one row in your result, you have to call mysql_fetch_row() again. >From http://www.php.net/manual/en/function.mysql-fetch-row.php : mysql_fetch_row -- Get a result row as an enumerated array Examples of using this function follow on the manual page. I would venture to guess that what you really want to use would be mysql_fetch_array(), which also produces an array of results, but _all_ of the rows, not just the first one (and thus does not require additional calls to the function). >From http://www.php.net/manual/en/function.mysql-fetch-array.php : mysql_fetch_array -- Fetch a result row as an associative array, a numeric array, or both. With examples also on the manual page. - Julie --> Julie Meloni --> [EMAIL PROTECTED] --> www.thickbook.com Find "Sams Teach Yourself MySQL in 24 Hours" at http://www.amazon.com/exec/obidos/ASIN/0672323494/thickbookcom-20 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] New to PHP and MySQL!!!
i'd advise not using something like ultradev until you can write some nice little scripts in notepad! it's always easier to debug if you start learning the code properly, then move onto something like ultradev just to speed it up a bit when you're competent. firstly, the actual extraction of code from a database is easy - just look up how to connect, create a simple sql statement, and get some results using it. the first thing to do is to get your MySQL database set up though. are you telnetting in to the server to seet it up, or running a server on you local machine? let us know how it's all set up first! -Original Message- From: Oli Wilkinson [mailto:[EMAIL PROTECTED]] Sent: 22 November 2001 15:02 To: [EMAIL PROTECTED] Subject: [PHP-DB] New to PHP and MySQL!!! Hello all, I'm new to this database stuff - I'm looking to create a simple database in MySQL for a news page. Just want the date of the input and the text for each entry! Not too hard! But I'm a complete novice!!! I am using Dreamweaver UltraDev (and the PHP extension). Many Thanks Oli Wilkinson -- 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] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.295 / Virus Database: 159 - Release Date: 01/11/01 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.295 / Virus Database: 159 - Release Date: 01/11/01 -- 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] New to PHP and MySQL
assuming you have a DB setup with a table for the guestbook, just do a standard query. now the steps can be long and wordy. but essentially, you open a connection to the DB server. you make a link to the DB. you then pass an SQL query via PHP to Mysql. then it stores the result into an array that you can then process. best thing to do is get a book that has PHP and Mysql into it. Beginning PHP from WROX.com had me started really well. then i got a PHP and Mysql book that just answered all my questions. [EMAIL PROTECTED] wrote: > > Hi there, > > I'm new to PHP and MySQL - coming from ACCESS and ASP. Can someone please let me >know - in simple terms :-) how to search a DB? I have written a guestbook which >works fine, but I would like my users to be able to search it for a word or phrase >and i'm not totally sure how to go about it. > > Thanks for any and all help anyone :-) -- Leo G. Divinagracia III [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]