Jump to content

hopbop

Members
  • Posts

    30
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

hopbop's Achievements

Member

Member (2/5)

0

Reputation

  1. ah good catch thank you for that
  2. nope all just randome test stuff
  3. age is just one of them each item in the array needs it? all im trying to findo out is how do i get the now 1 lage array with 4 sepret people into sepret arrays ?
  4. Ok so what I am trying to do is pull infromation form a DB got that bart done and stor it into a a way were i can take information and run reports like how many people are between the ages or 10-20 witch i can get to one i can get this in a way were all 4 test input datas are not in one big array but seprit arrys hres the code the code right now { <?php require_once('../../inc/globals.php'); $connection = mysql_connect( $DB_HOST, $DB_USER, $DB_PASS ) or die( mysql_error() ); mysql_select_db( $DB_NAME ) or die( mysql_error() ); $result = mysql_query( "SELECT * FROM form_data WHERE last_update >= 2012-10-01 AND form_template_id >= 14;" ) or die( mysql_error() ); while($row = mysql_fetch_array( $result, MYSQL_ASSOC )) { $jsonIterator = new RecursiveArrayIterator(json_decode(trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $KEY, $row{'data'}, MCRYPT_MODE_ECB)), true)); foreach ($jsonIterator as $key => $val) { $items[] = $val; } } print_r($items); echo"<br><br/>"; ?> it outputs { the problum is all 4 are in one array and me being new to arrays dont understand how to make them all have the same [key] for each time it loops? if that makes any sence?
  5. yes i have checked the database for that
  6. OK maybe i might be asking the wrong question ... "how can i get the information im trying to loop in to singal agency catagorys" ..... diffrent ecss will have dirent and or same agencys?
  7. try it did not work same results
  8. ok so i commented out the area i have working now im trying to loop that to make a report and it's working but it's repeating the report about 20 times ...... im abit lost on how this is happaning and how to fix it any help would rock <?php $ecss=$_GET['ecs']; $date1=$_GET['date1']; $date2=$_GET['date2']; require '../config.php'; mysql_select_db("learn_sym"); $result = mysql_query("SELECT agency FROM clients WHERE ecs= '$ecss' and date<= '$date2' and date>= '$date1'") or die(mysql_error()); while ($row = mysql_fetch_array($result)) { $agencyname= $row{'agency'}; $result2 = mysql_query("SELECT * FROM clients WHERE ecs= '$ecss' and date<= '$date2' and date>= '$date1' AND agency= '$agencyname' ORDER BY date ASC") or die(mysql_error()); echo"<ul style='width:800px; margin:0 auto 0;'> <h4 style='margin:0 10px 0; padding:0;'>"; if (!empty($agencyname)){echo$agencyname;} else {echo"Unknown";} echo"</h4>"; while ($row2 = mysql_fetch_array($result2)) { echo"<p style='margin:4px 0 0 15px;'> <span class='blue'>Name:</span> ".$row2['fname'].",".$row2['lname']." - <span class='blue'>Seen On:</span> ".$row2['date']." <span class='blue'>Email:</span> ";if(!empty($row2['email'])){echo $row2['email'];}else{echo"N/A";}echo" <span class='blue'>Phonenumber:</span> ";if(!empty($row2['cell_phone'])){echo $row2['cell_phone'];}else{echo $row2['home_phone'];}echo" </p> <p style='margin:4px 0 0 15px; background-color:#f3f3f2;'> <span class='blue'>Services: </span>"; if (!empty($row2['want_serv_1'])){echo"FASFSA Completion, ";} if (!empty($row2['want_serv_4'])){echo"Admissions Application Assistance, ";} if (!empty($row2['want_serv_5'])){echo"Career and Academic Advising/Testing, ";} if (!empty($row2['want_serv_2'])){echo"Scholarship Search Information, ";} if (!empty($row2['want_serv_3'])){echo"Loan Default Assistance, ";} if (!empty($row2['want_serv_6'])){echo"Financial Literacy Education,";}echo" </p> <p style='margin:4px 0 0 15px;'> <span class='blue'>FASA: </span>"; if (!empty($row2['fasfsa_amt'])){$fa = $row2['fasfsa_amt'];} if (isset($fa)){$tf = $fa; echo"$".$tf; } else{echo"N/A";}echo" <span class='blue'>Grants: </span>"; if (!empty($row2['stgrants_amt'])){$sg = $row2['stgrants_amt'];} if (!empty($row2['logrants_amt'])){$lg = $row2['logrants_amt'];} if (isset($sg)&&isset($lg)){$tg = $sg + $lg; echo"$".$tg; } else{echo"N/A";}echo" <span class='blue'>scholarships: </span>"; if (!empty($row2['stscol_amt'])){$ss = $row2['stscol_amt'];} if (!empty($row2['priscol_amt'])){$ps = $row2['priscol_amt'];} if (isset($ss)&&isset($ps)){$ts = $ss + $ps; echo"$".$ts; } else{echo"N/A";}echo" <span class='blue'>Loans: </span>"; if (!empty($row2['subloan_amt'])){$sl = $row2['subloan_amt'];} if (!empty($row2['unsubloan_amt'])){$ul = $row2['unsubloan_amt'];} if (isset($sl)&&isset($ul)){$tl = $sl + $ul; echo"$".$tl; } else{echo"N/A";}echo" <strong><span class='blue'>Total: </span></strong>"; if (isset($tf)||isset($tg)||isset($ts)||isset($tl)){$gt = $tf + $tg + $ts + $tl; echo"$".$gt; } else{echo"N/A";}echo" </p> <div style='border-bottom:1px solid skyblue;padding-bottom:10px;'></div>"; } echo"</ul><br />"; } ?>
  9. <?php $date1=$_GET['date1']; $date2=$_GET['date2']; $ecs=$_GET['ecs']; include '../config.php'; mysql_select_db("_learn_sym"); $result = mysql_query("SELECT id FROM clients WHERE ecs= '$ecs'") or die(mysql_error()); $row = mysql_fetch_array($result); echo $row['id']; ?> output : 05634
  10. yes i have done that and it is returing results ......
  11. ok so simpole loop i know the connetion works in the config file because it's in other files working and the mysql_select_db is working and corect but for the life of me can not get this thing to display the information! help this is driving me up the wall <?php $date1=$_GET['date1']; $date2=$_GET['date2']; $ecs=$_GET['ecs']; include '../config.php'; mysql_select_db("_learn_sym"); $result = mysql_query("SELECT * FROM clients WHERE date <= '$date1' and date >= '$date2' and ecs= '$ecs'") or die(mysql_error()); while ($row = mysql_fetch_array($result, MYSQL_NUM)) { printf("ID: %s Name: %s", $row[0], $row[1]); } mysql_free_result($result); ?>
  12. ok so what im trying to do is pass a posted value for the name of the table in a mysql_query this is the code i have $dbt = $_POST[arc]; $sql = mysql_query("SELECT id, fname, mi, lname ". "FROM $dbt". "ORDER BY date DESC ". "LIMIT $offset, $rec_limit "); I think i am missing something form the FROM area i just dont know what any help ?
  13. Yup I see the prob now and thank you for pointing out the thing I was missing
  14. So did the error checking nothing comes back as error it's connecting fine the POST info is being stored correctly in the verbals and the sql array is all in correct order and spelling is right ....... why is not it saving to DB. I have a feeling it's something silly that I am missing hence why I am posting it I need some fresh eyes on this. <?php $ecs = 'James'; if (isset($_POST['agency_contacts'])) $agency_contacts = $_POST['agency_contacts']; else $agency_contacts = 'N/A'; if (isset($_POST['newsletters'])) $newsletters = $_POST['newsletters']; else $newsletters = 0; if (isset($_POST['flyers'])) $flyers = $_POST['flyers']; else $flyers = 0; if (isset($_POST['brochures'])) $brochures = $_POST['brochures']; else $brochures = 0; if (isset($_POST['posters'])) $posters = $_POST['posters']; else $posters = 0; if (isset($_POST['high_educaiton_fair'])) $high_educaiton_fair = $_POST['high_educaiton_fair']; else $high_educaiton_fair = 0; if (isset($_POST['website'])) $website = $_POST['website']; else $website = 0; if (isset($_POST['public_service_announcements'])) $public_service_announcements = $_POST['public_service_announcements']; else $public_service_announcements = 0; if (isset($_POST['press_releases'])) $press_releases = $_POST['press_releases']; else $press_releases = 0; if (isset($_POST['special_presentations'])) $special_presentations = $_POST['special_presentations']; else $special_presentations = 0; if (isset($_POST['Inservices'])) $Inservices = $_POST['Inservices']; else $Inservices = 0; if (isset($_POST['other'])) $other = $_POST['other']; else $other = NULL; $host = "localhost"; $user = "root"; $pass = ""; $db_name = "learn_sym"; $con = mysql_connect("$host","$user","$pass"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db($db_name, $con); $sql = "INSERT INTO outreach (id, dte, ecs, agency_contacts, newsletters, flyers, brochures, posters, high_educaiton_fair, website, public_service_announcements, press_releases, special_presentations, Inservices, other) VALUES (NULL, now(), '$ecs','$agency_contacts','$newsletters','$flyers','$brochures','$posters','$high_educaiton_fair','$website','$public_service_announcements','$press_releases','$special_presentations','$Inservices', '$other')"; if (isset($sql,$con)) { header("Location: market.php"); } else { die('Error: ' . mysql_error()); } mysql_close(); ?>
  15. thank you, you are gentlemen and scholars in my book I have now got it working and here is the code for record include '../config.php'; $query = "SELECT COUNT(*) AS varb FROM clients WHERE col1='foo' and col2 ='bar'"; $result = mysql_query($query); while($data=mysql_fetch_array($result)){ $count = $data['varb']; } echo $count;
×
×
  • 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.