RE: [PHP] PHP & MySQL
| From: | Alfredeen, Johan | Date: | Tue, 02 Oct 2001 18:56:28 +0000 |
| Subject: | RE: [PHP] PHP & MySQL | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-69617@lists.php.net to get a copy of this message | ||
I'm a little confused over why you would display the same flavor more than
once for a single item. But ok. Have you thought about populating an array
with the flavors and then retrieving flavors from the array however many
times you need to in an if statement. Maybe it would be easier to comment if
we could see a sample page.
Johan
-----Original Message-----
From: Brian Lee [mailto:php_blahy69@hotmail.com]
Sent: Tuesday, October 02, 2001 12:13 PM
To: php-general@lists.php.net
Subject: [PHP] PHP & MySQL
OK,
I am working on my first shopping cart using PHP and MySQL and I am having a
few problems.
The first problems is I need to bring out of a database a group of Jam
flavors. I can do that but when certain items come up there needs to be the
same flavors but repeated mutiple times and I am not sure how to get that to
work. I also am having a problem adding mutiple flavors to my cookies for
check out later
Here is the code to bring the flavor selection up once. What I need is to
figure out a way to bring it up 3,4,5 times depending on which item is
clicked.
<?php
// 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 ;
}
// Display the Items
?>
<font face="verdana" size="2" color="#000000">
<form name="thisform" action="<?php $PHPSELF;?>"
method="post">
<select>
<option><?php echo $flav; ?>
<?php while($row = mysql_fetch_array($result))
{
?>
<option value="<?php echo $row["choice"]; ?>"><?php echo
$row["choice"]; ?>
<?php
} // End of while loop
?>
</select>
</form>
that will bring up the set of flavors once i need to be able to bring it up
more than once but keep it in the same format and set it to a cookie.
Any help would be great. The project is already overdue so I am sort of a
hurry.
-Brian
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net