For Programmers: Free Programming Magazines  


Home > Archive > PHP SQL > August 2004 > Help with if condition ** SOLVED **









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Help with if condition ** SOLVED **
tox_yray

2004-08-18, 3:57 pm

Ok, here what I want to do is to put a condition of displaying for a
string.

If the number of entries is 1, put it singular.
If it is over, put it plural.

Here is the parcel of code: --------
for (i=0; i<sizeof(diplomes);
i++)
{
select = "SELECT * FROM "
.langue. tables[i] . " WHERE ancien
=0";
result =
mysql_query(select,db);
total =
mysql_num_rows(result);
if(total)
{
etudiant=
mysql_fetch_array(result);
stagedocnum = "SELECT *
FROM" . langue. "stage_doc WHERE ancien =0";
reqstagedoc =
mysql_query(stagedocnum,db);
comptestagedoc =
mysql_num_rows(reqstagedoc);
url =
"etudiants_actuels.php" . "?lg=" . lg .
"&table=" . tables[i];
echo '<a href="' .
url .'">';
if(comptestagedoc > 1)
{
}
elseif(comptestagedoc == 1)
{
diplomes =
str_replace(memb_labels['Stagiaires
doctoraux'], memb_labels['Technicien'],
diplomes);
}
echo '<strong class=>'
.comptestagedoc.
memb_labels[diplomes[i]] .
'</strong>';
echo
'</a><br><br>';

}
--------

The problem is that it just does not work (comptestagedoc it
returns nothing, i know that because I echoed it in the code to see
if it was the problem: look at the before last echo... I t only
echoes memb_labels[diplomes[i]])

Now I heard that my version of MySQL could be the problem. I run MySQL
3.23.58. Now is there a way to correct this and make this prcel of
code work?

Thanks,
Bruno M-A.





----------------------------------------
The post originated from PHP Freaks:
----------------------------------------
http://www.phpfreaks.com
http://www.phpfreaks.com/forums


tox_yray

2004-08-18, 3:57 pm

Foget about that, if was the reqstagedoc that ws not working....




----------------------------------------
The post originated from PHP Freaks:
----------------------------------------
http://www.phpfreaks.com
http://www.phpfreaks.com/forums


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com