Jump to content
Old threads will finally start getting archived ×
🚨🚨 GAME-CHANGING ANNOUNCEMENT FROM PHP FREAKS 🚨🚨 ×

Copilot 🤖

Members
  • Posts

    28
  • Joined

  • Last visited

Everything posted by Copilot 🤖

  1. can you help me with this one guys?? tnx.. <?php include("../../config/db.php"); $tableName="leave"; $targetpage ="index.php"; $limit = 10; $page = mysql_real_escape_string($_GET['page']); if($page){ $start = ($page - 1) * $limit; }else{ $start = 0; } $query = "SELECT COUNT(*) as num FROM $tableName "; $query1 = "SELECT * FROM $tableName ORDER BY l_id ASC LIMIT $start, $limit"; $total_pages = mysql_fetch_array(mysql_query($query)); $total_pages = $total_pages[num]; $stages = 3; // Get page data $result = mysql_query($query1) or die(mysql_error()); // Initial page num setup if ($page == 0){$page = 1;} $prev = $page - 1; $next = $page + 1; $lastpage = ceil($total_pages/$limit); $LastPagem1 = $lastpage - 1; ?> <table frame='box' rules='rows' align='center' width='100%' cellpadding="10px"> <tr bgcolor="#E8E7DA" style="border-width:5px;border-style:ridge;"> <th width='30px'></th> <th>L_id</th> <th>Type of Leave</th> <th>Date of Leave</th> <th>Name</th> <th>Position</th> <th>Year Hired</th> <th>Kind of Leave</th> <th>Reason</th> <th>Date Approval</th> <th width='30px'></th> </tr> <?php while($rows = mysql_fetch_array($result)) { $id = $rows['l_id']; $type = $rows['type_leave']; $d_leave = $rows['date_leave']; $name = $rows['name']; $position = $rows['position']; $year = $rows['year_hired']; $kind = $rows['kind_leave']; $reason = $rows['reason']; $approval = $rows['date_approval']; echo " <tr> <td><a href='edit_form.php?l_id=".$id."' style='color:red;font-size:11px;' onclick='return edit()'> EDIT</a></td> <td> ".$id."</td> <td> ".$type."</td> <td> ".$d_leave."</td> <td> ".$name."</td> <td> ".$position."</td> <td> ".$year."</td> <td> ".$kind."</td> <td> ".$reason."</td> <td> ".$approval."</td> <td><a href='delete.php?l_id=".$id."' style='color:red;font-size:11px;' onclick='return del()'>DELETE </a></td> </tr> "; } ?>
  2. I've check all the values but still it is unable to update mysql data.. help pls.. thanks a bunch.. mysql_query("UPDATE warranty SET date_purchased_month ='$month', date_purchased_day ='$day', date_purchased_year ='$year', full_name ='$fullname', address ='$address', city ='$city', email ='$email', gender ='$gender', age_group ='$agegroup', model ='$model', lens ='$lens', frame ='$frame', price_paid ='$ppaid', how_did_you_hear ='$how', where_did_you_buy ='$where', performance ='$performance', value ='$value', quality ='$quality', suggestions ='$suggestions' WHERE warranty_id ='$id'")or die(mysql_error("Unable to edit");
  3. <select name="lens"> <option value="Amber">Amber</option> <option value="Copper">Copper</option> <option value="Yellow">Yellow</option> <option value="Gray">Gray</option> <option value='Blue'>Blue Mirror</option> </select> <font size="2"> Frame: </font> <select name="frame"> <option value='Black'>Black</option> <option value='Sand'>Sand</option> <option value='Tortoise'>Tortoise</option> </select> i am trying to create two drop down menus: in blue mirror, the only available frame is black, how can i make in into a conditional statement wherein once you choose blue mirror the only option that will appear for frame is Black?? help me with this guys.. thanks.
  4. thanks.. it's already fix..
  5. can u help me with this guys?? tnx.. $category = $_GET['category']; $search = $_GET['search']; $tableName="warranty"; $targetpage = "search.php"; $limit = 10; $page = mysql_real_escape_string($_GET['page']); if($page) { $start = ($page - 1) * $limit; } else { $start = 0; } if($category == 'id') { $query = "SELECT COUNT(*) as num FROM $tableName WHERE warranty_id = '$search'"; $query1 = "SELECT * FROM $tableName WHERE warranty_id = '$search' ORDER BY warranty_id ASC LIMIT $start, $limit"; } else if($category == 'name') { $query = "SELECT COUNT(*) as num FROM $tableName WHERE full_name = '$search'"; $query1 = "SELECT * FROM $tableName WHERE full_name like '%$search%' ORDER BY warranty_id ASC LIMIT $start, $limit"; } else { $query = "SELECT COUNT(*) as num FROM $tableName "; $query1 = "SELECT * FROM $tableName ORDER BY warranty ASC LIMIT $start, $limit"; } $total_pages = mysql_fetch_array(mysql_query($query)); $total_pages = $total_pages[num]; $stages = 3; // Get page data $result = mysql_query($query1); // Initial page num setup if ($page == 0){$page = 1;} $prev = $page - 1; $next = $page + 1; $lastpage = ceil($total_pages/$limit); $LastPagem1 = $lastpage - 1; ?> <?php $row_count = mysql_num_rows($result); if($row_count == 0 ) { echo " <tr> <td colspan='12' align='center'>No <font color='red'><b>'$search'</b></font> found. </td> </tr> "; } else { while($rows = mysql_fetch_array($result)) { $id = $rows['warranty_id']; $month = $rows['date_purchased_month']; $year = $rows['date_purchased_year']; $day = $rows['date_purchased_day']; $fullname = $rows['full_name']; $address = $rows['address']; $city = $rows['city']; $email = $rows['email']; $gender = $rows['gender']; $agegroup = $rows['age_group']; $model = $rows['model']; $lens = $rows['lens']; $frame = $rows['frame']; $ppaid = $rows['price_paid']; $how = $rows['how_did_you_hear']; $where = $rows['where_did_you_buy']; $performance= $rows['performance']; $value = $rows['value']; $quality = $rows['quality']; $suggestions= $rows['suggestions']; $date_activation=$rows['date_of_activation']; echo " <tr> <td><a href='/warranty/edit/?warranty_id=".$id."' onclick='return edit()'> EDIT</a></td> <td> ".$id."</td> <td> ".$month."</td> <td> ".$day."</td> <td> ".$year."</td> <td> ".$fullname."</td> <td> ".$address."</td> <td> ".$city."</td> <td> ".$email."</td> <td> ".$gender."</td> <td> ".$agegroup."</td> <td> ".$model."</td> <td> ".$lens."</td> <td> ".$frame."</td> <td> ".$ppaid."</td> <td> ".$how."</td> <td> ".$where."</td> <td> ".$performance."</td> <td> ".$value."</td> <td> ".$quality."</td> <td> ".$suggestions."</td> <td> ".$date_activation." </td> <td><a href='/quotations/delete/?warranty_id=".$id."' style='color:red' onclick='return del()'>DELETE </a></td> </tr> "; } } ?>
  6. wat if i'm going to insert this on mysql using codings on php.. ("INSERT INTO register( first_name, last_name, address, specialization, gender, birthday, contact_num, email_add, password ) VALUES( '$first', '$last', '$add', '$options', '$gender', '$birthdate', '$contact', '$email', '$pass'
  7. I have just installed WAMP earlier.. The setup went well and localhost seems to work, but when I try to access my webpage I get this error: "Forbidden You don't have permission to access/ on this server." Why do I get this permission access error with wamp? Are there tutorials/guides that would explain this problem? I am using Windows 7 home premium 32 can help me guys? thanks.
  8. here is the problem sir, when i was uploading an image it appears in the sql as null, meaning it wasn't able to get the value of photo.
  9. can u locate the error? thanks.. itcouldn't able to save photos on sql.. <?php if(isset($_POST['submit'])) { $title = $_POST['title']; $details = $_POST['details']; $month = $_POST['Month']; $day= $_POST['Day']; $year= $_POST['Year']; $date= "$month $day,$year"; $image=$_POST['image']; if(!empty($_FILES['image']['name'])) { $fileName = $_FILES['image']['name']; $tmpName = $_FILES['image']['tmp_name']; $fileSize = $_FILES['image']['size']; $fileType = $_FILES['image']['type']; $fp = fopen($tmpName, 'r'); $content = fread($fp, filesize($tmpName)); $content = addslashes($content); fclose($fp); if(!get_magic_quotes_gpc()) { $fileName = addslashes($fileName); } } else { $content = "NULL"; $fileName = "NULL"; $fileType = "NULL"; } } mysql_query ("INSERT INTO newsandevents( date, details, title, photo, photo_name, photo_file_type ) VALUES( '$date', '$details', '$title' , '$content', '$fileName', '$fileType')") or die(mysql_error()); header('location:../News2.php'); print '<script type="text/javascript">'; print 'alert("Successfully added!")'; print '</script>'; ?>
  10. i think my looping statement is correct but how come that I'm encountering such error. <?php session_start(); include("../config/db.php"); if(isset($_POST['log-in'])) { $email =$_POST['email_add']; $pass =$_POST['password']; $password = mysql_real_escape_string($pass); $email_ = mysql_real_escape_string($email); $result=mysql_query("Select * from register where email_add='$email' and password='$pass'")or die(mysql_error()); $user=mysql_num_rows($result); if ($user == 0 ) { echo "Invalid username or password"; } else if($user==1) { while($rows(mysql_fetch_array($result)) { $id =$rows['reg_id']; $email =$rows['email_add']; $pass =$rows['password']; $_SESSION['reg_id'] =$id; $_SESSION['email_add'] = $email; $_SESSION['password'] =$pass; header('location:index.php'); } } else { echo "Error!"; } } ?>
  11. yes, i do have.. it's mail.genasiabiotech.com, i've already put this in my smtp still, it didn't work out
  12. i change the smtp into "localhost" together with its smtp_port.. still it didn't work.
  13. $message= "$first <br /> $last <br /> $pass <p>Your email address will serve as your username.</p> <p>Thank You!</p>"; echo"$message"; $send_to= $email; $subject= "Register"; $headers .= 'From: '.$email.'' . "\r\n"; $headers .= "Reply-To: [email][email protected][/email]\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; $headers .= "Content-Transfer-Encoding: 8bit;\r\n\r\n"; $headers .= stripslashes($input); $headers .= "\r\n"; mail($email,$subject,$message,$headers); here is my php.ini settings [mail function] ; For Win32 only. ; http://php.net/smtp SMTP = [email protected] ; http://php.net/smtp-port smtp_port = 26 ; For Win32 only. ; http://php.net/sendmail-from sendmail_from = [email protected]
  14. i couldn't find any errors on it.. <?php include ("../config/db.php"); $first = $_POST['first_name']; $last = $_POST['last_name']; $add = $_POST['address']; $age = $_POST['age']; $gender = $_POST['gender']; $contact = $_POST['contact_num']; $email = $_POST['email_add']; $pass = $_POST['password']; $month = $_POST['Month']; $day = $_POST['Day']; $year = $_POST['Year']; $birthdate = "$month $day, $year"; $full = "$first $last"; #############---------INSERT DATA-------############ mysql_query ("INSERT INTO register( first_name, last_name, address, age, gender, birthday, contact_num, email_add, password ) VALUES( '$first', '$last', '$add', '$age', '$gender', '$birthdate' '$contact' '$email', '$pass' )")or die(mysql_error()); ##########------------SEND MAIL----------------############ $message= "$first <br /> $last <br /> $pass <p>Your email address will serve as your username.</p> <p>Thank You!</p>"; echo"$message"; $send_to= $email; $subject= "Register"; $headers .= 'From: '.$email.'' . "\r\n"; $headers .= "Reply-To: [email][email protected][/email]\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; $headers .= "Content-Transfer-Encoding: 8bit;\r\n\r\n"; $headers .= stripslashes($input); $headers .= "\r\n"; mail($email,$subject,$message,$headers); ?>
  15. i've already remove that "cdv" while executing the code.. still the error appears like that..
  16. i'm asking for help. Someone told me to post the whole code and i forgot to put some comment on it.
  17. i've already remove that "cdv" while executing the code.. still the error appears like that..
  18. <?php include('../config/db.php'); if(isset($_POST['submit'])) { $title = $_POST['title']; $details = $_POST['details']; $date = $_POST['date_from']; $image = $_POST['image']; if(!empty($_FILES['image']['name'])) { $fileName = $_FILES['image']['name']; $tmpName = $_FILES['image']['tmp_name']; $fileSize = $_FILES['image']['size']; $fileType = $_FILES['image']['type']; $fp = fopen($tmpName, 'r'); $content = fread($fp, filesize($tmpName)); $content = addslashes($content); fclose($fp); if(!get_magic_quotes_gpc()) { $fileName = addslashes($fileName); } } else { $content = "NULL"; $fileName = "NULL"; $fileType = "NULL"; } cdv $date = date('Y-m-d', strtotime($date)); // outputs 2006-01-24 mysql_query("INSERT INTO newsandevents (date, details, title, photo, photo_name, photo_file_type) VALUES (''Now(), '$ddetails', '$title' ,'$content', '$fileName', '$fileType')") or die(mysql_error()); header('location:News.php'); } print '<script type="text/javascript">'; print 'alert("Successfully added!")'; print '</script>'; ?>
  19. here is the full code.. tnx <?php if(isset($_POST['submit'])) { $event_name = $_POST['event_name']; $event_details = $_POST['details']; $event_date = $_POST['date_from']; $event_image = $_POST['event_image']; if(!empty($_FILES['event_image']['name'])) { $fileName = $_FILES['event_image']['name']; $tmpName = $_FILES['event_image']['tmp_name']; $fileSize = $_FILES['event_image']['size']; $fileType = $_FILES['event_image']['type']; $fp = fopen($tmpName, 'r'); $content = fread($fp, filesize($tmpName)); $content = addslashes($content); fclose($fp); if(!get_magic_quotes_gpc()) { $fileName = addslashes($fileName); } } else { $content = "NULL"; $fileName = "NULL"; $fileType = "NULL"; } cdv $event_date = date('M d, Y', strtotime($event_date)); // outputs 2006-01-24 mysql_query("INSERT INTO events (event_name, event_details, event_date, photo, photo_name, photo_file_type) VALUES('$event_name', '$event_details', '$event_date', '$content', '$fileName', '$fileType') ") or die(mysql_error()); echo "<span class='approved_msg'>Your New Event Has Been Posted.</span>"; header("refresh: 2; url=../index.php"); } ?>
  20. $event_date = date('Y-m-d', strtotime($event_date)); Any suggestion guys??tnx..
  21. <?php include('../config/db.php') if(isset($_POST['submit'])) { $title = $_POST['title']; $details = $_POST['details']; $date = $_POST['date_from']; $image = $_POST['image']; if(!empty($_FILES['image']['name'])) { $fileName = $_FILES['image']['name']; $tmpName = $_FILES['image']['tmp_name']; $fileSize = $_FILES['image']['size']; $fileType = $_FILES['image']['type']; $fp = fopen($tmpName, 'r'); $content = fread($fp, filesize($tmpName)); $content = addslashes($content); fclose($fp); if(!get_magic_quotes_gpc()) { $fileName = addslashes($fileName); } } else { $content = "NULL"; $fileName = "NULL"; $fileType = "NULL"; } cdv $date = date('Y-m-d', strtotime($date)); // outputs 2006-01-24 mysql_query("INSERT INTO newsandevents (date, details, title, photo, photo_name, photo_file_type) VALUES (''Now(), '$ddetails', '$title' ,'$content', '$fileName', '$fileType')") or die(mysql_error()); header('location:News.php'); } print '<script type="text/javascript">'; print 'alert("Successfully added!")'; print '</script>'; ?> thanks..
  22. can someone help me with this one Parse error:syntax error,unexpected 'or' (T_LOGICAL_OR) in config/db.php on line 2 here is my code.. tnx <?php $db=@mysql_connect('localhost', 'root', '')or die (mysql_error()); mysql_query("SET NAMES 'utf8'"); @mysql_select_db('ozlo',$db)or die (mysql_error()); ?>
×
×
  • 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.