Justtechjobs.com Find a programming school near you






Online Campus Both


php3-list | 200003

[PHP3] php questions From: Absm (abbs <email protected>)
Date: 03/15/00

Hello, could someone assist with some of these qustions please.

Html Extract:

 <table width="100%" border="6" cellspacing="5" cellpadding="3"
align="center" style="border-color: Black; font-size: small; font-family:
Verdana;">
<tr bgcolor="#FFCCFF">
<td rowspan="1" style="font-family: Americana XBd BT; font-size: small;">
N.American <input type="checkbox" name="race1" value="N.American"></td>
<td style="font-size: small; font-family: Americana XBd BT;">
W.European <input type="checkbox" name="race2" value="W.European">
<td style="font-size: small; font-family: Americana XBd BT;">
Far Eastern <input type="checkbox" name="race3" value="Far Eastern"></td>
</tr>
<tr bgcolor="#FFCCFF">
<td rowspan="1" style="font-family: Americana XBd BT; font-size: small;">
Australian <input type="checkbox" name="race4" value="Australian"></td>
<td style="font-size: small; font-family: Americana XBd BT;">
New Zealand <input type="checkbox" name="race5" value="New Zealand"></td>
<td style="font-size: small; font-family: Americana XBd BT;">
Mediterranean <input type="checkbox" name="race6"
value="Mediterranean"></td>
</tr>
<tr bgcolor="#FFCCFF">
<td rowspan="1" style="font-family: Americana XBd BT; font-size: small;">
Middle Eastern <input type="checkbox" name="race7" value="Middle
Eastern"></td>
<td style="font-size: small; font-family: Americana XBd BT;">
S.Asian <input type="checkbox" name="race8" value="S.Asian"></td>
<td style="font-size: small; font-family: Americana XBd BT;">
E.European <input type="checkbox" name="race9" value="E.European"></td>
</tr>
<tr bgcolor="#FFCCFF">
<td rowspan="1" style="font-family: Americana XBd BT; font-size: small;">
Latin American <input type="checkbox" name="race10" value="Latin
American"></td>
<td style="font-size: small; font-family: Americana XBd BT;">
Central Asian <input type="checkbox" name="race11" value="Central
Asian"></td>
<td style="font-size: small; font-family: Americana XBd BT;">
African <input type="checkbox" name="race12" value="African"></td>
</tr>
<tr bgcolor="#FFCCFF">
<td rowspan="1" style="font-family: Americana XBd BT; font-size: small;">
Afro Caribbean <input type="checkbox" name="race13" value="Afro
Caribbean"></td>
<td style="font-size: small; font-family: Americana XBd BT;">
S.African <input type="checkbox" name="race14" value="S.African"></td>
<td style="font-size: small; font-family: Americana XBd BT;">
All Races <input type="checkbox" name="race1 race2 race3 race4 race5 race6
race7 race8 race9 race10 race11 race12 race13 race14 race15 race16 race17 "
value="N.American W.European Far Eastern Australian New Zealand
Mediterranean Middle Eastern S.Asian E.European Latin American Central Asian
African Afro Caribbean S.African Caucasian Mixed Race Native American"
checked></td>
</tr>

<tr bgcolor="#FFCCFF">
<td rowspan="1" style="font-family: Americana XBd BT; font-size: small;">
Caucasian <input type="checkbox" name="race15" value="Caucasian"></td>
<td style="font-size: small; font-family: Americana XBd BT;">
Mixed Race <input type="checkbox" name="race16" value="Mixed Race">
<td style="font-size: small; font-family: Americana XBd BT;">
Native American <input type="checkbox" name="race17" value="Native
American"></td>
</tr>

</table>

Php Extract:

$race = "";
// test for each race checked
if($race1)
{
$race .= " OR race = '".$race1."'";
}
if($race2)
{
$race .= " OR race = '".$race2."'";
}
if($race3)
{
$race .= " OR race = '".$race3."'";
}
if($race4)
{
$race .= " OR race = '".$race4."'";
}
if($race5)
{
$race .= " OR race = '".$race5."'";
}
if($race6)
{
$race .= " OR race = '".$race6."'";
}
if($race7)
{
$race .= " OR race = '".$race7."'";
}
if($race8)
{
$race .= " OR race = '".$race8."'";
}
if($race9)
{
$race .= " OR race = '".$race9."'";
}
if($race10)
{
$race .= " OR race = '".$race10."'";
}
if($race11)
{
$race .= " OR race = '".$race11."'";
}
if($race12)
{
$race .= " OR race = '".$race12."'";
}
if($race13)
{
$race .= " OR race = '".$race13."'";
}
if($race14)
{
$race .= " OR race = '".$race14."'";
}
if($race15)
{
$race .= " OR race = '".$race15."'";
}
if($race16)
{
$race .= " OR race = '".$race16."'";
}
if($race17)
{
$race .= " OR race = '".$race17."'";
}

Mysql Query:
$result = mysql_query("SELECT first_name, country_residence, thum_name,
race, description, (to_days(now())-to_days(dob))/365 as Age from women where
country_residence like '$country_residence' AND
(to_days(now())-to_days(dob))/365 >='$min_age' AND
(to_days(now())-to_days(dob))/365 <='$max_age' AND height >='$min_height'
AND height <='$max_height' AND weight >='$min_weight' AND weight
<='$max_weight' AND current_date - period <= '$past_ads' AND marital_status
like '$marital_status' $race ", $db);

Question:

Presently 2 races exist in mysql:

1.When all races are searched for, all 2 races are displayed.
2. when 1 race is searched, all 2 races are displayed.
3. A non existent race is searched for, all 2 races are displayed.

Php Extract;

printf("<tr valign=\"top\" style=\"text-align: left; font-family: Verdana;
font-size: x-small; font-weight: bold;\"><td><a href=\"Prof.html\"><img src=
\"\foto_thum\%s\" width=50 border=0 alt=\"\" height=50></a><td>%s</td><td>%s
%s %s %s %s %s<br>%s</td></tr>\n",$myrow["thum_name"], "<p></p>",
$myrow["first_name"],"From",$myrow["race"],"Age", $myrow["Age"], "Years Old"
, substr( $myrow["description"], 0, 140 ));

Question:

How to round off age in the Printf function.

e.g. age=22.36
round to 22
Tryed defining $Age = round(21.22); at the top of script but noting
happened.
What`s missing?

Question:

Tryed using %'.5.5s% in the description function within Printf.
Result desired for ..... dots to appear after last truncked words.
This did not work.Dots appeared but not in desired position.

Thankyou for your help.

abs1 <email protected>

-- 
PHP 3 Mailing List <http://www.php.net/>
To unsubscribe, send an empty message to php3-unsubscribe <email protected>
To subscribe to the digest, e-mail: php3-digest-subscribe <email protected>
To search the mailing list archive, go to: http://www.php.net/mailsearch.php3
To contact the list administrators, e-mail: php-list-admin <email protected>