Jump to content

PHP arrays


headmine

Recommended Posts

I am sorta new to php. I know how to do this in asp. I don't get any errors when I do this but nothing outputs.

 

Basically I want it to look at the values being pulled from the database. If there is no data in the field I would like it to print out. "N/A"

 

Here is what I have.

 

$myFixedArray[0] = $row_rs_letter['bq1'];
$myFixedArray[1] = $row_rs_letter['bq2'];
$myFixedArray[2] = $row_rs_letter['bq3'];
$myFixedArray[3] = $row_rs_letter['bq4'];
$myFixedArray[4] = $row_rs_letter['ny'];
$myFixedArray[5] = $row_rs_letter['bq8'];
$myFixedArray[6] = $row_rs_letter['bq9'];
$myFixedArray[7] = $row_rs_letter['Q3367'];
$myFixedArray[8] = $row_rs_letter['Q3363'];
$myFixedArray[9] = $row_rs_letter['Q3362'];
$whois = $_GET['ID'];

foreach($myFixedArray as $key => $value) {
if ($myFixedArray == "") {
echo ("N/A");
}
}

 

Thanks in advance!

Link to comment
https://forums.phpfreaks.com/topic/153380-php-arrays/
Share on other sites

not sure what you're trying to accomplish here.

But if you're trying to checke each value something more like this

$myFixedArray[0] = $row_rs_letter['bq1'];
$myFixedArray[1] = $row_rs_letter['bq2'];
$myFixedArray[2] = $row_rs_letter['bq3'];
$myFixedArray[3] = $row_rs_letter['bq4'];
$myFixedArray[4] = $row_rs_letter['ny'];
$myFixedArray[5] = $row_rs_letter['bq8'];
$myFixedArray[6] = $row_rs_letter['bq9'];
$myFixedArray[7] = $row_rs_letter['Q3367'];
$myFixedArray[8] = $row_rs_letter['Q3363'];
$myFixedArray[9] = $row_rs_letter['Q3362'];
$whois = $_GET['ID'];

foreach($myFixedArray as $key => $value) {
if ($value == "") {
echo ("N/A");
}
}

Link to comment
https://forums.phpfreaks.com/topic/153380-php-arrays/#findComment-805814
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.