Jump to content

hopbop

Members
  • Posts

    30
  • Joined

  • Last visited

Everything posted by hopbop

  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;
  16. ill try to exsplan it diffrently what i am trying to do is display a count for itemA in the database were if itemB = foo and itemA = bar ... so if say db row one itemB is boo and itemA is bar and db row two itemB is foo and itemA is bar the over all count is 1
  17. I gave that a try but it echoed out 53 but it should of sad 2 ?
  18. So I'm sitting at my desk scratching my head on how to do a task where I pull information form a database (that i know how to do) but then i need to see if two variables equal a string and if they do count out how many times that two variables equal there two string checks and out put the counted number ? this is what I have thought of but dose not to work because I cant figure out a way to code it? $dbPull = mysql_fetch_array($result) if( $dbPull['Foo'] == 'string1' && $bdPull['Bar'] == 'string2') this is were I get lost I'm looking for (how many times in the DB dose String2 show up in the array were the above, IF statement is true ) any ideas would be most appreciated
  19. thank you Barand that was the prob it works now.... and now a bit more wise about naming things lol
  20. ok so here is whats going on i have this small little php to update one thing in a table but it's not updating the mysql_error is You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'check=1 WHERE id='21'' at line 1 what is the prob because i spent a hour on this and cant git it? here is the php <?php include '../config.php'; $id = $_GET['del']; mysql_query("UPDATE call_list SET check=1 WHERE id='$id'")or die(mysql_error()); header("Location: index.php"); ?>
  21. thank you for the reply this did help me once I tryed to echo $_GET['id'] i came to the thought that it's not declared id in the url but del so once i cuckeld a bit and my head went to my desk hard (been trying to fig this out for 2 hours ) i replaced $_GET['id'] with $_GET['del'] now it all works thank you ......... I think i need to sleep more lol
  22. hello i have this code here to delete people form a call list but it is not deleting form it could I get a some help? the form <?php include '../config.php'; $query="SELECT * FROM call_list WHERE ecs = 'Jam' order by date desc"; $result=mysql_query($query); echo mysql_error(); //////////////// Now we will display the returned records in side the rows of the table///////// while($row = mysql_fetch_array($result)) { echo " <table id='call_list'> <form name='Call_delet' action='del.php' method='get'> <tr> <td class='call_names'> $row[Fname] $row[Lname] </td> <td class='call_numbers'> $row[phone] </td> <td class='call_email'> $row[email] </td> <td class='call_email'> $row[calltime] </td> <td> <a href='del.php?del=$row[id]'>Del</a> </td> </tr> </form> </table> "; } ?> del.php page <?php include '../config.php'; if (isset($_GET['id']) && is_numeric($_GET['id'])) { $id = $_GET['id']; $result = mysql_query("DELETE FROM call_list WHERE id=$id") or die(mysql_error()); header("Location: view.php"); } else { echo"dident work"; } ?>
  23. .... ok now I feel stupid for asking, thank you
  24. Ok so I have a question. is it possible to make a form submit to a DB in real time without the need for a submit button ? if so could you drop a hint to what it would be caled or a tut / reference to it ?
  25. I would agree, systems like this scare me, all it takes is one missed sql injection spot and everyone has your user's credit cards, unencrypted and you are responsible for all the damage done. You are asking for a lot of trouble with something like this. I fully understand your concerns for this but like i sad in a few post ago this is just a base phase to a long term bigger system and this is not live on the net I will be using a payment gateway system and not the database when i come to that part for now i just wanted to solve this hiccup that is hindering my progress also thank you ManiacDam for the advice on the @ on the mail() I will try that out
×
×
  • 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.