Error message in submitting a support ticket

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Ladylogic
Forum Newbie
Posts: 2
Joined: Thu Mar 03, 2005 8:07 am
Location: New York

Error message in submitting a support ticket

Post by Ladylogic »

I'm using a support ticket script and am getting an error at time ticket is submitted which reads:

Warning: extract(): First argument should be an array; line 776

I viewed the coding and below are a few of the lines:

774 $result = @mysql_query($query);
775 $row = @mysql_fetch_array($result);
776 extract($row);

Not knowing any PHP, I am hoping someone can help. It doesn't seem to hurt the submission; however, as a would-be hosting company, an error like this just isn't cool. :(
User avatar
CoderGoblin
DevNet Resident
Posts: 1425
Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany

Post by CoderGoblin »

The sql query is failing. The row is empty and therefore the code is failing.

I would suppose the database has not been set up correctly or access is denied.

The php script itself could be enhanced to show more meaningful messages.

Example:

Code: Select all

$result = @mysql_query($query);
if ($result) {
  $row = @mysql_fetch_array($result);
  extract($row); 
} else {
  die("sql Error "+mysql_error());
}
It doesn't seem to hurt the submission;
Without seeing the rest of the code there is no way of knowing what knock on effects would be somewhere down the line. What may not be visible now may be things like errors in reporting or statistics.
Ladylogic
Forum Newbie
Posts: 2
Joined: Thu Mar 03, 2005 8:07 am
Location: New York

SOLVED

Post by Ladylogic »

Thank you.
Post Reply