|
From: Ray M. <ra...@st...> - 2003-03-14 15:11:38
|
To anyone who can help,
=20
I've been working on creating additional database and pages for
phphelpdesk for our company.
I'm stuck on a mysql array that is blank. I want to see if any one can
help me fix this.
=20
I've created a customer, contact and location database for opening
tickets. Instead of entering contact and company info every time a
ticket is generated, I added a selectable array for customer, contact
and location. I have it setup so when adding a job, you select a
Company, it then refreshes the screen with contact list and location
list for that company. You can select the contact and location having
and reporting the problem and then fill out the rest of the ticket and
add it.
=20
The problem I am having is that the contact variable is not null when no
contacts are listed for that company. So, say you are adding a ticket
and you select the wrong company. It displays the contact and location
info for that company, no big deal you can just select the correct
company again from the list and it refreshes the info for the new
company. The problem is when the new company selected has no contact
info, when the ticket is added it puts the contact info from the
incorrect company into the ticket. I also have it emailing the customer
to notify them that a ticket was opened for them, so obviously if the
contact info is wrong, then the wrong contact is emailed.
=20
Here is the contact array from the addjob:
<select size=3D1 name=3D"lstContactName">
<?
////////////////////////////////////////////////////////////////////////
/
// query the database and input all information into the contact list
$query =3D "SELECT c_name FROM contact WHERE
c_customer=3D'$lstCustomerName';";
$mysql_result =3D query($query);
while($contacts =3D mysql_fetch_row($mysql_result)) {
for ($i=3D0; $i < sizeof($contacts); $i++) {
$myLength =3D strlen($contacts);
print " <option
value=3D\"$contacts[$i]\">$contacts[$i]</option>\n";
}
}
?>
</select>
=20
I need to find a way to check if the array from the database is null and
print "no contacts" and null the variable $lstContactName or $contacts.
Unfortunately, I have found no way to do this. Apparently when a mysql
array is formed with a null for a variable, it doesn't list it as null!
So, I can't use if ($contacts =3D=3D"") or (isset($contacts)) or even
(empty($contacts).
=20
Let me know if you need any more info to help me. I will be releasing
the code to anyone who is interested once I get all the bugs worked out
and it is working right. I am new to PHP and MySQL, but have picked it
up very quickly.
=20
Thanx,
Ray Miller
|