Jump to content

Simple Array Problem I Cant Figure Out


savagenoob

Recommended Posts

No freakin clue why this wont echo what I want it to. print_r on the array works but echo'ing individual sections wont work.

 

    $query = mysql_query("SELECT * FROM auto WHERE PolNum = '$PolNum' AND Agency = '$agency' ORDER BY ID DESC LIMIT 1") or die(mysql_error());
  $clientinfo[] = mysql_fetch_array($query);
  print_r($clientinfo);

echo $clientinfo['Company'];
echo $clientinfo[7];
$company = $clientinfo['Company'];
echo $company;

None of the 3 echos will work.... I know its something simple and/or stupid.  :-[

Link to comment
https://forums.phpfreaks.com/topic/208484-simple-array-problem-i-cant-figure-out/
Share on other sites

Array ( [0] => Array ( [0] => 47 [iD] => 47 [1] => 679798798 [PolNum] => 679798798 [2] => 2010-05-26 21:12:06 [EffDate] => 2010-05-26 21:12:06 [3] => [PhysStreet] => [4] => Sacramento [PhysCity] => Sacramento [5] => [PhysState] => [6] => 91111 [PhysZip] => 95842 [7] => pOOP Insurance [Company] => pOOP Insurance [8] => 93 [ClientID] => 93 ....

Just change the output from the db to just a variable not an array

 

    $query = mysql_query("SELECT * FROM auto WHERE PolNum = '$PolNum' AND Agency = '$agency' ORDER BY ID DESC LIMIT 1") or die(mysql_error());
  $clientinfo = mysql_fetch_array($query);
  print_r($clientinfo);

echo $clientinfo['Company'];
echo $clientinfo[7];
$company = $clientinfo['Company'];
echo $company;

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.