Re: [PHP-DB] New to PHP/MySQL - Need help with images

2008-01-06 Thread Chris

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:


?php

$query = select image1, image2, image3 from specials;
$result = mysql_query($query);

echo 'table';

while ($row = mysql_fetch_assoc($result)) {
echo 'tr';
echo 'td' . $row['image1'] . '/td';
echo 'td' . $row['image2'] . '/td';
echo 'td' . $row['image3'] . '/td';
echo '/tr';
}
echo '/table';
?


--
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

2008-01-05 Thread Matt Anderton
how about like this:

echo table\ntr;
$result = @mysql_query(SELECT image FROM specials);
while($row = mysql_fetch_row($result)) {
   echo tdimg src= . $row[0] .  //td\n;
}
echo /tr\n/table\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);
 ?
 table
 tr
 td
 img src=? echo $image; ?
 /td
 td
 img src=? echo $image; ?
 /td
 td
 img src=? echo $image; ?
 /td
 /tr
 ?
 $i++;
 }
 echo /table;
 ?

 --
 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

2004-04-17 Thread Tom Cloyes
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

2004-04-15 Thread Galbreath, Mark A
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

2004-04-15 Thread Mikael Grön
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

2004-04-15 Thread Tom Cloyes
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

2004-04-15 Thread Galbreath, Mark A
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

2004-04-15 Thread Tom Cloyes
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 mySQL

2002-08-25 Thread Mark Middleton


 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)

?php

$startsql =SELECT
count(*) as how_many_booked
FROM
bookings
WHERE
((booking_start  '$start_date'
AND
booking_end  '$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 user php/mysql problem

2002-05-06 Thread Ryan Jameson (USA)

It may be an issue with the connect from host for that user. That's the only thing I 
can come up with. Is your web server the same machine as your MySQL server?

 Ryan

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 06, 2002 9:47 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] new user php/mysql problem


When I create a new user with grant I am able to 
access mysql with the new user through the 
command line and by applications like mysqlfront,
however I am not able to connect with php.  Does
anybody have an idea of how to correct this?
Thanks 
Ted Kappes

-- 
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

2002-04-04 Thread Julie Meloni

JT $Location_Info = mysql_fetch_row($result);

JT echo p$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 Need Help

2002-04-04 Thread Rick Emery

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 p$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 and MySQL

2001-07-09 Thread leo g. divinagracia iii

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]