Telah Dianugerahkan

need 2 PHP/mySQL modifications working together ...

I have a line of code and 2 different modifications, by 2 different programmers. What I need done is them both working together correctly. I'm sure that someone with a good understanding of PHP can figure this out quite quickly.

The first modification sorts an array of categories alphabetically, while the second modification shows only categories which have products listed within.

The ORIGINAL code line is:

---------------------------------------------------------------------------------------------------------------------------------------

while ($cat_details = $db->fetch_array($sql_select_categories))

{

$subcat_link = basename($_SERVER['PHP_SELF']) . '?parent_id=' . $cat_details['category_id'] . $additional_vars;

$output .= '<tr> '.

' <td class="contentfont">&nbsp;&raquo; <a href="' . $subcat_link . '">' . $category_lang[$cat_details['category_id']] . '</a></td> '.

'</tr> ';

}

---------------------------------------------------------------------------------------------------------------------------------------

The FIRST MODIFICATION tells me to replace the original code with:

---------------------------------------------------------------------------------------------------------------------------------------

while ($cat_details = $db->fetch_array($sql_select_categories))

{

$cat_array[$cat_details['category_id']]["name"]=$category_lang[$cat_details['category_id']];

}

if(is_array($cat_array)){

asort($cat_array);

foreach($cat_array as $key => $value){

$subcat_link = basename($_SERVER['PHP_SELF']) . '?parent_id=' . $key . $additional_vars;

$output .= '<tr> '.

' <td class="contentfont">&nbsp;&raquo; <a href="' . $subcat_link . '">' . $category_lang[$key] . '</a></td> '.

'</tr> ';

}

}

---------------------------------------------------------------------------------------------------------------------------------------

While the SECOND MODIFICATION tells me to replace the original code with:

---------------------------------------------------------------------------------------------------------------------------------------

if ($cat_counter[$cat_details['category_id']] > 0 || COUNT_CATS == 0)

{

$output .= '<tr> '.

' <td class="contentfont"> » <a href="' . $subcat_link . '">' . $category_lang[$cat_details['category_id']] . '</a> '.

(($cat_counter[$cat_details['category_id']]) ? '<span class="cnt">(' . $cat_counter[$cat_details['category_id']] .')</span>' : '').

' </td> '.

'</tr> ';

}

---------------------------------------------------------------------------------------------------------------------------------------

So again, what I need is BOTH modifications working together as ONE, with both functions working correctly.

I am also attaching a TXT file with the code again in case it doesn't display correctly.

Kemahiran: MySQL, PHP

Lihat lebih lanjut: no working, mysql php programmers, good working, foreach php mysql, one line php, together mysql, php file array, output php, display mysql, php output, php array file, together, need done, need good php, mysql output, php mysql modification, mysql php output, modification php mysql, mysql display, php mysql functions, php txt mysql, mysql replace, array span, php mysql txt file, php mysql array

Tentang Majikan:
( 3 ulasan ) Bangkok, Thailand

ID Projek: #1598669

5 pekerja bebas membida secara purata $37 untuk pekerjaan ini

Max01

hi sir i can do it for you

$30 USD dalam 0 hari
(171 Ulasan)
6.1
baribuet

please check your pmb

$30 USD dalam sehari
(29 Ulasan)
5.3
mikebar

hi there, i have a different approach for, check PM

$50 USD dalam 0 hari
(2 Ulasan)
1.6
gopalagr85

Hello, I am interested in your project, I want to work with you, if you are interested. Please check you PMB

$35 USD dalam 2 hari
(0 Ulasan)
0.0
daltino

Hi I can help with the modification you need, I'm a very good PHP developer.

$40 USD dalam sehari
(0 Ulasan)
0.0