Jump to content

john666

Members
  • Posts

    20
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

john666's Achievements

Member

Member (2/5)

0

Reputation

  1. Bro i have a client it doesnt mean he gonna pay me...i started learn PHP so ask some 1 i want to make a project for u for free it will help me alot to learn and this forum is created for help not for critisice i think. every 1 on this forum can read books watch tutorial and can goto search engines but this forum have given me alot of exact codes edited my codes and showed me way how to make my work more eay so i posted my problem...if u have solution except search engine i,ll be thank full to u
  2. beo i can search nd know how to search but tons of code making me confuse m newbie so want exact code simple one that can help me out i have red many articles and codes but confused at how to make new file every time with desired name
  3. Hello Guys i dont know this place is better for this kind of Q r not but need urgent help Im working on SIS ..student information system i want to add a Functionality in my code that my client demanded me that retrive student table data in EXCEL format from database * like there should be a button for if he click over there the data should store in excel format with his desire file name * even for single student record or a list of record of whole class can any 1 give ma a sample for code for that of show me a way to add this Buton thanks ....
  4. i have checked result to ..Mail return true.. and in email array its has sender email id and i have sent short format too like mail($to,$subject,$message) but not receiving any thing in email and nor error on page
  5. i m unable to send mail using php where is problem while i have tried all other methods too but mail not receiving in my inbox..tried other id,s n diffrente codes too here is my code Form.... <html> <body> <form method="POST" action="mail.php"> First Name <input type="text" name="firstname" > Last Name <input type="text" name="lastname" > Email <input type="text" name="email" > <textarea rows="6" cols="10" name="message" ></textarea> <input type="submit" name="submit" value="Send Mail"> </form> </body> </html> PHP Code <?php $firstname=$_POST['firstname']; $lastname=$_POST['lastname']; $email=$email['email']; $to = "john1990@gmail.com"; $subject = "Test mail"; $message = "Hello! This is a simple email message."; mail($to,$subject,$message,$email,"From:".$firstname . $lastname); echo "Mail Sent SuccessFully."; ?>
  6. i want to make Seprate table for store user login Info..what u suggest its good way or not ???
  7. i have two tables 1. login and 2nd staff_record both have coulmns like login_id and staff_id i did not mention AUTO INCREAMENT value in login but defined AUTO INCREAMENT in staff_record i want that staff_record AUTO increament value i assign to login_id column value during code execution is it possible ???? because i have columns in login login_id ,user_name, pass_word ,user_level.........and in staff_Record there is emp_id emp_dept_id,emp_name, emp_username, emp_password, emp_level and emp_cnic .... now i want if i update or DELETE record from staff table staff record like user_name and password and user_level that i puted in login table should be updated or delete..PK AND FK concept but i want make this relation through Code is it possible if is then how????
  8. i Got this Logic bro and its quite Easy nd best way for this Code just need to know why we are storing Data in Sessions...im New in php so lil confuse here
  9. im having problem setting up folder paths in PHP ..want to secure my admin panel like www.mysite.com/admin/index.php if any one try and his user namd and password wrong then user should navigate to www.mysite.com i have a how to go 1 step back in php here is my code... <?php session_start(); include('header.php'); include('config.php'); if (isset($_GET['logout'])) { session_unset(); session_destroy(); header('location:index.php?msg=You Are Log Out'); } if (isset($_POST['submit'])) { $username = ($_POST['username']); $password = ($_POST['password']); $query = "SELECT * FROM login WHERE user_name='$username' AND pass_word='$password' LIMIT 1"; $result = mysql_query($query) or die(mysql_error()); if(mysql_num_rows($result)) { $_SESSION['username']=$username; $error = "You Can Not Access To Admin Panel"; header('location:college/index.php?error='.$error); //here what i should add?? exit(); } else { $error = "You Can Not Access To Admin Panel"; header('location:/college/index.php?error='.$error); //here what i should add?? } } ?> <table class="login" align="center"> <tr> <td class="table1" > Student Information System</td> </tr> </table> <div class="table2"> <form method="post"> <table class="table3" align="center"> <?php if(isset($error)): ?> <tr> <td colspan="2" style="color: red; font-weight: bold"><?php echo $error; ?></td> </tr> <?php endif; ?> <?php if(isset($_REQUEST['username'])): ?> <tr> <td colspan="2" style="color: red; font-weight: bold"><?php echo "Please Log In Usernme And Password"; ?></td> </tr> <?php endif; ?> <tr> <td>Username</td> <td><input type="text" name="username"></td> </tr> <tr> <td>Password</td> <td><input type="password" name="password"></td> </tr> <tr> <td colspan="2" align="center"><input type="submit" name="submit" value="LogIn"></td> </tr> </table> </form> </div> <?php include('footer.php'); ?> college is the name of my localhost folder localhost/college/admin/index.php and there is another file localhost/college/index.php i want if some 1 try to open admin panel and user enter username or password code navigate him to user panel like if he access www.mysite.com/admin/index.php and he enter username and password there the code should navigate him to www.mysite.com
  10. And if i m Sending Data to Other page like i have 2 pages 1 name Std_add.php and 2nd name std_save.php and in std_add.php i have just page where table is created and Set post Method there and Action set to std_save.php and validating there Data and then add into data base then same procedure will Apply ????
  11. I need Code for this problem If Query not Execute due to some Reason then Username and Password should be stored in Fields user should not need to enter again and again user name and password actually im not getting this concpt fully how to do that...Fields should not Empty untill user Enter correct username and password Here is my Code and need Extra code for this where to add <?php include('header.php'); include('config.php'); if (isset($_POST['submit'])) { $username = ($_POST['username']); $password = ($_POST['password']); $query = "SELECT * FROM login WHERE user_name='$username' AND pass_word='$password' LIMIT 1"; $result = mysql_query($query) or die(mysql_error()); if(mysql_num_rows($result)) { header('location:home.php'); exit; } else { $error = "Wrong Username / Password"; } } ?> <table class="login" align="center"> <tr> <td class="table1" > Student Information System</td> </tr> </table> <div class="table2"> <form method="post"> <table class="table3" align="center"> <?php if(isset($error)): ?> <tr> <td colspan="2" style="color: red; font-weight: bold"><?php echo $error; ?></td> </tr> <?php endif; ?> <tr> <td>Username</td> <td><input type="text" name="username"></td> </tr> <tr> <td>Password</td> <td><input type="password" name="password"></td> </tr> <tr> <td colspan="2" align="center"><input type="submit" name="submit" value="LogIn"></td> </tr> </table> </form> </div> <?php include('footer.php'); ?>
  12. Brother There is No error in Code But i want some additional code in this ...the problem is that when i update record if same roll number and same class record is already exist it show an Error mesg and All input fields get Empty i want that these Fields should not empty data should exist in these fields..so i need code for it
  13. I having Problem in Forms i have some Fields and i want if Some 1 try to update a Record and due to some error the Record could not update i want that Data should not Remove from Forms it should be in the input fields... here is my Code <?php include('header.php'); include('config.php'); include('navigation.php'); // get only integer value from request $id = intval(@$_REQUEST['student_id']); // we are going to show only one student so we need to // restrict the query to find one record only $query="select *from students where id='$id' limit 1"; $result=mysql_query($query); // check if record not found then no need to open the page if (!$result) { // this check is implement, just because of we are on update page // if id is invalid it's mean no record or invalid record // in this case no need to stay on this page. header("Location: students.php"); exit(); // if header generate warning exit will stop page rendering. } // we have only one record we know, because we set the LIMIT 1 // so no need for while loop. While loop is use when records are more then one. // Here we have one only $data = mysql_fetch_assoc($result); $stdname = $data['stdname'] ; $stdrollno = $data['stdrollno'] ; $stdfname = $data['stdfname'] ; $stdclass = $data['stdclass'] ; $stdcell = $data['stdcell'] ; $stddob = $data['stddob'] ; $stdaddress = $data['stdaddress'] ; $stdfee = $data['stdfee'] ; $class_id = $data['class_id']; // here we have class_id // now we need list of all classes to display in dropdown $query="select * from classes "; $classes_result = mysql_query($query) or die(mysql_error()); ?> <div class="data"> <form method="POST" action="stdupdate-validation.php"> <?php echo $stdaddress; ?> <table class="update" border="1px" align="center"> <tr><td>Student Name</td><td><input type="text"value="<?php echo $stdname; ?>" name="stdname"></td></tr> <tr> <td> Roll No</td> <td><input type="text" value="<?php echo$stdrollno; ?>" name="stdrollno" > </td></tr> <tr> <td> Father Name</td> <td><input type="text" value="<?php echo$stdfname; ?>" name="stdfname"> </td></tr> <tr> <td>Class </td> <td> <select name="stdclass"> <option value="0">No Class</option> <?php // check if classes are available if(mysql_num_rows($classes_result)) { // because we may have more then one class in query result // so now we need LOOP while ($class = mysql_fetch_assoc($classes_result)) { // now we have to check the class ID in classes while loading the list into dropdown $selected = ($class_id == $class['id']) ? 'selected="selected" ' : ""; echo '<option value="'.$class['id'].'" '.$selected.' >'.$class['name'].'</option>'; } } ?> </select> </td> </tr> <tr> <td>Cell No</td> <td><input type="text" value="<?php echo$stdcell; ?>" name="stdcell"> </td></tr> <tr><td>Date OF Birth</td> <td> <input type="text" value="<?php echo$stddob; ?>" name="stddob"> </td></tr> <input type="hidden" value="<?php echo$class_id; ?>" name="class_id"> <tr><td>Address</td><td> <textarea cols="30" rows="6" value="<?php echo $stdaddress; ?>" name="stdaddress"> </textarea> </td></tr> <tr><td>Ammount Of Fee</td><td> <input type="text" value="<?php echo$stdfee; ?>" name="stdfee"> </td></tr> <tr> <td colspan="2" align="center"><input type="submit" value="submit" name="submit"></td></tr> <input type="hidden" value="<?php echo $id ; ?>" name="id"> </table> </form> </div> <a href="students.php"> Back to Students</a> <?php include('footer.php'); here Updation update-validation.php start <?php include('config.php'); if(isset($_POST['submit'])) { $id=@$_REQUEST['id']; $stdclass=$_SESSION['stdclass']= @$_REQUEST['stdclass']; $stdname=$_SESSION['stdname']=@$_REQUEST['stdname']; $stdrollno=@$_REQUEST['stdrollno']; $stdfname=@$_REQUEST['stdfname']; $stdcell=@$_REQUEST['stdcell']; $stddob=@$_REQUEST['stddob']; $stdaddress=@$_REQUEST['stdaddress']; $stdfee=@$_REQUEST['stdfee']; $class_id=@$_REQUEST['class_id']; $stdname=trim($stdname); $stdrollno=trim($stdrollno); $stdfname=trim($stdfname); $stdclass=trim($stdclass); $stdcell=trim($stdcell); $stddob=trim($stddob); $stdaddress=trim($stdaddress); $stdfee=trim($stdfee); $query="select *from students" ; $result=mysql_query($query)or die(mysql_error()); while ($row=mysql_fetch_assoc($result)) { if ($row['id'] !=$id and $row['stdclass'] == $stdclass and $row['stdrollno'] == $stdrollno) { $msg='Record could Not Updated Record Already Exist'; header('location:std_update.php?msg=Roll Number And Class Already Exist'); exit(); } } $query="UPDATE students SET stdname='$stdname', stdrollno='$stdrollno', stdfname='$stdfname', stdclass='$stdclass', stdcell='$stdcell', stddob='$stddob', stdaddress='$stdaddress', stdfee='$stdfee', class_id='$stdclass' where id='$id'"; mysql_query($query); mysql_query($query) or die(mysql_error()); if ($query) { $msg="Record Updates SuccessFully"; header('location:students.php?'.$msg); } else { $msg=" Record Not Updated"; header('location:std_update.php?'.$msg); } } ?> ?>
  14. Bro its not Case sensitive so there is problem something else
  15. Hi Guys Help ma in this Query 1st part is Working Fine but When i enter name it doesnt work i have 3 names in Database 1.Jason 2.Rooni 3.Jacob when i Press Jason it doesnt Give me result but when i Press just N its shows me 2 result if ($_REQUEST['search']) { $txt = addslashes($_REQUEST['search']); $query="select * from students WHERE stdrollno='$txt' OR stdname LIKE ('{$txt}%') "; $result = mysql_query($query); } And help me to understand these Lines some 1 make for me this lines but unable to get these lines if ($result) { $class_qry = "select * from classes "; $class_res = mysql_query($class_qry) or die(mysql_error()); if ($class_res) { while ($class = mysql_fetch_assoc($class_res)) { $class_list[$class['id']] = $class['name'];// This line i cant get All other Got what is actually happneing here } } } while ($row=mysql_fetch_assoc($result)) { ?> <tr> <td> <?php echo $row['stdname'];?> </td> <td> <?php echo $row['stdrollno'];?> </td> <td> <?php echo $row['stdfname'];?> </td> <td> <?php echo $class_list[$row['stdclass']];?> </td>// This Line too What is mean of that....... <td> <?php echo $row['stdcell'];?> </td> <td> <?php echo $row['stddob'];?> </td> <td> <?php echo $row['stdaddress'];?> </td> <td> <?php echo $row['stdfee'];?> </td> <td> <a href="std_update.php?student_id=<?php echo $row['sn'];?> ">Update</a> | <a href="std_delete.php?student_id=<?php echo $row['sn'];?>" onclick="return confirm('Do you really want to delete this student?');">Delete</a>| <a href="std_view.php?student_id=<?php echo $row['sn']; ?>">View</a> </td> </tr>
×
×
  • 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.