swatisonee
08-27-2005, 07:54 AM
I would be grateful if someone could tell me whether Select is appropriate to choose data within a field and separated by commas . I have made the foll. script. What I want to achieve, is below the script. Any and all advise would be welcome. Thank You.
<?php
mysql_connect("localhost", $dbname, $dbpasswd )
or die ("Unable to connect to server.");
mysql_select_db($database)
or die ("Unable to select database.");
$result2 = mysql_query("SELECT * FROM `Makers` WHERE `Makerid`='$b' ");
$myrow3= mysql_fetch_array($result2);
$Name=$myrow3["Name"];
$result = mysql_query("SELECT * FROM `Market` WHERE `Equipment` = '$Name' ");
if ($myrow = mysql_fetch_array($result)) {
do {
printf(
$myrow["ID"],
$myrow["Kiddo"],
calculatedate($myrow["Date"]),
$myrow["Equipment"]);
} while ($myrow = mysql_fetch_array($result));
} else {
echo "Sorry, no records were found!";
}
?>
My table currently has the foll. info.
Kiddo Equipment
abc bells, whistles
def bells, tops, shovels
ghi shovels
jkl tops, whistles
So when Mr Bell Maker wants to see which kids are using his bells, he should be able to see:
Kiddo
abc
def
Similarly, Ms. Shovel Maker should be able to see:
Kiddo
def
ghi
<?php
mysql_connect("localhost", $dbname, $dbpasswd )
or die ("Unable to connect to server.");
mysql_select_db($database)
or die ("Unable to select database.");
$result2 = mysql_query("SELECT * FROM `Makers` WHERE `Makerid`='$b' ");
$myrow3= mysql_fetch_array($result2);
$Name=$myrow3["Name"];
$result = mysql_query("SELECT * FROM `Market` WHERE `Equipment` = '$Name' ");
if ($myrow = mysql_fetch_array($result)) {
do {
printf(
$myrow["ID"],
$myrow["Kiddo"],
calculatedate($myrow["Date"]),
$myrow["Equipment"]);
} while ($myrow = mysql_fetch_array($result));
} else {
echo "Sorry, no records were found!";
}
?>
My table currently has the foll. info.
Kiddo Equipment
abc bells, whistles
def bells, tops, shovels
ghi shovels
jkl tops, whistles
So when Mr Bell Maker wants to see which kids are using his bells, he should be able to see:
Kiddo
abc
def
Similarly, Ms. Shovel Maker should be able to see:
Kiddo
def
ghi