multiple queries
| From: | Cameron Showalter | Date: | Tue, 02 Dec 2003 01:08:19 +0000 |
| Subject: | multiple queries | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-31826@lists.php.net to get a copy of this message | ||
I am trying to pull data out of a mysql db, and am not sure how to begin to do this as a newbie...
what I have so far, which surprisingly does work:
----------------------------
<?
$db_name = "gwsched";
$table_name = "dates";
$connection = mysql_connect("xxxxx","xxxxxx","xxxxx") or die ("could not connect");
$db = @mysql_select_db($db_name, $connection) or die ("count not connect to data
base");
$sql = "SELECT * from dates where store=$store and date=$date";
$result = @mysql_query($sql,$connection) or die("could not execute");
while ($row = mysql_fetch_array($result)) {
$store = $row['store'];
$date = $row['date'];
$flash = $row['flash'];
}
---------------------
ultimately I would like to display data for 3 days on either side of this.
$minus3 - $minus2 - $minus1 - $date - $plus1 - $plus2 - $plus3
plus the data associated with the $minusX and $plusX days, but havent been able to find that anywhere.
$flash3 - $flash2 - $flash1 - $flash - $flashp1 - $flashp2 - $flashp3
I attempted to use pre and post increment/decrement, but I can not get it pull from the db, it does what it is suppose to do and decrement/increments $flash/$date.
I guess my question is, how do I get $minusX, etc. to reflect what is in my db.
thanks,
cameron