Jump to content

techker

Members
  • Posts

    812
  • Joined

  • Last visited

Everything posted by techker

  1. wow..lol cool i will try it out tonight.thx!
  2. Hey guys i need to make a query that checks entries in the last 24 hours the 48 then 72... i got this but it show in 48 and 72 and month.. $x12 = 'SELECT COUNT(*) FROM Sortie WHERE `Date`> NOW() - INTERVAL 48 HOUR'; $result12 = mysql_query($x12) or die(mysql_error()); $total_rows12 = mysql_fetch_row($result12); my goal is to get in the last 12h..the skips to 48h if it stay without editing and so on..
  3. how does that work?
  4. im trying with SELECT Nom, prenom, MATCH (Nom,Prenom) AGAINST ('Amara') From Etudiant but i get #1191 - Can't find FULLTEXT index matching the column list
  5. Hey guy im pulling info from a database :full name(in table):john doe but i need to look in another table for information this name. the issue is that in the student table there is first and last name. how can i search in first and last name if i have a full name? i have tried the like%% and used php myadmin to try combos... so example in a form im pulling full names out of a databse. john doe need to look in another DB with(John doe) for information but the table is first-last-studentID-date-class..
  6. no..it works now with the update status once it is inserted.
  7. So every day there is students that get kicked out of class (remember)lol so they have this class room they go to .the teacher there inserts his name,teacher and notes in the db. when the students gets kicked out more then 2 times by the same teacher in the same week he gets a detention and the teacher must meet the parents... So i have 2 DB DB-1 is the (Sortie) detention room info.(name-teacher-notes..) DB-2 (Suivit) Fallowup So what the script does is check the DB 1 for 2 times plus with the same teacher. so it inserts in the Db2 the teacher-Student-Date... So the goal is to work with DB2 for different possibility's..(48h Followup terms) So it works now.. what im doing first is checking the recurrence's then inserting the info in the Fallowup Db the issue was it was inserting the same info all the time the page refreshed.. So i added an update status of DB1 to Yes.so it can skip that entry.
  8. well i don't want it to be manually done..i want to automatically done.. like every 30min.. i think the simple way will be to add an update query to update the status to yes.
  9. sorry..i will try to find tutorials on this..
  10. ok... i don't get it.. even if the button is presst i still need to look in the DB and insert the results?inless once it is insert and update query to set the status to yes...
  11. ok thx!
  12. hey guys another litle issue i just encountered..lol i refresh the page to find new content in my DB.. so it refreshes but every refresh it inserts the same value..is it possible for it to not insert the same info every refresh? include"auth_check_header.php"; require_once 'class/config.php'; $username_from_cookie = $_COOKIE[$cookiename]; //retrieve contents of cookie // connect to the database $conn = mysql_connect($db_host, $db_user, $db_pass) or die("Could not connect to database!"); mysql_select_db($db, $conn); $query = "SELECT Code_P, Prof, Status FROM Sortie GROUP BY Code_P, Prof, Status HAVING COUNT( * ) >=2 AND Status='No' LIMIT 0 , 30"; //$result = mysql_query ($query) or die ('Your query did not match any results: ' . mysql_error()); $result=mysql_query($query); while ($row = mysql_fetch_array($result)) { $N_Etudiant = $row["Code_P"]; $Professeur = $row["Prof"]; $date = date("Y-m-d"); $Status = 'No'; mysql_query("INSERT INTO `Suivit` (`Prof` ,`Etudiant` ,`Date` ,`Status` ) values ('$Professeur','$N_Etudiant','$date','$Status')"); } ?> <META HTTP-EQUIV=Refresh CONTENT="30"> [code=php:0]
  13. ouff..getting heavy for me..lol thx for the help by the way.. so $fieldCnt = 0; returns in input name="Name[$fieldCnt]-Contact[$fieldCnt]-Periode[$fieldCnt] So how does it know witch field is what? shouldnt i do $fieldCnt = 0 $fieldCnt2 = 1....
  14. ok i get it.so after i can pull the information faster and more efficient. So my question is .i made the script that populates the page by Grade(1-2-3-4-5-6) so the teacher selects the students that are in her class and submits to insert in DB.. simple said...but not done.this is an issue for me.. so i have the form set up as: // get value of id that sent from address bar $Sec = $_GET['Sec']; // Retrieve data from database $sql="SELECT * FROM Etudiant WHERE Secondaire='$Sec'"; $result=mysql_query($sql); echo '<form name="Edit" method="post" action="update.php"> <table width="400" border="0" cellspacing="1" cellpadding="0"> <tr> <td align="center"><strong>Name:</strong></td> <td align="center"><strong>Contact:</strong></td> <td align="center"><strong>Periode:</strong></td> <td align="center"><strong>Select:</strong></td> </tr>'; while ($row = mysql_fetch_assoc($result)) { //we will echo these into the proper fields echo '<tr> <td align="center"><input name="Name" type="text" id="Name" value="'.$row['Code_P'].'"></td> <td align="center"><input name="Contact" type="text" id="Contact" value="'.$row["Nom"].'" size="15"></td> <td> <select name="Periode"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> </select> </td> <td> <input name="Name" type="checkbox" id="Select" value="'.$row['Code_P'].'"> </td> </tr>'; } echo '<tr> <td colspan="4" align="center"><input type="submit" name="Submit" value="Submit"></td> </tr> </table> </form>'; // close connection mysql_close(); so its the insert part that confuses me..
  15. so the table issue would be to make a table for every class and add to students in it.. so the teacher would creat her class then add the students in her class table.. as fo the insert part.how can i insert the values?were do the values come from? this:?$id = implode("'),('",$checkbox);
  16. true.how would you make the table?
  17. but how to do it to insert multiple values in database?
  18. i got this $conn = mysql_connect($db_host, $db_user, $db_pass) or die("Could not connect to database!"); mysql_select_db($db, $conn); if(isset($_POST['checkbox'])){$checkbox = $_POST['checkbox']; if(isset($_POST['activate'])?$activate = $_POST["activate"]:$deactivate = $_POST["deactivate"]) $id = "('" . implode( "','", $checkbox ) . "');" ; $sql="INSERT INTO `Classes` (`Etudiant` ) values ('$id')" ; $result = mysql_query($sql) or die(mysql_error()); } $sql="SELECT * FROM Etudiant"; $result=mysql_query($sql); $count=mysql_num_rows($result); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset="utf-8"" /> <title>Update multiple rows in mysql with checkbox</title> <script type="text/javascript"> <!-- function un_check(){ for (var i = 0; i < document.frmactive.elements.length; i++) { var e = document.frmactive.elements[i]; if ((e.name != 'allbox') && (e.type == 'checkbox')) { e.checked = document.frmactive.allbox.checked; }}} //--> </script> </head> <body> <table width="400" border="0" cellspacing="1" cellpadding="0"> <tr> <td><form name="frmactive" method="post" action=""> <table width="400" border="0" cellpadding="3" cellspacing="1"> <tr> <td colspan="5"><input name="activate" type="submit" id="activate" value="Select" /> </td> </tr> <tr> <td> </td> <td colspan="4"><strong>Update multiple rows in mysql with checkbox</strong> </td> </tr><tr> <td align="center"><input type="checkbox" name="allbox" title="Select or Deselct ALL" style="background-color:#ccc;"/></td> <td align="center"><strong>Id</strong></td> <td align="center"><strong>Firstname</strong></td> <td align="center"><strong>Lastname</strong></td> <td align="center"><strong>Status</strong></td> </tr> <?php while($rows=mysql_fetch_array($result)){ ?> <tr> <td align="center"><input name="checkbox[]" type="checkbox" id="checkbox[]" value="<? echo $rows['Code_P']; ?>"></td> <td><? echo $rows['Code_P']; ?></td> <td><? echo $rows['Nom']; ?></td> <td><? echo $rows['Prenom']; ?></td> <td><? echo $rows['Foyer']; ?></td> </tr> <?php } ?> <tr> <td colspan="5" align="center"> </td> </tr> </table> </form> but i get this 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 'ABDA16059609','ABOD20609508','ABOA06599807');')' at line 2 i think it's because it is inserting all in on column. in need it to instert in but seperatly..
  19. Hey guys im confused on something..lol so what im doing is searching my databse for specific terms.. no that part is good. the part were i need guidance is i need to list the results but put a checkbox beside it to select multiple results to insert in a database example select * from students were grade = 3 results: matthew d checkbox luis m checkbox mike a checkbox .... so once they press submit it inserts the selected studenst in a class database.
  20. ya i seen your page.. but the thing is is that the first query is for the second to work.. inless i can do an inner join ? cause i can't put the second query but on the first i can't.. if (!$result) { echo "Could not successfully run query ($sql) from DB: " . mysql_error(); exit; } while ($row = mysql_fetch_array()) { .... }
  21. well what mess is me up is that i have 1 query that depends on the other.. the first $Etudiant=$_GET['E_ID']; $query = "SELECT * FROM `Etudiant` WHERE `Code_P` ='$Etudiant'"; $numresults=mysql_query($query); $row10 = mysql_fetch_assoc($numresults); get the id and the second gets the search results in another table $Nom = $row10["Nom"]; $Prenom = $row10["Prenom"]; $fileSQL="SELECT `N_Etudiant` FROM `Expulsion` WHERE `Nom` LIKE '$Nom' AND `Prenom` LIKE '$Prenom' LIMIT 0 , 30"; $fileLIST=mysql_query($fileSQL);
  22. hey guys i keep on getting this error when i have no results..i need a full no results.. Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/techker/public_html/Site/New/Main/Rapport.php on line 46 No results found. Please check often to see if we have more data.. $Etudiant=$_GET['E_ID']; $query = "SELECT * FROM `Etudiant` WHERE `Code_P` ='$Etudiant'"; $numresults=mysql_query($query); $row10 = mysql_fetch_assoc($numresults); if ($row10 == 0) { echo "<h4>Results</h4>"; echo "<p>Sorry, your search: returned zero results</p>"; } $Nom = $row10["Nom"]; $Prenom = $row10["Prenom"]; $fileSQL="SELECT `N_Etudiant` FROM `Expulsion` WHERE `Nom` LIKE '$Nom' AND `Prenom` LIKE '$Prenom' LIMIT 0 , 30"; $fileLIST=mysql_query($fileSQL); if(mysql_num_rows($fileLIST) > 0){ while ($row = mysql_fetch_array($fileLIST)) {
  23. thx i will google it
  24. 12/05/11 9:13 am with var $date = date ('m/d/y g:i a');
  25. ok so i set the current date to $date_o = date ('m/d/y'); cause it inserts :$date = date ('m/d/y g:i a'); 12/05/11 9:13 am 70.29.200.146 techker but still nothing?is the AND ok?
×
×
  • 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.