PHP - Fatal Error: Uncaught Exception 'pdoexception' With Message 'sqlstate[42000]: Syntax Error Or Access Violation: 1064 You Have An Error In Your Sql Syn
Hello all,
Appreciate if you folks could pls. help me understand (and more importantly resolve) this very weird error:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 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 'ASC, purchase_later_flag ASC, shopper1_buy_flag AS' at line 3' in /var/www/index.php:67 Stack trace: #0 /var/www/index.php(67): PDO->query('SELECT shoplist...') #1 {main} thrown in /var/www/index.php on line 67
Everything seems to work fine when/if I use the following SQL query (which can also be seen commented out in my code towards the end of this post) :
$sql = "SELECT shoplist.*, store_master.store_name, item_master.item_name FROM shoplist, store_master, item_master WHERE shoplist.store_id = store_master.store_id AND shoplist.item_id = item_master.item_id";However, the moment I change my query to the following, which essentially just includes/adds the ORDER BY clause, I receive the error quoted above: $sql = "SELECT shoplist.*, store_master.store_name, item_master.item_name FROM shoplist, store_master, item_master ORDER BY purchased_flag ASC, purchase_later_flag ASC, shopper1_buy_flag ASC, shopper2_buy_flag ASC, store_name ASC) WHERE shoplist.store_id = store_master.store_id AND shoplist.item_id = item_master.item_id";In googling for this error I came across posts that suggested using "ORDER BY FIND_IN_SET()" and "ORDER BY FIELD()"...both of which I tried with no success. Here's the portion of my code which seems to have a problem, and line # 67 is the 3rd from bottom (third last) statement in the code below: <?php /* $sql = "SELECT shoplist.*, store_master.store_name, item_master.item_name FROM shoplist, store_master, item_master WHERE shoplist.store_id = store_master.store_id AND shoplist.item_id = item_master.item_id"; */ $sql = "SELECT shoplist.*, store_master.store_name, item_master.item_name FROM shoplist, store_master, item_master ORDER BY FIND_IN_SET(purchased_flag ASC, purchase_later_flag ASC, shopper1_buy_flag ASC, shopper2_buy_flag ASC, store_name ASC) WHERE shoplist.store_id = store_master.store_id AND shoplist.item_id = item_master.item_id"; $result = $pdo->query($sql); // foreach ($pdo->query($sql) as $row) { foreach ($result as $row) { echo '<tr>'; print '<td><span class="filler-checkbox"><input type="checkbox" name="IDnumber[]" value="' . $row["idnumber"] . '" /></span></td>';Thanks Similar TutorialsI have a pdo prepared statement that fetches records from mysql database. The records show up on the page. However if there are no records on a page, I get this error message.
"QLSTATE[42000]: Syntax error or access violation: 1064 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 '-10' at line 4"
Here is my statement
$getCategoryId = $_GET['id']; $limit = 10; $offset = ($page - 1) * $limit; $statement = $db->prepare("SELECT records.*, categories.* FROM records LEFT JOIN categories ON records.category_id = categories.category_id WHERE records.category_id = :category_id ORDER BY record_id DESC LIMIT {$limit} OFFSET ".$offset); $statement->bindParam('category_id', $getCategoryId); $statement->execute(); $results = $statement->fetchAll(PDO::FETCH_ASSOC);If I remove try and catch block, it'll tell me exactly which line is giving the issue. So from the above code, the error has to do with "$statement->execute();". This is where the error occurs. As far as I know, the above pdo statement is correct. Can you tell me if something is wrong with it? Edited by helloworld001, 16 December 2014 - 04:14 PM. In drive.php
public function insert($postBody, $optParams = array()) Gett an error from some custom code I inherited in a WordPress installation. Here is the error... Code: [Select] Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct() [<a href='datetime.--construct'>datetime.--construct</a>]: Failed to parse time string (--) at position 0 (-): Unexpected character' in /home2/history8/public_html/bee/wp-content/themes/makinghistoryblue/beeteachers.php:27 Stack trace: #0 /home2/history8/public_html/bee/wp-content/themes/makinghistoryblue/beeteachers.php(27): DateTime->__construct('--') #1 /home2/history8/public_html/bee/wp-includes/plugin.php(395): bee_teachers('') #2 /home2/history8/public_html/bee/wp-admin/admin.php(151): do_action('bee_teachers', Array) #3 {main} thrown in /home2/history8/public_html/bee/wp-content/themes/makinghistoryblue/beeteachers.php on line 27 Here is the code... Code: [Select] <?php $teachers = $wpdb->get_results("SELECT * FROM bee_teachers,bee_postmeta WHERE bee_teachers.statebee=bee_postmeta.post_id and meta_key='regional_date' ORDER BY meta_value ASC"); $today = new DateTime(); foreach ($teachers as $teacher): $site = get_post($teacher->statebee)->post_title; $date = new DateTime($teacher->meta_value); // this is line 27, mentioned in the error if($date<$today) $style=' style="color:#999"'; else $style=''; ?> If I remm out these lines, the query works, just no styling difference based upon date... Code: [Select] $date = new DateTime($teacher->meta_value); // this is line 27, mentioned in the error if($date<$today) $style=' style="color:#999"'; else $style=''; Thoughts? Hello , I have a made a PHP website where users signup and send their Date of Birth and gets an OTP on their email after signup. The OTP is recieved but when we enter the OTP this problem occurs QuoteError! Something went wrong and I am facing this error in the error log QuotePHP Fatal error: Uncaught Error: Object of class DateTime could not be converted to string This is my config.php code <?php session_start(); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Confirmation Page - Kanha Stories</title> <style> body { background-color: #330000; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='100%25' viewBox='0 0 800 400'%3E%3Cdefs%3E%3CradialGradient id='a' cx='396' cy='281' r='514' gradientUnits='userSpaceOnUse'%3E%3Cstop offset='0' stop-color='%23D18'/%3E%3Cstop offset='1' stop-color='%23330000'/%3E%3C/radialGradient%3E%3ClinearGradient id='b' gradientUnits='userSpaceOnUse' x1='400' y1='148' x2='400' y2='333'%3E%3Cstop offset='0' stop-color='%23FA3' stop-opacity='0'/%3E%3Cstop offset='1' stop-color='%23FA3' stop-opacity='0.5'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect fill='url(%23a)' width='800' height='400'/%3E%3Cg fill-opacity='0.4'%3E%3Ccircle fill='url(%23b)' cx='267.5' cy='61' r='300'/%3E%3Ccircle fill='url(%23b)' cx='532.5' cy='61' r='300'/%3E%3Ccircle fill='url(%23b)' cx='400' cy='30' r='300'/%3E%3C/g%3E%3C/svg%3E"); background-attachment: fixed; background-size: cover; padding: 20px; width: 100vw; height: 100vh; display: flex; align-items: center; justify-content: center; color:#ffffff; overflow-x: hidden; } .cont { padding: 20px 40px; position: relative; border-right: 4px solid rgb(184, 182, 182); border-bottom: 4px solid rgb(184, 182, 182); border-radius: 15px; display: flex; flex-direction: column; align-items: center; } #left{ float: left; } #right{ float: right; } input{ margin: 10px 0px; } s{ padding: 5px; } .error{ padding: 5px; color: #ffffff; } .resend{ color: rgb(14, 14, 196); padding: 5px; } .s:hover{ cursor: pointer; background-color:gray; color: rgb(243, 237, 237); border-radius: 5px; } </style> </head> <body> <?php $code=""; $err=""; $error=""; if(($_SERVER["REQUEST_METHOD"]=="GET" && $_SESSION['xyz'] === 'xyz') || isset($_POST['verify']) || isset($_POST['resend'])) { unset($_SESSION["xyz"]); if($_SERVER["REQUEST_METHOD"] ==="POST") { if(isset($_POST['verify'])) { if(empty($_POST['code'])) { $err="Enter the code!"; } else { $code=$_POST['code']; if(password_verify($code,$_SESSION['code'])) { $name=$_SESSION['name']; $email=$_SESSION['email']; $tel=$_SESSION['tel']; $dob=$_SESSION['dob']; $password=$_SESSION['password']; $age_category=$_SESSION['age_category']; require_once('./all_utils/connection.php'); $sql="INSERT INTO identity_table(name,email,password,tel,dob,age_category) VALUES ('$name','$email','".$password."','$tel','$dob','$age_category')"; if(mysqli_query($conn,$sql) === TRUE) { unset($_SESSION["name"]); unset($_SESSION["password"]); unset($_SESSION["dob"]); unset($_SESSION["tel"]); unset($_SESSION["age_category"]); header("location:welcome/welcome.php"); } else { $err="Error! Something went wrong"; } } else { $err="Incorrect code!"; } } } elseif(isset($_POST['resend'])) { require_once('./all_utils/mail.php'); $error="OTP has been sent again!"; } } } else{ header("location:signup.php"); } ?> <div class="cont"> <h2> Email Verification</h2> <form action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) ?>" method="POST"> <label for="verification">Enter the 5 digit code</label> <br/> <p> Didn't got the mail? Please check your spam folder </p> <input type="text" name="code" placeholder="Eg. 12345" value="<?php echo $code; ?>"> <br/> <div class="error"><?php echo $err; ?></div> <div class="resend"><?php echo $error;?></div> <input type="submit" name="resend" class="s" id="left" value="Resend OTP"> <input type="submit" name="verify" class="s" id="right" value="Verify"> </form> </div> </body> </html>
This is my signup.php code <?php session_start(); if(!empty($_SESSION['email'])) { require_once('./all_utils/connection.php'); $query="SELECT * FROM identity_table WHERE email='".$_SESSION['email']."'"; $result=mysqli_query($conn,$query); if(mysqli_fetch_assoc($result)) { header("location:welcome/welcome.php"); } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>SignUp - Kanha Stories</title> <style> * { margin: 0; padding: 0; } body { width: 100vw; height: 100vh; display: flex; align-items: center; background-color: #ff9d00; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='100%25' viewBox='0 0 1600 800'%3E%3Cg stroke='%23000' stroke-width='66.7' stroke-opacity='0' %3E%3Ccircle fill='%23ff9d00' cx='0' cy='0' r='1800'/%3E%3Ccircle fill='%23f27d00' cx='0' cy='0' r='1700'/%3E%3Ccircle fill='%23e55f00' cx='0' cy='0' r='1600'/%3E%3Ccircle fill='%23d84400' cx='0' cy='0' r='1500'/%3E%3Ccircle fill='%23cb2c00' cx='0' cy='0' r='1400'/%3E%3Ccircle fill='%23bf1600' cx='0' cy='0' r='1300'/%3E%3Ccircle fill='%23b20300' cx='0' cy='0' r='1200'/%3E%3Ccircle fill='%23a5000e' cx='0' cy='0' r='1100'/%3E%3Ccircle fill='%2398001c' cx='0' cy='0' r='1000'/%3E%3Ccircle fill='%238b0027' cx='0' cy='0' r='900'/%3E%3Ccircle fill='%237e0030' cx='0' cy='0' r='800'/%3E%3Ccircle fill='%23710037' cx='0' cy='0' r='700'/%3E%3Ccircle fill='%2364003b' cx='0' cy='0' r='600'/%3E%3Ccircle fill='%2358003c' cx='0' cy='0' r='500'/%3E%3Ccircle fill='%234b003a' cx='0' cy='0' r='400'/%3E%3Ccircle fill='%233e0037' cx='0' cy='0' r='300'/%3E%3Ccircle fill='%23310030' cx='0' cy='0' r='200'/%3E%3Ccircle fill='%23210024' cx='0' cy='0' r='100'/%3E%3C/g%3E%3C/svg%3E"); background-attachment: fixed; background-size: cover; overflow-x: hidden; } .cont { color: #ffffff; width: 500px; margin: auto; } h2 { color: #ffffff; text-align: center; padding: 1.5px; } .error { text-align: center; padding: 20px; font-size: 1rem; color: rgb(233, 76, 76); } form { font-size: 1.2rem; /* width: 40%; */ /* margin: auto; */ } .in{ margin: 5px 0; } input { border: 2px solid white; padding: 10px; margin: 5px 0; font-size: 1rem; width: 100%; } input:hover { border: 2px solid rgb(228, 81, 81); cursor: text; } p,a{ text-align: center; font-size: 1rem; } a{ color: deepskyblue; font-size:20px; } #s{ text-decoration:none; border-radius: 12px; } #s:hover { cursor: pointer; } a { text-decoration: none; } @media only screen and (max-width: 600px){ .cont{ width: 300px; } .error,input{ font-size: 0.8rem; } } @media only screen and (max-width: 400px){ .cont{ width: 70%; } h2{ font-size: 1.3rem; } a,p{ font-size: 0.7rem; } label{ font-size: 1.0rem; } input{ padding: 4px; } } </style> </head> <body> <?php $name=""; $email=""; $tel=""; $dob=""; $err=""; $name_err=""; $email_err=""; $tel_err=""; $dob_err=""; $password_err=""; if($_SERVER["REQUEST_METHOD"]=="POST") { if(isset($_POST['signup'])) { if(empty($_POST['name']) || empty($_POST['dob']) || empty($_POST['tel']) || empty($_POST['email']) || empty($_POST['password'])) { if(empty($_POST['name'])) { $name_err="Name is required!"; } else{ $name=$_POST['name']; } if(empty($_POST['email'])) { $email_err="Email is required!"; } else{ $email=$_POST['email']; } if(empty($_POST['tel'])) { $tel_err="Contact Number is required!"; } else{ $tel=$_POST['tel']; } if(empty($_POST['dob'])) { $dob_err="D.O.B is required!"; } else{ $dob=$_POST['dob']; } if(empty($_POST['password'])) { $password_err="Password is required!"; } } else { $today = new DateTime(date('m.d.y')); $dob = new DateTime($_POST['dob']); $diff1 = $today->diff($dob); $age = $diff1->y; if($age > 15 || $age <3) { $dob = $_POST['dob']; $dob_err = "Age criteria not satisfied , child's age must be between 3-15 years"; } else { require_once("./all_utils/connection.php"); $email=$_POST['email']; $query="SELECT * FROM identity_table WHERE email='".$email."'"; $result=mysqli_query($conn,$query); if(mysqli_fetch_assoc($result)) { $err="Email alredy registered!"; $name=$_POST['name']; $email=$_POST['email']; } else { if($age < 7) { $_SESSION['age_category'] = '1'; } else { $_SESSION['age_category'] = '2'; } $_SESSION['name']=$_POST['name']; $_SESSION['email']=$_POST['email']; $_SESSION['password'] = password_hash($_POST['password'],PASSWORD_DEFAULT); $_SESSION['tel']=$_POST['tel']; $_SESSION['dob']=$_POST['dob']; $_SESSION['xyz']='xyz'; require_once("all_utils/mail.php"); header("location:conf.php"); } } } } } ?> <div class="cont"> <h2>SignUp - Kanha Stories</h2> <form action="<?php echo htmlspecialchars($_SERVER['PHP_SELF'])?>" method="POST"> <span class="error"><?php echo $err; ?></span> <br/> <label for="name">Name</label><br /> <input type="text" name="name" placeholder="Enter your name" value="<?php echo $name; ?>"> <span class="error"><?php echo $name_err; ?></span> <br/> <label for="email">Email</label><br /> <input type="email" name="email" placeholder="Enter your Email ID" value="<?php echo $email; ?>"> <span class="error"><?php echo $email_err;?></span> <br/> <label for="tel">Mobile Number</label><br /> <input type="tel" name="tel" placeholder="Enter Mobile Number" value="<?php echo $tel; ?>"> <span class="error"><?php echo $tel_err;?></span> <br/> <label for="date">D.O.B. of Child (Click on Calander icon)</label><br /> <input type="date" name="dob" placeholder="Enter date of birth " value="<?php echo $dob;?>"> <span class="error"><?php echo $dob_err;?></span> <br/> <label for="password">Password</label><br /> <input type="password" name="password" placeholder="Enter your Password"> <span class="error"><?php echo $password_err; ?></span> <br/> <div class="sub"> <input type="submit" name="signup" id="s" placeholder="Submit"><br /> </div> </form> <p>Already registered? <a href="./login.php">log in here</a></p> </div> </body> </html>
I don't know what I can do now , Please try to give me the solutions as soon as possible. Thanks I closed everything down last night and it was all fine, website was working as normal etc, but I've turned on the Xxamp server today and I am getting this error. Seems very random as nothing has changed since it was last on? Does anyone know how to sort this out and why I'm now getting this error? Thanks! I have been pulling my hair out for the lasy 3 hours i am trying to update a MySql table but i cant get it too work, i just keep getting MySql error #1064 - You have an error in your SQL syntax; if i just update 1 field it works fine but if i try to update more than 1 field it dosent work, Help Please! <?php $root = $_SERVER['DOCUMENT_ROOT']; require("$root/include/mysqldb.php"); require("$root/include/incpost.php"); $con = mysql_connect("$dbhost","$dbuser","$dbpass"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("$dbame", $con); mysql_query("UPDATE Reg_Profile_p SET build='$build' col='$col' size='$size' WHERE uin = '$uinco'"); ?>
Hello everyone
In PHP Version 8.0 shows error as : In previous versions of PHP it does not show any error. Please resolve the issue. hello. i got this error and i have no idea why or what is going on. could someone explain in layman's term please and help me out.
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'event_id' cannot be null' in /home/dhsbnet/public_html/ems/add_guest.php:36 Stack trace: #0 /home/dhsbnet/public_html/ems/add_guest.php(36): PDOStatement->execute() #1 {main} thrown in /home/dhsbnet/public_html/ems/add_guest.php on line 36
code being referred to, line 36 is $guests->execute() :
if(isset($_SESSION['sess_user_id'])) { if(isset($_POST['save'])) { require "connection.php"; $name = $_POST['guest-name']; $event = $_POST['event']; $session = $_SESSION['sess_user_id']; $status = ""; $status .= "0"; $guests = $dbh->prepare("INSERT INTO guest(guser_id,guest_name,event_id,status) VALUES (?,?,?,?)"); for($i = 0; $i < count($_POST['guest-name']); $i++) { if(trim($_POST['guest-name'][$i]) !== '') { $guests->bindParam(1, $session, PDO::PARAM_INT); $guests->bindParam(2, $name[$i], PDO::PARAM_STR); $guests->bindParam(3, $event, PDO::PARAM_INT); $guests->bindParam(4, $status, PDO::PARAM_INT); $guests->execute(); if($guests->rowCount() > 0) { echo "<script>window.location.href = 'guest_list.php';</script>"; } } } } } <div class="dropdown"> <label>Event : <label/> <select name="event" id="dd-event" required> <option value="0" selected>Event</option> <?php foreach($retrieve as $r): ?> <option value="<?=$r['event_id']?>"><?=$r['event_name']?></option> <?php endforeach ?> </select> </div>in db event_id column is int, not null, not auto incremented. TIA! Folks,
I got this pagination without PREP STMT working ABSOLUTELY FINE:
<?php //Required PHP Files. include 'header_account.php'; //Required on all webpages of the Account. ?> <?php if (!$conn) { $error = mysqli_connect_error(); $errno = mysqli_connect_errno(); print "$errno: $error\n"; exit(); } //Grab Username of who's Browsing History needs to be searched. if (isset($_GET['followee_username']) && !empty($_GET['followee_username'])) { $followee_username = $_GET['followee_username']; if($followee_username != "followee_all" OR $followee_username != "Followee_All") { $query = "SELECT * FROM following_histories WHERE followee_username = \"$followee_username\""; $query_type = "followee_username"; $followed_word = "$followee_username"; $followee_username = "$followee_username"; echo "$followee_username"; } else { $query = "SELECT * FROM following_histories"; $query_type = "followee_all"; $followed_word = "followee_all"; echo "all"; } } if (isset($_GET['followee_id']) && !empty($_GET['followee_id'])) { $followee_id = $_GET['followee_id']; $query = "SELECT * FROM following_histories WHERE id = \"$followee_id\""; $query_type = "followee_id"; $followed_word = "$followee_id"; echo "$followee_id"; } if (isset($_GET['followee_date_and_time']) && !empty($_GET['followee_date_and_time'])) { $followee_date_and_time = $_GET['followee_date_and_time']; $query = "SELECT * FROM following_histories WHERE date_and_time = \"$followee_date_and_time\""; $query_type = "followee_date_and_time"; $followed_word = "$followee_date_and_time"; } if (isset($_GET['followee_followed_page_converted']) && !empty($_GET['followee_followed_page_converted'])) { $followee_followed_page_converted = $_GET['followee_followed_page_converted']; $query = "SELECT * FROM following_histories WHERE followed_page_converted = \"$followee_followed_page_converted\""; $query_type = "followee_followed_page_converted"; $followed_word = "$followee_followed_page_converted"; } if (isset($_GET['followee_referral_page_converted']) && !empty($_GET['followee_referral_page_converted'])) { $followee_referral_page_converted = $_GET['followee_referral_page_converted']; $query = "SELECT * FROM following_histories WHERE referral_page_converted = \"$followee_referral_page_converted\""; $query_type = "followee_referral_page_converted"; $followed_word = "$followee_referral_page_converted"; } if (isset($_GET['followee_gender']) && !empty($_GET['followee_gender'])) { $followee_gender = $_GET['followee_gender']; $query = "SELECT * FROM following_histories WHERE gender = \"$followee_gender\""; $query_type = "followee_gender"; $followed_word = "$followee_gender"; } if (isset($_GET['followee_age_range']) && !empty($_GET['followee_age_range'])) { $followee_age_range = $_GET['followee_age_range']; $query = "SELECT * FROM following_histories WHERE age_range = \"$followee_age_range\""; $query_type = "followee_age_range"; $followed_word = "$followee_age_range"; } if (isset($_GET['followee_date_of_birth']) && !empty($_GET['followee_date_of_birth'])) { $followee_date_of_birth = $_GET['followee_date_of_birth']; $query = "SELECT * FROM following_histories WHERE date_of_birth = \"$followee_date_of_birth\""; $query_type = "followee_date_of_birth"; $followed_word = "$followee_date_of_birth"; } if (isset($_GET['followee_skin_complexion']) && !empty($_GET['followee_skin_complexion'])) { $followee_skin_complexion = $_GET['followee_skin_complexion']; $query = "SELECT * FROM following_histories WHERE skin_complexion = \"$followee_skin_complexion\""; $query_type = "followee_skin_complexion"; $followed_word = "$followee_skin_complexion"; } if (isset($_GET['followee_height']) && !empty($_GET['followee_height'])) { $followee_height = $_GET['followee_height']; $query = "SELECT * FROM following_histories WHERE height = \"$followee_height\""; $query_type = "followee_height"; $followed_word = "$followee_height"; } if (isset($_GET['followee_weight']) && !empty($_GET['followee_weight'])) { $followee_weight = $_GET['followee_weight']; $query = "SELECT * FROM following_histories WHERE weight = \"$followee_weight\""; $query_type = "followee_weight"; $followed_word = "$followee_weight"; } if (isset($_GET['followee_sexual_orientation']) && !empty($_GET['followee_sexual_orientation'])) { $followee_sexual_orientation = $_GET['followee_sexual_orientation']; $query = "SELECT * FROM following_histories WHERE sexual_orientation = \"$followee_sexual_orientation\""; $query_type = "followee_sexual_orientation"; $followed_word = "$followee_sexual_orientation"; } if (isset($_GET['followee_religion']) && !empty($_GET['followee_religion'])) { $followee_religion = $_GET['followee_religion']; $query = "SELECT * FROM following_histories WHERE religion = \"$followee_religion\""; $query_type = "followee_religion"; $followed_word = "$followee_religion"; } if (isset($_GET['followee_education']) && !empty($_GET['followee_education'])) { $followee_education = $_GET['followee_education']; $query = "SELECT * FROM following_histories WHERE education = \"$followee_education\""; $query_type = "followee_education"; $followed_word = "$followee_education"; } if (isset($_GET['followee_profession']) && !empty($_GET['followee_profession'])) { $followee_profession = $_GET['followee_profession']; $query = "SELECT * FROM following_histories WHERE profession = \"$followee_profession\""; $query_type = "followee_profession"; $followed_word = "$followee_profession"; } if (isset($_GET['followee_marital_status']) && !empty($_GET['followee_marital_status'])) { $followee_marital_status = $_GET['followee_marital_status']; $query = "SELECT * FROM following_histories WHERE marital_status = \"$followee_marital_status\""; $query_type = "followee_marital_status"; $followed_word = "$followee_marital_status"; } if (isset($_GET['followee_working_status']) && !empty($_GET['followee_working_status'])) { $followee_working_status = $_GET['followee_working_status']; $query = "SELECT * FROM following_histories WHERE working_status = \"$followee_working_status\""; $query_type = "followee_working_status"; $followed_word = "$followee_working_status"; } if (isset($_GET['followee_country_of_birth']) && !empty($_GET['followee_country_of_birth'])) { $followee_country_of_birth = $_GET['followee_country_of_birth']; $query = "SELECT * FROM following_histories WHERE country_of_birth = \"$followee_country_of_birth\""; $query_type = "followee_country_of_birth"; $followed_word = "$followee_country_of_birth"; } if (isset($_GET['followee_home_town']) && !empty($_GET['followee_home_town'])) { $followee_home_town = $_GET['followee_home_town']; $query = "SELECT * FROM following_histories WHERE home_town = \"$followee_home_town\""; $query_type = "followee_home_town"; $followed_word = "$followee_home_town"; } if (isset($_GET['followee_home_neighbourhood']) && !empty($_GET['followee_home_neighbourhood'])) { $followee_home_neighbourhood = $_GET['followee_home_neighbourhood']; $query = "SELECT * FROM following_histories WHERE home_neighbourhood = \"$followee_home_neighbourhood\""; $query_type = "followee_home_neighbourhood"; $followed_word = "$followee_home_neighbourhood"; } if (isset($_GET['followee_home_borough']) && !empty($_GET['followee_home_borough'])) { $followee_home_borough = $_GET['followee_home_borough']; $query = "SELECT * FROM following_histories WHERE home_borough = \"$followee_home_borough\""; $query_type = "followee_home_borough"; $followed_word = "$followee_home_borough"; } if (isset($_GET['followee_home_city']) && !empty($_GET['followee_home_city'])) { $followee_home_city = $_GET['followee_home_city']; $query = "SELECT * FROM following_histories WHERE home_city = \"$followee_home_city\""; $query_type = "followee_home_city"; $followed_word = "$followee_home_city"; } if (isset($_GET['followee_home_county']) && !empty($_GET['followee_home_county'])) { $followee_home_county = $_GET['followee_home_county']; $query = "SELECT * FROM following_histories WHERE home_county = \"$followee_home_county\""; $query_type = "followee_home_county"; $followed_word = "$followee_home_county"; } if (isset($_GET['followee_home_district']) && !empty($_GET['followee_home_district'])) { $followee_home_district = $_GET['followee_home_district']; $query = "SELECT * FROM following_histories WHERE home_district = \"$followee_home_district\""; $query_type = "followee_home_district"; $followed_word = "$followee_home_district"; } if (isset($_GET['followee_home_region']) && !empty($_GET['followee_home_region'])) { $followee_home_region = $_GET['followee_home_region']; $query = "SELECT * FROM following_histories WHERE home_region = \"$followee_home_region\""; $query_type = "followee_home_region"; $followed_word = "$followee_home_region"; } if (isset($_GET['followee_home_state']) && !empty($_GET['followee_home_state'])) { $followee_home_state = $_GET['followee_home_state']; $query = "SELECT * FROM following_histories WHERE home_state = \"$followee_home_state\""; $query_type = "followee_home_state"; $followed_word = "$followee_home_state"; } if (isset($_GET['followee_home_country']) && !empty($_GET['followee_home_country'])) { $followee_home_country = $_GET['followee_home_country']; $query = "SELECT * FROM following_histories WHERE home_country = \"$followee_home_country\""; $query_type = "followee_home_country"; $followed_word = "$followee_home_country"; } $referral_page_http = $_SERVER['HTTP_REFERRER']; $referral_page = "$referral_page_http"; $referral_page_original = "$referral_page"; $query_string = $_SERVER['QUERY_STRING']; $current_page_http = $_SERVER['PHP_SELF']; $current_page = "$current_page_http"; $followed_page_original = "$current_page"; $visiting_pages_count = "1"; if($visiting_pages_count == "") { $visiting_pages_count = "1"; } else { $visiting_pages_count++; } if($visiting_pages_count == "1") { $current_page_converted = "$settings_user_first_quick_link.$current_page"; $referral_page_converted = "$settings_user_first_quick_link.$referral_page"; } elseif($visiting_pages_count == "2") { $current_page_converted = "$settings_admin_second_quick_link.$current_page"; $referral_page_converted = "$settings_admin_second_quick_link.$referral_page"; } elseif($visiting_pages_count == "3") { $current_page_converted = "$settings_user_third_quick_link.$current_page"; $referral_page_converted = "$settings_user_third_quick_link.$referral_page"; } elseif($visiting_pages_count == "4") { $current_page_converted = "$settings_admin_fourth_quick_link.$current_page"; $referral_page_converted = "$settings_admin_fourth_quick_link.$referral_page"; } elseif($visiting_pages_count == "5") { $current_page_converted = "$settings_user_fifth_quick_link.$current_page"; $referral_page_converted = "$settings_user_fifth_quick_link.$referral_page"; } if($visiting_pages_count == "6") { $current_page_converted = "$settings_admin_first_quick_link.$current_page"; $referral_page_converted = "$settings_admin_first_quick_link.$referral_page"; } elseif($visiting_pages_count == "7") { $current_page_converted = "$settings_user_second_quick_link.$current_page"; $referral_page_converted = "$settings_user_second_quick_link.$referral_page"; } elseif($visiting_pages_count == "8") { $current_page_converted = "$settings_admin_third_quick_link.$current_page"; $referral_page_converted = "$settings_admin_third_quick_link.$referral_page"; } elseif($visiting_pages_count == "9") { $current_page_converted = "$settings_user_fourth_quick_link.$current_page"; $referral_page_converted = "$settings_user_fourth_quick_link.$referral_page"; } elseif($visiting_pages_count == "10") { $current_page_converted = "$settings_admin_fifth_quick_link.$current_page"; $referral_page_converted = "$settings_admin_fifth_quick_link.$referral_page"; } else { $visiting_pages_count = "1"; $current_page_converted = "$settings_user_first_quick_link.$current_page"; $referral_page_converted = "$settings_user_first_quick_link.$referral_page"; } $followed_page_converted = "$current_page_converted"; $follower_username = $user; $follower_browser = $_SERVER['HTTP_USER_AGENT']; //Insert the User's Click Logs into Mysql Database using Php's Sql Injection Prevention Method "Prepared Statements". $stmt = mysqli_prepare($conn,"INSERT INTO following_histories(query_type,followed_word,query_string,followed_page_original,followed_page_converted,referral_page_original,referral_page_converted,followee_username,follower_username,gender,age_range,date_of_birth,skin_complexion,height,weight,sexual_orientation,religion,education,profession,marital_status,working_status,home_town,home_neighbourhood,home_borough,home_council,home_city,home_county,home_district,home_region,home_state,home_country) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); mysqli_stmt_bind_param($stmt,'ssssssssssiisssssssssssssssssss',$query_type,$followed_word,$query_string,$followed_page_original,$followed_page_converted,$referral_page_original,$referral_page_converted,$followee_username,$follower_username,$gender,$age_range,$date_of_birth,$skin_complexion,$height,$weight,$sexual_orientation,$religion,$education,$profession,$marital_status,$working_status,$home_town,$home_neighbourhood,$home_borough,$home_council,$home_city,$home_county,$home_district,$home_region,$home_state,$home_country); mysqli_stmt_execute($stmt); //Check if User's Click Logs have been successfully submitted or not. if (!$stmt) { echo "Sorry! Our system is currently experiencing a problem logging your following! We will continuously try logging your clicks!"; exit(); } else { mysqli_stmt_fetch($stmt); mysqli_stmt_close($stmt); } $query_type_label = str_replace("_"," ","$query_type"); //Removing underscores so they don't show-up on the html. $query_type_label = ucwords("$query_type_label"); //Upper Casing the first characters. ?> <!DOCTYPE html> <html> <head> <meta content="text/html; charset=ISO-8859-1" http-equiv=" content-type"> <title><?php echo "Browsing History in $server_time Time.";?></title> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <body> <br> <p align="center"><span style="font-weight:bold;"><?php echo "Search Result for:<br> $query_type_label = \"${$query_type}\""; ?></span></p> <br> <br> <?php $result = mysqli_query($conn,$query); $rows_num = mysqli_num_rows($result); //Total Number of Pages records are spread-over. $page_count = 100; $page_size = ceil($rows_num / $page_count); //Get the Page Number. Default is 1 (First Page). $page_number = $_GET["page_number"]; if ($page_number == "") $page_number = 1; $offset = ($page_number -1) * $page_size; $query .= " limit {$offset},{$page_size}"; $result = mysqli_query($conn,$query); ?> <table width="1500" border="0" cellpadding="5" cellspacing="2" bgcolor="#666666"> <?php if($rows_num) { printf("<b> %d Result Found ...</b>\n",$rows_num); ?><br> <br> <tr name="headings"> <td bgcolor="#FFFFFF" name="column-heading_submission-number">Submission Number</td> <td bgcolor="#FFFFFF" name="column-heading_logging-server-date-and-time">Date & Time in <?php echo "$server_time";?></td> <td bgcolor="#FFFFFF" name="column-heading_browsed-page-converted">Browsed Page Converted (Visit Page) </td> <td bgcolor="#FFFFFF" name="column-heading_browsed-page-converted">Browsed Page Converted (Check Stats) </td> <td bgcolor="#FFFFFF" name="column-heading_referral-page-converted">Referral Page Converted (Visit Page) </td> <td bgcolor="#FFFFFF" name="column-heading_referral-page-converted">Referral Page Converted (Check Stats) </td> <td bgcolor="#FFFFFF" name="column-heading_username">Followee Username (Visit Page)</td> <td bgcolor="#FFFFFF" name="column-heading_username">Followee Username (Check Stats)</td> <td bgcolor="#FFFFFF" name="column-heading_username">Follower Username (Visit Page)</td> <td bgcolor="#FFFFFF" name="column-heading_username">Follower Username (Check Stats)</td> <td bgcolor="#FFFFFF" name="column-heading_gender">Gender</td> <td bgcolor="#FFFFFF" name="column-heading_age-range">Age Range</td> <td bgcolor="#FFFFFF" name="column-heading_date-of-birth">Date Of Birth</td> <td bgcolor="#FFFFFF" name="column-heading_skin-complexion">Skin Complexion</td> <td bgcolor="#FFFFFF" name="column-heading_height">Height</td> <td bgcolor="#FFFFFF" name="column-heading_weight">Weight</td> <td bgcolor="#FFFFFF" name="column-heading_sexual-orientation">Sexual Orientation</td> <td bgcolor="#FFFFFF" name="column-heading_religion">Religion</td> <td bgcolor="#FFFFFF" name="column-heading_education">Education</td> <td bgcolor="#FFFFFF" name="column-heading_profession">Profession</td> <td bgcolor="#FFFFFF" name="column-heading_marital-status">Marital Status</td> <td bgcolor="#FFFFFF" name="column-heading_working-status">Working Status</td> <td bgcolor="#FFFFFF" name="column-heading_country-of-birth">Country Of Birth</td> <td bgcolor="#FFFFFF" name="column-heading_home-town">Home Town</td> <td bgcolor="#FFFFFF" name="column-heading_home-neighbourhood">Home Neighbourhood</td> <td bgcolor="#FFFFFF" name="column-heading_home-borough">Home Borough</td> <td bgcolor="#FFFFFF" name="column-heading_home-city">Home City</td> <td bgcolor="#FFFFFF" name="column-heading_home-county">Home County</td> <td bgcolor="#FFFFFF" name="column-heading_home-district">Home District</td> <td bgcolor="#FFFFFF" name="column-heading_home-region">Home Region</td> <td bgcolor="#FFFFFF" name="column-heading_home-state">Home State</td> <td bgcolor="#FFFFFF" name="column-heading_home-country">Home Country</td> </tr> <?php while($row = mysqli_fetch_array($result)) { ?> <tr name="user-details"> <td bgcolor="#FFFFFF" name="submission-number"><a href="following_histories_v1.php?followee_id=<?php echo $row['id']; ?>&page_number=1"><?php echo $row['id']; ?></a></td> <td bgcolor="#FFFFFF" name="logging-server-date-&-time"><a href="following_histories_v1.php?followee_date_and_time=<?php echo $row['date_and_time']; ?>&page_number=1"><?php echo $row['date_and_time']; ?></a></td> <td bgcolor="#FFFFFF" name="browsed-page-converted_visit-page"><a href="<?php echo $row['followed_page_converted']; ?>&page_number=1"><?php echo $row['followed_page_converted']; ?></a></td> <td bgcolor="#FFFFFF" name="browsed-page-converted_stats-page"><a href="following_histories_v1.php?followee_followed_page_converted=<?php echo $row['followed_page_converted']; ?>&page_number=1"><?php echo $row['followed_page_converted']; ?></a></td> <td bgcolor="#FFFFFF" name="referral-page-converted_visit-page"><a href="<?php echo $row['referral_page_converted']; ?>&page_number=1"><?php echo $row['referral_page_converted']; ?></a></td> <td bgcolor="#FFFFFF" name="referral-page-converted_stats-page"><a href="following_histories_v1.php?followee_referral_page_converted=<?php echo $row['referral_page_converted']; ?>&page_number=1"><?php echo $row['referral_page_converted']; ?></a></td> <td bgcolor="#FFFFFF" name="profile-page-followee_visit-page"><a href="profile.php?followee_username=<?php echo $row['followee_username']; ?>&page_number=1"><?php echo $row['followee_username']; ?></a></td> <td bgcolor="#FFFFFF" name="profile-page-followee_stats-page"><a href="following_histories_v1.php?followee_username=<?php echo $row['followee_username']; ?>&page_number=1"><?php echo $row['followee_username']; ?></a></td> <td bgcolor="#FFFFFF" name="profile-page-follower_visit-page"><a href="profile.php?followee_username=<?php echo $row['follower_username']; ?>&page_number=1"><?php echo $row['follower_username']; ?></a></td> <td bgcolor="#FFFFFF" name="profile-page-follower_stats-page"><a href="following_histories_v1.php?followee_username=<?php echo $row['follower_username']; ?>&page_number=1"><?php echo $row['follower_username']; ?></a></td> <td bgcolor="#FFFFFF" name="gender"><a href="following_histories_v1.php?followee_gender=<?php echo $row['gender']; ?>&page_number=1"><?php echo $row['gender']; ?></a></td> <td bgcolor="#FFFFFF" name="age-range"><a href="following_histories_v1.php?followee_age_range=<?php echo $row['age_range']; ?>&page_number=1"><?php echo $row['age_range']; ?></a></td> <td bgcolor="#FFFFFF" name="date-of-birth"><a href="following_histories_v1.php?followee_date_of_birth=<?php echo $row['date_of_birth']; ?>&page_number=1"><?php echo $row['date_of_birth']; ?></a></td> <td bgcolor="#FFFFFF" name="skin-complexion"><a href="following_histories_v1.php?followee_skin_complexion=<?php echo $row['skin_complexion']; ?>&page_number=1"><?php echo $row['skin_complexion']; ?></a></td> <td bgcolor="#FFFFFF" name="height"><a href="following_histories_v1.php?followee_height=<?php echo $row['height']; ?>&page_number=1"><?php echo $row['height']; ?></a></td> <td bgcolor="#FFFFFF" name="weight"><a href="following_histories_v1.php?followee_height=<?php echo $row['weight']; ?>&page_number=1"><?php echo $row['weight']; ?></a></td> <td bgcolor="#FFFFFF" name="sexual-orientation"><a href="following_histories_v1.php?followee_sexual_orientation=<?php echo $row['sexual_orientation']; ?>&page_number=1"><?php echo $row['sexual_orientation']; ?></a></td> <td bgcolor="#FFFFFF" name="religion"><a href="following_histories_v1.php?followee_religion=<?php echo $row['religion']; ?>&page_number=1"><?php echo $row['religion']; ?></a></td> <td bgcolor="#FFFFFF" name="education"><a href="following_histories_v1.php?followee_education=<?php echo $row['education']; ?>&page_number=1"><?php echo $row['education']; ?></a></td> <td bgcolor="#FFFFFF" name="profession"><a href="following_histories_v1.php?followee_profession=<?php echo $row['profession']; ?>&page_number=1"><?php echo $row['profession']; ?></a></td> <td bgcolor="#FFFFFF" name="marital-status"><a href="following_histories_v1.php?followee_marital_status=<?php echo $row['marital_status']; ?>&page_number=1"><?php echo $row['marital_status']; ?></a></td> <td bgcolor="#FFFFFF" name="working-status"><a href="following_histories_v1.php?followee_working_status=<?php echo $row['working_status']; ?>&page_number=1"><?php echo $row['working_status']; ?></a></td> <td bgcolor="#FFFFFF" name="country-of-birth"><a href="following_histories_v1.php?followee_country_of_birth=<?php echo $row['country_of_birth']; ?>&page_number=1"><?php echo $row['country_of_birth']; ?></a></td> <td bgcolor="#FFFFFF" name="home-town"><a href="following_histories_v1.php?followee_home_town=<?php echo $row['home_town']; ?>&page_number=1"><?php echo $row['home_town']; ?></a></td> <td bgcolor="#FFFFFF" name="home-neighbourhood"><a href="following_histories_v1.php?followee_home_neighbourhood=<?php echo $row['home_neighbourhood']; ?>&page_number=1"><?php echo $row['home_neighbourhood']; ?></a></td> <td bgcolor="#FFFFFF" name="home-borough"><a href="following_histories_v1.php?followee_home_borough=<?php echo $row['home_borough']; ?>&page_number=1"><?php echo $row['home_borough']; ?></a></td> <td bgcolor="#FFFFFF" name="home-city"><a href="following_histories_v1.php?followee_home_city=<?php echo $row['home_city']; ?>&page_number=1"><?php echo $row['home_city']; ?></a></td> <td bgcolor="#FFFFFF" name="home-county"><a href="following_histories_v1.php?followee_home_county=<?php echo $row['home_county']; ?>&page_number=1"><?php echo $row['home_county']; ?></a></td> <td bgcolor="#FFFFFF" name="home-district"><a href="following_histories_v1.php?followee_home_district=<?php echo $row['home_district']; ?>&page_number=1"><?php echo $row['home_district']; ?></a></td> <td bgcolor="#FFFFFF" name="home-region"><a href="following_histories_v1.php?followee_home_region=<?php echo $row['home_region']; ?>&page_number=1"><?php echo $row['home_region']; ?></a></td> <td bgcolor="#FFFFFF" name="home-state"><a href="following_histories_v1.php?followee_home_state=<?php echo $row['home_state']; ?>&page_number=1"><?php echo $row['home_state']; ?></a></td> <td bgcolor="#FFFFFF" name="home-country"><a href="following_histories_v1.php?followee_home_country=<?php echo $row['home_country']; ?>&page_number=1"><?php echo $row['home_country']; ?></a></td> </tr> <?php } ?> <tr name="pagination"> <td colspan="30" bgcolor="#FFFFFF"> Result Pages: <?php if($rows_num <= $page_size) { echo "Page 1"; } else { for($i=1;$i<=$page_count;$i++) echo "<a href=\"{$_SERVER['PHP_SELF']}?$query_type=${$query_type}&page_number={$i}\">{$i}</a> "; } ?> </td> </tr> <?php } else { ?> <tr> <td bgcolor="#FFFFFF">No record found! Try another time.</td> </tr> <?php } ?> </table> <br> <br> <p align="center"><span style="font-weight:bold;"><?php echo "Search Result for:<br> $query_type_label = \"${$query_type}\""; ?></span></p> <br> <br> <br> </body> </html>
The ISSUE STARTS as soon as I try adding PREP STMT. Here is my attempt so far:
<?php //Required PHP Files. include 'header_account.php'; //Required on all webpages of the Account. ?> <?php if (!$conn) { $error = mysqli_connect_error(); $errno = mysqli_connect_errno(); print "$errno: $error\n"; exit(); } //Grab Username of who's Browsing History needs to be searched. if (isset($_GET['followee_username']) && !empty($_GET['followee_username'])) { $followee_username = $_GET['followee_username']; if($followee_username != 'followee_all' OR $followee_username != 'Followee_All') { //$query = "SELECT * FROM browsing_histories WHERE username = \"$followee_username\""; $query_type = "followee_username"; $followed_word = "$followee_username"; //$followee_username = "$followee_username"; $query = "SELECT id,date_and_time,query_type,followed_word,query_string,followed_page_original,followed_page_converted,referral_page_original,referral_page_converted,followee_username,follower_username,gender,age_range,date_of_birth,skin_complexion,height,weight,sexual_orientation,religion,education,profession,marital_status,working_status,home_town,home_neighbourhood,home_borough,home_council,home_city,home_county,home_district,home_region,home_state,home_country FROM following_histories WHERE followee_username = ?"; $stmt = mysqli_prepare($conn,$query); mysqli_stmt_bind_param($stmt,'s',$followee_username); mysqli_stmt_execute($stmt); //Check if User's details was successfully extracted or not from 'details_contact_home' tbl. if (!$stmt) { echo "ERROR 3: Sorry! Our system is currently experiencing a problem logging you in!"; exit(); } else { $result = mysqli_stmt_bind_result($stmt,$followee_browsing_history_submission_id,$followee_browsing_history_submission_date_and_time,$followee_query_type,$followee_followed_word,$followee_query_string,$followee_browsed_page_original,$followee_browsed_page_converted,$followee_referral_page_original,$followee_referral_page_converted,$followee_username,$followee_gender,$followee_age_range,$followee_date_of_birth,$followee_skin_complexion,$followee_height,$followee_weight,$followee_sexual_orientation,$followee_religion,$followee_education,$followee_profession,$followee_marital_status,$followee_working_status,$followee_country_of_birth,$followee_home_town,$followee_home_neighbourhood,$followee_home_borough,$followee_home_council,$followee_home_city,$followee_home_county,$followee_home_district,$followee_home_region,$followee_home_state,$followee_home_country); mysqli_stmt_fetch($stmt); mysqli_stmt_close($stmt); } } else { $query = "SELECT * FROM following_histories"; $query_type = "followee_all"; $followed_word = "followee_all"; echo "all"; echo "all search"; } } if (isset($_GET['follower_username']) && !empty($_GET['follower_username'])) { $follower_username = $_GET['follower_username']; if($follower_username != 'follower_all' OR $follower_username != 'Follower_All') { //$query = "SELECT * FROM browsing_histories WHERE username = \"$follower_username\""; $query_type = "follower_username"; $followed_word = "$follower_username"; $query = "SELECT id,date_and_time,query_type,followed_word,query_string,followed_page_original,followed_page_converted,referral_page_original,referral_page_converted,followee_username,follower_username,gender,age_range,date_of_birth,skin_complexion,height,weight,sexual_orientation,religion,education,profession,marital_status,working_status,followee_country_of_birth,home_town,home_neighbourhood,home_borough,home_council,home_city,home_county,home_district,home_region,home_state,home_country FROM browsing_histories WHERE followee_username = ?"; $stmt = mysqli_prepare($conn,$query); mysqli_stmt_bind_param($stmt,'s',$follower_username); mysqli_stmt_execute($stmt); //Check if User's details was successfully extracted or not from 'details_contact_home' tbl. if (!$stmt) { echo "ERROR 3: Sorry! Our system is currently experiencing a problem logging you in!"; exit(); } else { $result = mysqli_stmt_bind_result($stmt,$followee_browsing_history_submission_id,$followee_browsing_history_submission_date_and_time,$followee_query_type,$followee_followed_word,$followee_query_string,$followee_browsed_page_original,$followee_browsed_page_converted,$followee_referral_page_original,$followee_referral_page_converted,$followee_username,$followee_gender,$followee_age_range,$followee_date_of_birth,$followee_skin_complexion,$followee_height,$followee_weight,$followee_sexual_orientation,$followee_religion,$followee_education,$followee_profession,$followee_marital_status,$followee_working_status,$followee_country_of_birth,$followee_home_town,$followee_home_neighbourhood,$followee_home_borough,$followee_home_council,$followee_home_city,$followee_home_county,$followee_home_district,$followee_home_region,$followee_home_state,$followee_home_country); mysqli_stmt_fetch($stmt); mysqli_stmt_close($stmt); } } else { $query = "SELECT * FROM following_histories"; $query_type = "follower_all"; $followed_word = "follower_all"; echo "all"; echo "all search"; } } if (isset($_GET['followee_id']) && !empty($_GET['followee_id'])) { $followee_id = $_GET['followee_id']; $query = "SELECT * FROM following_histories WHERE id = \"$followee_id\""; $query_type = "followee_id"; $followed_word = "$followee_id"; echo "$followee_id"; } if (isset($_GET['followee_date_and_time']) && !empty($_GET['followee_date_and_time'])) { $followee_date_and_time = $_GET['followee_date_and_time']; $query = "SELECT * FROM following_histories WHERE date_and_time = \"$followee_date_and_time\""; $query_type = "followee_date_and_time"; $followed_word = "$followee_date_and_time"; } if (isset($_GET['followee_followed_page_converted']) && !empty($_GET['followee_followed_page_converted'])) { $followee_followed_page_converted = $_GET['followee_followed_page_converted']; $query = "SELECT * FROM following_histories WHERE followed_page_converted = \"$followee_followed_page_converted\""; $query_type = "followee_followed_page_converted"; $followed_word = "$followee_followed_page_converted"; } if (isset($_GET['followee_referral_page_converted']) && !empty($_GET['followee_referral_page_converted'])) { $followee_referral_page_converted = $_GET['followee_referral_page_converted']; $query = "SELECT * FROM following_histories WHERE referral_page_converted = \"$followee_referral_page_converted\""; $query_type = "followee_referral_page_converted"; $followed_word = "$followee_referral_page_converted"; } if (isset($_GET['followee_gender']) && !empty($_GET['followee_gender'])) { $followee_gender = $_GET['followee_gender']; $query = "SELECT * FROM following_histories WHERE gender = \"$followee_gender\""; $query_type = "followee_gender"; $followed_word = "$followee_gender"; } if (isset($_GET['followee_age_range']) && !empty($_GET['followee_age_range'])) { $followee_age_range = $_GET['followee_age_range']; $query = "SELECT * FROM following_histories WHERE age_range = \"$followee_age_range\""; $query_type = "followee_age_range"; $followed_word = "$followee_age_range"; } if (isset($_GET['followee_date_of_birth']) && !empty($_GET['followee_date_of_birth'])) { $followee_date_of_birth = $_GET['followee_date_of_birth']; $query = "SELECT * FROM following_histories WHERE date_of_birth = \"$followee_date_of_birth\""; $query_type = "followee_date_of_birth"; $followed_word = "$followee_date_of_birth"; } if (isset($_GET['followee_skin_complexion']) && !empty($_GET['followee_skin_complexion'])) { $followee_skin_complexion = $_GET['followee_skin_complexion']; $query = "SELECT * FROM following_histories WHERE skin_complexion = \"$followee_skin_complexion\""; $query_type = "followee_skin_complexion"; $followed_word = "$followee_skin_complexion"; } if (isset($_GET['followee_height']) && !empty($_GET['followee_height'])) { $followee_height = $_GET['followee_height']; $query = "SELECT * FROM following_histories WHERE height = \"$followee_height\""; $query_type = "followee_height"; $followed_word = "$followee_height"; } if (isset($_GET['followee_weight']) && !empty($_GET['followee_weight'])) { $followee_weight = $_GET['followee_weight']; $query = "SELECT * FROM following_histories WHERE weight = \"$followee_weight\""; $query_type = "followee_weight"; $followed_word = "$followee_weight"; } if (isset($_GET['followee_sexual_orientation']) && !empty($_GET['followee_sexual_orientation'])) { $followee_sexual_orientation = $_GET['followee_sexual_orientation']; $query = "SELECT * FROM following_histories WHERE sexual_orientation = \"$followee_sexual_orientation\""; $query_type = "followee_sexual_orientation"; $followed_word = "$followee_sexual_orientation"; } if (isset($_GET['followee_religion']) && !empty($_GET['followee_religion'])) { $followee_religion = $_GET['followee_religion']; $query = "SELECT * FROM following_histories WHERE religion = \"$followee_religion\""; $query_type = "followee_religion"; $followed_word = "$followee_religion"; } if (isset($_GET['followee_education']) && !empty($_GET['followee_education'])) { $followee_education = $_GET['followee_education']; $query = "SELECT * FROM following_histories WHERE education = \"$followee_education\""; $query_type = "followee_education"; $followed_word = "$followee_education"; } if (isset($_GET['followee_profession']) && !empty($_GET['followee_profession'])) { $followee_profession = $_GET['followee_profession']; $query = "SELECT * FROM following_histories WHERE profession = \"$followee_profession\""; $query_type = "followee_profession"; $followed_word = "$followee_profession"; } if (isset($_GET['followee_marital_status']) && !empty($_GET['followee_marital_status'])) { $followee_marital_status = $_GET['followee_marital_status']; $query = "SELECT * FROM following_histories WHERE marital_status = \"$followee_marital_status\""; $query_type = "followee_marital_status"; $followed_word = "$followee_marital_status"; } if (isset($_GET['followee_working_status']) && !empty($_GET['followee_working_status'])) { $followee_working_status = $_GET['followee_working_status']; $query = "SELECT * FROM following_histories WHERE working_status = \"$followee_working_status\""; $query_type = "followee_working_status"; $followed_word = "$followee_working_status"; } if (isset($_GET['followee_country_of_birth']) && !empty($_GET['followee_country_of_birth'])) { $followee_country_of_birth = $_GET['followee_country_of_birth']; $query = "SELECT * FROM following_histories WHERE country_of_birth = \"$followee_country_of_birth\""; $query_type = "followee_country_of_birth"; $followed_word = "$followee_country_of_birth"; } if (isset($_GET['followee_home_town']) && !empty($_GET['followee_home_town'])) { $followee_home_town = $_GET['followee_home_town']; $query = "SELECT * FROM following_histories WHERE home_town = \"$followee_home_town\""; $query_type = "followee_home_town"; $followed_word = "$followee_home_town"; } if (isset($_GET['followee_home_neighbourhood']) && !empty($_GET['followee_home_neighbourhood'])) { $followee_home_neighbourhood = $_GET['followee_home_neighbourhood']; $query = "SELECT * FROM following_histories WHERE home_neighbourhood = \"$followee_home_neighbourhood\""; $query_type = "followee_home_neighbourhood"; $followed_word = "$followee_home_neighbourhood"; } if (isset($_GET['followee_home_borough']) && !empty($_GET['followee_home_borough'])) { $followee_home_borough = $_GET['followee_home_borough']; $query = "SELECT * FROM following_histories WHERE home_borough = \"$followee_home_borough\""; $query_type = "followee_home_borough"; $followed_word = "$followee_home_borough"; } if (isset($_GET['followee_home_city']) && !empty($_GET['followee_home_city'])) { $followee_home_city = $_GET['followee_home_city']; $query = "SELECT * FROM following_histories WHERE home_city = \"$followee_home_city\""; $query_type = "followee_home_city"; $followed_word = "$followee_home_city"; } if (isset($_GET['followee_home_county']) && !empty($_GET['followee_home_county'])) { $followee_home_county = $_GET['followee_home_county']; $query = "SELECT * FROM following_histories WHERE home_county = \"$followee_home_county\""; $query_type = "followee_home_county"; $followed_word = "$followee_home_county"; } if (isset($_GET['followee_home_district']) && !empty($_GET['followee_home_district'])) { $followee_home_district = $_GET['followee_home_district']; $query = "SELECT * FROM following_histories WHERE home_district = \"$followee_home_district\""; $query_type = "followee_home_district"; $followed_word = "$followee_home_district"; } if (isset($_GET['followee_home_region']) && !empty($_GET['followee_home_region'])) { $followee_home_region = $_GET['followee_home_region']; $query = "SELECT * FROM following_histories WHERE home_region = \"$followee_home_region\""; $query_type = "followee_home_region"; $followed_word = "$followee_home_region"; } if (isset($_GET['followee_home_state']) && !empty($_GET['followee_home_state'])) { $followee_home_state = $_GET['followee_home_state']; $query = "SELECT * FROM following_histories WHERE home_state = \"$followee_home_state\""; $query_type = "followee_home_state"; $followed_word = "$followee_home_state"; } if (isset($_GET['followee_home_country']) && !empty($_GET['followee_home_country'])) { $followee_home_country = $_GET['followee_home_country']; $query = "SELECT * FROM following_histories WHERE home_country = \"$followee_home_country\""; $query_type = "followee_home_country"; $followed_word = "$followee_home_country"; } $referral_page_http = $_SERVER['HTTP_REFERRER']; $referral_page = "$referral_page_http"; $referral_page_original = "$referral_page"; $query_string = $_SERVER['QUERY_STRING']; $current_page_http = $_SERVER['PHP_SELF']; $current_page = "$current_page_http"; $followed_page_original = "$current_page"; $visiting_pages_count = "1"; if($visiting_pages_count == "") { $visiting_pages_count = "1"; } else { $visiting_pages_count++; } if($visiting_pages_count == "1") { $current_page_converted = "$settings_user_first_quick_link.$current_page"; $referral_page_converted = "$settings_user_first_quick_link.$referral_page"; } elseif($visiting_pages_count == "2") { $current_page_converted = "$settings_admin_second_quick_link.$current_page"; $referral_page_converted = "$settings_admin_second_quick_link.$referral_page"; } elseif($visiting_pages_count == "3") { $current_page_converted = "$settings_user_third_quick_link.$current_page"; $referral_page_converted = "$settings_user_third_quick_link.$referral_page"; } elseif($visiting_pages_count == "4") { $current_page_converted = "$settings_admin_fourth_quick_link.$current_page"; $referral_page_converted = "$settings_admin_fourth_quick_link.$referral_page"; } elseif($visiting_pages_count == "5") { $current_page_converted = "$settings_user_fifth_quick_link.$current_page"; $referral_page_converted = "$settings_user_fifth_quick_link.$referral_page"; } if($visiting_pages_count == "6") { $current_page_converted = "$settings_admin_first_quick_link.$current_page"; $referral_page_converted = "$settings_admin_first_quick_link.$referral_page"; } elseif($visiting_pages_count == "7") { $current_page_converted = "$settings_user_second_quick_link.$current_page"; $referral_page_converted = "$settings_user_second_quick_link.$referral_page"; } elseif($visiting_pages_count == "8") { $current_page_converted = "$settings_admin_third_quick_link.$current_page"; $referral_page_converted = "$settings_admin_third_quick_link.$referral_page"; } elseif($visiting_pages_count == "9") { $current_page_converted = "$settings_user_fourth_quick_link.$current_page"; $referral_page_converted = "$settings_user_fourth_quick_link.$referral_page"; } elseif($visiting_pages_count == "10") { $current_page_converted = "$settings_admin_fifth_quick_link.$current_page"; $referral_page_converted = "$settings_admin_fifth_quick_link.$referral_page"; } else { $visiting_pages_count = "1"; $current_page_converted = "$settings_user_first_quick_link.$current_page"; $referral_page_converted = "$settings_user_first_quick_link.$referral_page"; } $followed_page_converted = "$current_page_converted"; $follower_username = $user; $follower_browser = $_SERVER['HTTP_USER_AGENT']; //Insert the User's Click Logs into Mysql Database using Php's Sql Injection Prevention Method "Prepared Statements". $stmt_2 = mysqli_prepare($conn,"INSERT INTO following_histories(query_type,followed_word,query_string,followed_page_original,followed_page_converted,referral_page_original,referral_page_converted,followee_username,follower_username,gender,age_range,date_of_birth,skin_complexion,height,weight,sexual_orientation,religion,education,profession,marital_status,working_status,country_of_birth,home_town,home_neighbourhood,home_borough,home_council,home_city,home_county,home_district,home_region,home_state,home_country) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); mysqli_stmt_bind_param($stmt_2,'ssssssssssiissssssssssssssssssss',$query_type,$followed_word,$query_string,$followed_page_original,$followed_page_converted,$referral_page_original,$referral_page_converted,$followee_username,$follower_username,$gender,$age_range,$date_of_birth,$skin_complexion,$height,$weight,$sexual_orientation,$religion,$education,$profession,$marital_status,$working_status,$country_of_birth,$home_town,$home_neighbourhood,$home_borough,$home_council,$home_city,$home_county,$home_district,$home_region,$home_state,$home_country); mysqli_stmt_execute($stmt_2); //Check if User's Click Logs have been successfully submitted or not. if (!$stmt_2) { echo "Sorry! Our system is currently experiencing a problem logging your following! We will continuously try logging your clicks!"; exit(); } else { mysqli_stmt_fetch($stmt_2); mysqli_stmt_close($stmt_2); } $query_type_label = str_replace("_"," ","$query_type"); //Removing underscores so they don't show-up on the html. $query_type_label = ucwords("$query_type_label"); //Upper Casing the first characters. ?> <!DOCTYPE html> <html> <head> <meta content="text/html; charset=ISO-8859-1" http-equiv=" content-type"> <title><?php echo "Browsing History in $server_time Time.";?></title> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <body> <br> <p align="center"><span style="font-weight:bold;"><?php echo "Search Result for:<br> $query_type_label = \"${$query_type}\""; ?></span></p> <br> <br> <?php $result = mysqli_query($conn,$query); $rows_num = mysqli_num_rows($result); //Total Number of Pages records are spread-over. $page_count = 100; $page_size = ceil($rows_num / $page_count); //Get the Page Number. Default is 1 (First Page). $page_number = $_GET["page_number"]; if ($page_number == "") $page_number = 1; $offset = ($page_number -1) * $page_size; $query .= " limit {$offset},{$page_size}"; $result = mysqli_query($conn,$query); ?> <table width="1500" border="0" cellpadding="5" cellspacing="2" bgcolor="#666666"> <?php if(!$rows_num) { ?> <tr> <td bgcolor="#FFFFFF">No record found! Try another time.</td> </tr> <?php } else { printf("<b> %d Result Found ...</b>\n",$rows_num); ?><br> <br> <tr name="headings"> <td bgcolor="#FFFFFF" name="column-heading_submission-number">Submission Number</td> <td bgcolor="#FFFFFF" name="column-heading_logging-server-date-and-time">Date & Time in <?php echo "$server_time";?></td> <td bgcolor="#FFFFFF" name="column-heading_browsed-page-converted">Browsed Page Converted (Visit Page) </td> <td bgcolor="#FFFFFF" name="column-heading_browsed-page-converted">Browsed Page Converted (Check Stats) </td> <td bgcolor="#FFFFFF" name="column-heading_referral-page-converted">Referral Page Converted (Visit Page) </td> <td bgcolor="#FFFFFF" name="column-heading_referral-page-converted">Referral Page Converted (Check Stats) </td> <td bgcolor="#FFFFFF" name="column-heading_username">Followee Username (Visit Page)</td> <td bgcolor="#FFFFFF" name="column-heading_username">Followee Username (Check Stats)</td> <td bgcolor="#FFFFFF" name="column-heading_username">Follower Username (Visit Page)</td> <td bgcolor="#FFFFFF" name="column-heading_username">Follower Username (Check Stats)</td> <td bgcolor="#FFFFFF" name="column-heading_gender">Follower Gender</td> <td bgcolor="#FFFFFF" name="column-heading_age-range">Follower Age Range</td> <td bgcolor="#FFFFFF" name="column-heading_date-of-birth">Follower Date Of Birth</td> <td bgcolor="#FFFFFF" name="column-heading_skin-complexion">Follower Skin Complexion</td> <td bgcolor="#FFFFFF" name="column-heading_height">Follower Height</td> <td bgcolor="#FFFFFF" name="column-heading_weight">Follower Weight</td> <td bgcolor="#FFFFFF" name="column-heading_sexual-orientation">Follower Sexual Orientation</td> <td bgcolor="#FFFFFF" name="column-heading_religion">Follower Religion</td> <td bgcolor="#FFFFFF" name="column-heading_education">Follower Education</td> <td bgcolor="#FFFFFF" name="column-heading_profession">Follower Profession</td> <td bgcolor="#FFFFFF" name="column-heading_marital-status">Follower Marital Status</td> <td bgcolor="#FFFFFF" name="column-heading_working-status">Follower Working Status</td> <td bgcolor="#FFFFFF" name="column-heading_country-of-birth">Follower Country Of Birth</td> <td bgcolor="#FFFFFF" name="column-heading_home-town">Follower Home Town</td> <td bgcolor="#FFFFFF" name="column-heading_home-neighbourhood">Follower Home Neighbourhood</td> <td bgcolor="#FFFFFF" name="column-heading_home-borough">Follower Home Borough</td> <td bgcolor="#FFFFFF" name="column-heading_home-city">Follower Home City</td> <td bgcolor="#FFFFFF" name="column-heading_home-county">Follower Home County</td> <td bgcolor="#FFFFFF" name="column-heading_home-district">Follower Home District</td> <td bgcolor="#FFFFFF" name="column-heading_home-region">Follower Home Region</td> <td bgcolor="#FFFFFF" name="column-heading_home-state">Follower Home State</td> <td bgcolor="#FFFFFF" name="column-heading_home-country">Follower Home Country</td> </tr> <?php while($row = mysqli_fetch_array($result)) { ?> <tr name="user-details"> <td bgcolor="#FFFFFF" name="submission-number"><a href="following_histories_v1.php?followee_id=<?php echo $followee_browsing_history_submission_id; ?>&page_number=1"><?php echo $followee_browsing_history_submission_id; ?></a></td> <td bgcolor="#FFFFFF" name="logging-server-date-&-time"><a href="following_histories_v1.php?followee_date_and_time=<?php echo $followee_browsing_history_submission_date_and_time; ?>&page_number=1"><?php echo $followee_browsing_history_submission_date_and_time; ?></a></td> <td bgcolor="#FFFFFF" name="followed-page-converted_visit-page"><a href="<?php echo "followee_browser.php?followee_username=$followee_username&followee_followed_page_converted=$followee_followed_page_converted"; ?>"><?php echo "$followee_followed_page_converted"; ?></a></td> <td bgcolor="#FFFFFF" name="followed-page-converted_stats-page"><a href="following_histories_v1.php?followee_followed_page_converted=<?php echo "$followee_followed_page_converted"; ?>&page_number=1"><?php echo "$followee_followed_page_converted"; ?></a></td> <td bgcolor="#FFFFFF" name="referral-page-converted_visit-page"><a href="<?php echo "followee_browser.php?followee_username=$followee_username&followee_referral_page_converted=$followee_referral_page_converted"; ?>"><?php echo "$followee_referral_page_converted"; ?></a></td> <td bgcolor="#FFFFFF" name="referral-page-converted_stats-page"><a href="following_histories_v1.php?followee_referral_page_converted=<?php echo "$followee_referral_page_converted"; ?>&page_number=1"><?php echo "$followee_referral_page_converted"; ?></a></td> <td bgcolor="#FFFFFF" name="profile-page-followee_visit-page"><a href="profile.php?followee_username=<?php echo "$followee_username"; ?>"><?php echo "$followee_username"; ?></a></td> <td bgcolor="#FFFFFF" name="profile-page-followee_stats-page"><a href="following_histories_v1.php?followee_username=<?php echo "$followee_username"; ?>"><?php echo "$followee_username"; ?></a></td> <td bgcolor="#FFFFFF" name="profile-page-follower_visit-page"><a href="profile.php?followee_username=<?php echo "$follower_username"; ?>"><?php echo "$follower_username"; ?></a></td> <td bgcolor="#FFFFFF" name="profile-page-follower_stats-page"><a href="following_histories_v1.php?followee_username=<?php echo "$follower_username"; ?>"><?php echo "$follower_username"; ?></a></td> <td bgcolor="#FFFFFF" name="gender"><a href="following_histories_v1.php?followee_gender=<?php echo "$follower_gender"; ?>&page_number=1"><?php echo "$follower_gender"; ?></a></td> <td bgcolor="#FFFFFF" name="age-range"><a href="following_histories_v1.php?followee_age_range=<?php echo "$follower_age_range"; ?>&page_number=1"><?php echo "$followerage_range"; ?></a></td> <td bgcolor="#FFFFFF" name="date-of-birth"><a href="following_histories_v1.php?followee_date_of_birth=<?php echo "$follower_date_of_birth"; ?>&page_number=1"><?php echo "$follower_date_of_birth"; ?></a></td> <td bgcolor="#FFFFFF" name="skin-complexion"><a href="following_histories_v1.php?followee_skin_complexion=<?php echo "$follower_skin_complexion"; ?>&page_number=1"><?php echo "$follower_skin_complexion"; ?></a></td> <td bgcolor="#FFFFFF" name="height"><a href="following_histories_v1.php?followee_height=<?php echo "$follower_height"; ?>&page_number=1"><?php echo "$follower_height"; ?></a></td> <td bgcolor="#FFFFFF" name="weight"><a href="following_histories_v1.php?followee_height=<?php echo "$follower_weight"; ?>&page_number=1"><?php echo "$follower_weight"; ?></a></td> <td bgcolor="#FFFFFF" name="sexual-orientation"><a href="following_histories_v1.php?followee_sexual_orientation=<?php echo "$follower_sexual_orientation"; ?>&page_number=1"><?php echo "$follower_sexual_orientation"; ?></a></td> <td bgcolor="#FFFFFF" name="religion"><a href="following_histories_v1.php?followee_religion=<?php echo "$follower_religion"; ?>&page_number=1"><?php echo "$follower_religion"; ?></a></td> <td bgcolor="#FFFFFF" name="education"><a href="following_histories_v1.php?followee_education=<?php echo "$follower_education"; ?>&page_number=1"><?php echo "$follower_education"; ?></a></td> <td bgcolor="#FFFFFF" name="profession"><a href="following_histories_v1.php?followee_profession=<?php echo "$follower_profession"; ?>&page_number=1"><?php echo "$follower_profession"; ?></a></td> <td bgcolor="#FFFFFF" name="marital-status"><a href="following_histories_v1.php?followee_marital_status=<?php echo "$follower_marital_status"; ?>&page_number=1"><?php echo "$follower_marital_status"; ?></a></td> <td bgcolor="#FFFFFF" name="working-status"><a href="following_histories_v1.php?followee_working_status=<?php echo "$follower_working_status"; ?>&page_number=1"><?php echo "$follower_working_status"; ?></a></td> <td bgcolor="#FFFFFF" name="country-of-birth"><a href="following_histories_v1.php?followee_country_of_birth=<?php echo "$follower_country_of_birth"; ?>&page_number=1"><?php echo "$follower_country_of_birth"; ?></a></td> <td bgcolor="#FFFFFF" name="home-town"><a href="following_histories_v1.php?followee_home_town=<?php echo "$follower_home_town"; ?>&page_number=1"><?php echo "$follower_home_town"; ?></a></td> <td bgcolor="#FFFFFF" name="home-neighbourhood"><a href="following_histories_v1.php?followee_home_neighbourhood=<?php echo "$follower_home_neighbourhood"; ?>&page_number=1"><?php echo "$home_neighbourhood"; ?></a></td> <td bgcolor="#FFFFFF" name="home-borough"><a href="following_histories_v1.php?followee_home_borough=<?php echo "$follower_home_borough"; ?>&page_number=1"><?php echo "$follower_home_borough"; ?></a></td> <td bgcolor="#FFFFFF" name="home-city"><a href="following_histories_v1.php?followee_home_city=<?php echo "$follower_home_city"; ?>&page_number=1"><?php echo "$follower_home_city"; ?></a></td> <td bgcolor="#FFFFFF" name="home-county"><a href="following_histories_v1.php?followee_home_county=<?php echo "$follower_home_county"; ?>&page_number=1"><?php echo "$follower_home_county"; ?></a></td> <td bgcolor="#FFFFFF" name="home-district"><a href="following_histories_v1.php?followee_home_district=<?php echo "$follower_home_district"; ?>&page_number=1"><?php echo "$follower_home_district"; ?></a></td> <td bgcolor="#FFFFFF" name="home-region"><a href="following_histories_v1.php?followee_home_region=<?php echo "$follower_home_region"; ?>&page_number=1"><?php echo "$follower_home_region"; ?></a></td> <td bgcolor="#FFFFFF" name="home-state"><a href="following_histories_v1.php?followee_home_state=<?php echo "$follower_home_state"; ?>&page_number=1"><?php echo "$follower_home_state"; ?></a></td> <td bgcolor="#FFFFFF" name="home-country"><a href="following_histories_v1.php?followee_home_country=<?php echo "$follower_home_country"; ?>&page_number=1"><?php echo "$follower_home_country"; ?></a></td> </tr> <?php } ?> <tr name="pagination"> <td colspan="30" bgcolor="#FFFFFF"> Result Pages: <?php if($rows_num <= $page_size) { echo "Page 1"; } else { for($i=1;$i<=$page_count;$i++) echo "<a href=\"{$_SERVER['PHP_SELF']}?$query_type=${$query_type}&page_number={$i}\">{$i}</a> "; } ?> </td&g I’ve just read several manual pages and forum comments on "Error number 1064" but I still don’t understand what’s going on with the problem I'm having now … Also, I'm surprised that the error message mentions two different line numbers (1 and 35). Here is the error message I get : And here are the contents of my "one_more_visit_to_topic.php" file : <?php include("includes/model/database_searches/see_readings.php"); include("includes/model/database_searches/see_watchings.php"); function one_more_visit_to_topic($user_id,$topic_id) { global $db; $request_string='UPDATE forum_topic '. 'SET topic_vu = topic_vu + 1 WHERE topic_id = :topic'; $query=$db->prepare($request_string); $query->bindValue(':topic',$topic_id,PDO::PARAM_INT); $query->execute(); $query->CloseCursor(); // Remember that topic has been read by user if(!(see_if_user_has_read_topic($user_id,$topic_id))) { $request_string='INSERT INTO forum_read (fr_topic_id,fr_user_id) '. 'VALUES (:topic,:user)'; $query=$db->prepare($request_string); $query->bindValue(':topic',$topic_id,PDO::PARAM_INT); $query->bindValue(':user',$user_id,PDO::PARAM_INT); $query->execute(); $query->CloseCursor(); } // If user has already received a warning by mail, // the "alert" value needs to be toggled in the fw_watch table if(see_if_user_has_been_warned($user_id,$topic_id)) { $request_string='UPDATE forum_read SET fw_alert = :alt '. 'WHERE fw_topic_id = :topic AND fw_user_id= :user)'; $query=$db->prepare($request_string); $query->bindValue(':topic',$topic_id,PDO::PARAM_INT); $query->bindValue(':user',$user_id,PDO::PARAM_INT); $one=(int)1; $query->bindValue(':alt',$one,PDO::PARAM_INT); $query->execute(); $query->CloseCursor(); } return; } ?> I am a new developer, trying to figure out what causing a memory error. The code goes through registered appointments and depends on the service ID, I have to free a 45 minutes for another service to be booked. Now, once I book an appointment for any of the services that can have 45 minutes free spot, the website takes forever to load the hours but doesn't show them, instead I get this error A PHP Error was encountered Severity: Error Message: Maximum execution time of 120 seconds exceeded
foreach ($appointments as $appointment) { foreach ($periods as $index => &$period) { $appointment_start = new DateTime($appointment['start_datetime']); $appointment_end = new DateTime($appointment['end_datetime']); if ($appointment_start >= $appointment_end) { continue; } $period_start = new DateTime($date . ' ' . $period['start']); $period_end = new DateTime($date . ' ' . $period['end']); $serviceId=$appointment['id_services']; $color1=1; $color2=2; $color3=3; $color4=4; $color5=5; $color6=6; $color7=7; $color8=8; $color9=9; $color10=10; $color11=11; $color12=12; $color13=13; $color14=14; $color15=15; $color16=16; $color17=17; $color18=18; $color19=19; $period_s=''; $period_e=''; if ($appointment_start <= $period_start && $appointment_end <= $period_end && $appointment_end <= $period_start) { // The appointment does not belong in this time period, so we will not change anything. continue; } else { if ($appointment_start <= $period_start && $appointment_end <= $period_end && $appointment_end >= $period_start) { // The appointment starts before the period and finishes somewhere inside. We will need to break // this period and leave the available part. //open slot for services 45,45,45 if($serviceId == $color1 || $serviceId == $color3 || $serviceId == $color7 || $serviceId == $color9|| $serviceId == $color10 || $serviceId == $color11 || $serviceId == $color12){ unset($periods[$index]); $period_s= clone $appointment_start; $period_s->modify('+45 minutes'); $period_e= clone $appointment_end; $period_e->modify('-45 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $period['start'] = $appointment_end->format('H:i'); } //Open slot for service 45,45,60 else if($serviceId == $color2 || $serviceId == $color8){ $period_s= clone $appointment_start; $period_s->modify('+45 minutes'); $period_e= clone $appointment_end; $period_e->modify('-60 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $period['start'] = $appointment_end->format('H:i'); } // // //Open slot for service 30,45,45 else if($serviceId == $color4 || $serviceId == $color6 ||$serviceId == $color16 || $serviceId == $color18){ $period_s= clone $appointment_start; $period_s->modify('+30 minutes'); $period_e= clone $appointment_end; $period_e->modify('-45 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $period['start'] = $appointment_end->format('H:i'); } // // //Open slot for service 30,45,60 else if($serviceId == $color5 || $serviceId == $color17){ $period_s= clone $appointment_start; $period_s->modify('+30 minutes'); $period_e= clone $appointment_end; $period_e->modify('-60 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $period['start'] = $appointment_end->format('H:i'); } // // //Open slot for service 60,45,45 else if($serviceId == $color13 || $serviceId == $color15){ $period_s= clone $appointment_start; $period_s->modify('+60 minutes'); $period_e= clone $appointment_end; $period_e->modify('-45 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $period['start'] = $appointment_end->format('H:i'); } // // //Open slot for service 60,45,60 else if($serviceId == $color14 ){ $period_s= clone $appointment_start; $period_s->modify('+60 minutes'); $period_e= clone $appointment_end; $period_e->modify('-60 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $period['start'] = $appointment_end->format('H:i'); } // //for the rest of services else { $period['start'] = $appointment_end->format('H:i');} } else { if ($appointment_start >= $period_start && $appointment_end < $period_end) { // The appointment is inside the time period, so we will split the period into two new // others. unset($periods[$index]); if($serviceId == $color1 || $serviceId == $color3 || $serviceId == $color7 || $serviceId == $color9|| $serviceId == $color10 || $serviceId == $color11 || $serviceId == $color12){ $period_s= clone $appointment_start; $period_s->modify('+45 minutes'); $period_e= clone $appointment_end; $period_e->modify('-45 minutes'); $periods[] = [ 'start' => $period_start->format('H:i'), 'end' => $appointment_start->format('H:i') ]; $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $periods[] = [ 'start' => $appointment_end->format('H:i'), 'end' => $period_end->format('H:i') ]; } // //Open slot for service 45,45,60 else if($serviceId == $color2 || $serviceId == $color8){ $period_s= clone $appointment_start; $period_s->modify('+45 minutes'); $period_e= clone $appointment_end; $period_e->modify('-60 minutes'); $periods[] = [ 'start' => $period_start->format('H:i'), 'end' => $appointment_start->format('H:i') ]; $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $periods[] = [ 'start' => $appointment_end->format('H:i'), 'end' => $period_end->format('H:i') ]; } // // //Open slot for service 30,45,45 else if($serviceId == $color4 || $serviceId == $color6 ||$serviceId == $color16 || $serviceId == $color18){ $period_s= clone $appointment_start; $period_s->modify('+30 minutes'); $period_e= clone $appointment_end; $period_e->modify('-45 minutes'); $periods[] = [ 'start' => $period_start->format('H:i'), 'end' => $appointment_start->format('H:i') ]; $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $periods[] = [ 'start' => $appointment_end->format('H:i'), 'end' => $period_end->format('H:i') ]; } // // //Open slot for service 30,45,60 else if($serviceId == $color5 || $serviceId == $color17){ $period_s= clone $appointment_start; $period_s->modify('+30 minutes'); $period_e= clone $appointment_end; $period_e->modify('-60 minutes'); $periods[] = [ 'start' => $period_start->format('H:i'), 'end' => $appointment_start->format('H:i') ]; $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $periods[] = [ 'start' => $appointment_end->format('H:i'), 'end' => $period_end->format('H:i') ]; } // // //Open slot for service 60,45,45 else if($serviceId == $color13 || $serviceId == $color15){ $period_s= clone $appointment_start; $period_s->modify('+60 minutes'); $period_e= clone $appointment_end; $period_e->modify('-45 minutes'); $periods[] = [ 'start' => $period_start->format('H:i'), 'end' => $appointment_start->format('H:i') ]; $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $periods[] = [ 'start' => $appointment_end->format('H:i'), 'end' => $period_end->format('H:i') ]; } // // //Open slot for service 60,45,60 else if($serviceId == $color14 ){ $period_s= clone $appointment_start; $period_s->modify('+60 minutes'); $period_e= clone $appointment_end; $period_e->modify('-60 minutes'); $periods[] = [ 'start' => $period_start->format('H:i'), 'end' => $appointment_start->format('H:i') ]; $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $periods[] = [ 'start' => $appointment_end->format('H:i'), 'end' => $period_end->format('H:i') ]; } //for other services once The code is completely correct else{ $periods[] = [ 'start' => $period_start->format('H:i'), 'end' => $appointment_start->format('H:i') ]; $periods[] = [ 'start' => $appointment_end->format('H:i'), 'end' => $period_end->format('H:i') ]; } } else if ($appointment_start == $period_start && $appointment_end == $period_end) { if($serviceId == $color1 || $serviceId == $color3 || $serviceId == $color7 || $serviceId == $color9|| $serviceId == $color10 || $serviceId == $color11 || $serviceId == $color12){ unset($periods[$index]); $period_s= $appointment_start; $period_s->modify('+45 minutes'); $period_e= $appointment_end; $period_e->modify('-45 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; } //Open slot for service 45,45,60 else if($serviceId == $color2 || $serviceId == $color8){ unset($periods[$index]); $period_s= clone $appointment_start; $period_s->modify('+45 minutes'); $period_e= clone $appointment_end; $period_e->modify('-60 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; } // // //Open slot for service 30,45,45 else if($serviceId == $color4 || $serviceId == $color6 ||$serviceId == $color16 || $serviceId == $color18){ unset($periods[$index]); $period_s= clone $appointment_start; $period_s->modify('+30 minutes'); $period_e= clone $appointment_end; $period_e->modify('-45 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; } // // //Open slot for service 30,45,60 else if($serviceId == $color5 || $serviceId == $color17){ unset($periods[$index]); $period_s= clone $appointment_start; $period_s->modify('+30 minutes'); $period_e= clone $appointment_end; $period_e->modify('-60 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; } // // //Open slot for service 60,45,45 else if($serviceId == $color13 || $serviceId == $color15){ unset($periods[$index]); $period_s= clone $appointment_start; $period_s->modify('+60 minutes'); $period_e= clone $appointment_end; $period_e->modify('-45 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; } // // //Open slot for service 60,45,60 else if($serviceId == $color14 ){ unset($periods[$index]); $period_s= clone $appointment_start; $period_s->modify('+60 minutes'); $period_e= clone $appointment_end; $period_e->modify('-60 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ];} // //for the rest of services else { unset($periods[$index]);} // The whole period is blocked so remove it from the available periods array. } else { if ($appointment_start >= $period_start && $appointment_end >= $period_start && $appointment_start <= $period_end) { // The appointment starts in the period and finishes out of it. We will need to remove //the time that is taken from the appointment. if($serviceId == $color1 || $serviceId == $color3 || $serviceId == $color7 || $serviceId == $color9|| $serviceId == $color10 || $serviceId == $color11 || $serviceId == $color12){ unset($periods[$index]); $period_s= clone $appointment_start; $period_s->modify('+45 minutes'); $period_e= clone $appointment_end; $period_e->modify('-45 minutes'); $period['end'] = $appointment_start->format('H:i'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; } //Open slot for service 45,45,60 else if($serviceId == $color2 || $serviceId == $color8){ $period_s= clone $appointment_start; $period_s->modify('+45 minutes'); $period_e= clone $appointment_end; $period_e->modify('-60 minutes'); $period['end'] = $appointment_start->format('H:i'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; } // // //Open slot for service 30,45,45 else if($serviceId == $color4 || $serviceId == $color6 ||$serviceId == $color16 || $serviceId == $color18){ $period_s= clone $appointment_start; $period_s->modify('+30 minutes'); $period_e= clone $appointment_end; $period_e->modify('-45 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $period['end'] = $appointment_start->format('H:i'); } // // //Open slot for service 30,45,60 else if($serviceId == $color5 || $serviceId == $color17){ $period_s= clone $appointment_start; $period_s->modify('+30 minutes'); $period_e= clone $appointment_end; $period_e->modify('-60 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $period['end'] = $appointment_start->format('H:i'); } // // //Open slot for service 60,45,45 else if($serviceId == $color13 || $serviceId == $color15){ $period_s= clone $appointment_start; $period_s->modify('+60 minutes'); $period_e= clone $appointment_end; $period_e->modify('-45 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $period['end'] = $appointment_start->format('H:i'); } // // //Open slot for service 60,45,60 else if($serviceId == $color14 ){ $period_s= clone $appointment_start; $period_s->modify('+60 minutes'); $period_e= clone $appointment_end; $period_e->modify('-60 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; $period['end'] = $appointment_start->format('H:i'); } // for the rest of services else{ $period['end'] = $appointment_start->format('H:i'); } } else { if ($appointment_start >= $period_start && $appointment_end >= $period_end && $appointment_start >= $period_end) { // The appointment does not belong in the period so do not change anything. continue; } else { if ($appointment_start <= $period_start && $appointment_end >= $period_end && $appointment_start <= $period_end) { //Open slot for service 45,45,45 if($serviceId == $color1 || $serviceId == $color3 || $serviceId == $color7 || $serviceId == $color9|| $serviceId == $color10 || $serviceId == $color11 || $serviceId == $color12){ unset($periods[$index]); $period_s= clone $appointment_start; $period_s->modify('+45 minutes'); $period_e= clone $appointment_end; $period_e->modify('-45 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; } //Open slot for service 45,45,60 else if($serviceId == $color2 || $serviceId == $color8){ unset($periods[$index]); $period_s= clone $appointment_start; $period_s->modify('+45 minutes'); $period_e= clone $appointment_end; $period_e->modify('-60 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ]; } // //Open slot for service 30,45,45 else if($serviceId == $color4 || $serviceId == $color6 ||$serviceId == $color16 || $serviceId == $color18){ unset($periods[$index]); $period_s= clone $appointment_start; $period_s->modify('+30 minutes'); $period_e= clone $appointment_end; $period_e->modify('-45 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ];} //Open slot for service 30,45,60 else if($serviceId == $color5 || $serviceId == $color17){ unset($periods[$index]); $period_s= clone $appointment_start; $period_s->modify('+30 minutes'); $period_e= clone $appointment_end; $period_e->modify('-60 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ];} // // //Open slot for service 60,45,45 else if($serviceId == $color13 || $serviceId == $color15){ unset($periods[$index]); $period_s= clone $appointment_start; $period_s->modify('+60 minutes'); $period_e= clone $appointment_end; $period_e->modify('-45 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ];} // // //Open slot for service 60,45,60 else if($serviceId == $color14 ){ unset($periods[$index]); $period_s= clone $appointment_start; $period_s->modify('+60 minutes'); $period_e= clone $appointment_end; $period_e->modify('-60 minutes'); $periods[] = [ 'start' => $period_s->format('H:i'), 'end' =>$period_e->format('H:i') ];} else{ unset($periods[$index]); } } } } } } } } } return array_values($periods); } I'm getting this error for a blog script that is on my site :- PHP Fatal error: Uncaught TypeError: Unsupported operand types: string - int
The line in questions is this :- $prev = $page - 1; If I comment out this block of code the blog appears (with other errors, but I'll move on to those if I can fix this first!).
/* Setup page vars for display. */
Any idea's on what's needed to fix this script? I've contacted the original author but they haven't got back to me, I guess PHP8 maybe a little too new for them. Thanks for any help....
<!DOCTYPE html>
{ Parse error: syntax error, unexpected T_STRING in C:\xampp\htdocs\mywork\unique.php on line 15 <html> <head> <title> </title> </head> <body bgproperties="fixed"> <?php $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = ''; $con = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); $dbname = 'mywork'; mysql_select_db($dbname, $con); $sql=mysql_query(insert into users (regno,name,gender,date,month,year,emailid,cell,paddress,caddress,incometype,incomeamt,dad,fyes,dadocup,mom,myes,momocup,password) VALUES ('$_POST[regno]','$_POST[name]','$_POST[gender]','$_POST[date]','$_POST[month]','$_POST[year]','$_POST[emailid]','$_POST[cell]','$_POST[paddress]','$_POST[caddress]','$_POST[incometype]','$_POST[incomeamt]','$_POST[dad]','$_POST[fyes]','$_POST[dadocup]','$_POST[mom]','$_POST[myes]','$_POST[momocup]','$_POST[password]')"); $sql1=mysql_fetch_array($sql); $result = @mysql_query($SQl1); $result="SELECT * FROM users WHERE regno='$regno'"; while($row = mysql_fetch_array($result)) { //echo $row['regno']."regno<br>"; //echo $row['name']."name<br>"; //echo $row['gender']."gender<br>"; //echo $row['date']."date<br>"; //echo $row['month']."month<br>"; //echo $row['year']."year<br>"; //echo $row['emailid']."emailid<br>"; //echo $row['cell']."cell<br>"; //echo $row['paddress']."paddress<br>"; //echo $row['caddress']."caddress<br>"; //echo $row['incometype']."incometype<br>"; //echo $row['incomeamt']."incomeamt<br>"; //echo $row['dad']."dad<br>"; //echo $row['fyes']."fyes<br>"; //echo $row['dadocup']."dadocup<br>"; //echo $row['mom']."mom<br>"; //echo $row['myes']."myes<br>"; //echo $row['momocup']."momocup<br>"; //echo $row['password']."password<br>"; } echo "Thanks for Register!"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "1 record added"; mysql_close($con); ?> <form name="security" action="index.php" method="post"> <input type="submit" value="click here to login"> </form> </body> </html> Code: [Select] <?php mysql_connect ("-","-","-") or die ('Error'); mysql_select_db ("-"); $out = mysql_query("SELECT * FROM guestbook ORDER BY id DESC"); while($row = mysql_fetch_assoc($out); --and this one if that braces is deleted { ----this is where im getting the error $name = $row['name']; $email = $row['email']; $txt = $row['comment']; $msg = "Are you sure you want to delete"; /* @var $_REQUEST <type> */ if (isset($_REQUEST ["action"]) && $_REQUEST["action"] == "del") { $id = intval($_REQUEST['id']); mysql_query("DELETE FROM guestbook WHERE id=$id;"); echo "<action=index.php>"; } echo "<font face='verdana' size='1'>"; echo "<table border='0'> <tr><td>Name: ".$name."</td></tr>"." <tr><td>Email: ".$email."</td></tr> <tr><td colspan='2'>Comment:</td></tr> <tr><td colspan='2' width='500'><b>".$txt."</b></td></tr> <tr><td><a onclick=\"return confirm('.$msg.');\" href='index.php?action=del&id=".$row['id']."'><span class='red'>["."Delete"."]</span></a> </td></tr> </table><br />"; echo "<hr size='1' width='500' align='left'></font>"; } ?> Kindly help me please. When i delete ({) the error will become the ( i dont know what to do already. Thanks. Can anyone help me with this error? Fatal error: Call to a member function require_login() on a non-object in /home/wallls/public_html/index.php on line 27 Lines 26-33 below: <?php $smilek = $_GET['id']; $ppalout = $_GET['payout']; $healthy = array("%", "!", "=", "'", ",", "OR", "?", "<", "&", ";"); $yummy = array("", "", "", "", "" ,"", "", "", "", ""); $peee = str_replace($healthy, $yummy, $smilek); $chnpay = str_replace($healthy, $yummy, $ppalout); require_once 'appinclude.php'; require_once 'mystyle.php'; echo '<div align="center"><img src="'.$appcallbackurl.'main.png" width="300" height="150"></div>'; require_once 'ads/topads.php'; ?> <fb:tabs> <fb:tab-item href='<? echo $appCanvasUrl; ?>' title='Lottery' selected='true' /> <fb:tab-item href='<? echo $appCanvasUrl; ?>earn.php' title='Get Tickets' /> <fb:tab-item href='<? echo $appCanvasUrl; ?>payment.php' title='Payment Info' /> <fb:tab-item href='<? echo $appCanvasUrl; ?>history.php' title='Lottery History' /> <fb:tab-item href='<? echo $appCanvasUrl; ?>forum.php' title='Forum' /> <fb:tab-item href='<? echo $appCanvasUrl; ?>invite.php' title='Invite Friends' /> </fb:tabs> <div align="center"> <? $fbid = $facebook->require_login(); $theirip = $_SERVER['REMOTE_ADDR']; if ($fbid == "") { ?> I have a table with a list of users and an edit button and delete button. When the edit button is pressed on a site it passes the user_id as p_id to the page that catches it and displays the data. The problem is when I click on the "update user" button, I get the following error:
Warning: Undefined variable $the_user_id in C:\xampp\htdocs\3-19-21(2) - SafetySite\admin\edit_user.php on line 10 The weird thing is I had another update user page with a table I created that ran the query to update the table in the database just fine. But as I created it, it didn't look all that great so I recreated the page and used a bootstrap table because of the much cleaner look. Both pages have the exact same PHP code, the only difference is the bootstrap table I added in. So I'm really at a loss with this. Other than the table and PHP code, there is a script at the bottom of the page for the table itself to allow for searching within the table, i'll include that as well. The PHP code is as follows:
<?php //THE "p_id" IS BROUGHT OVER FROM THE EDIT BUTTON ON VIEW_ALL_USERS if (isset($_GET['p_id'])) { $the_user_id = $_GET['p_id']; } // QUERY TO PULL THE SITE INFORMATION FROM THE p_id THAT WAS PULLED OVER $query = "SELECT * FROM users WHERE user_id = $the_user_id "; $select_user = mysqli_query($connection,$query); //SET VALUES FROM ARRAY TO VARIABLES while($row = mysqli_fetch_assoc($select_user)) { $user_id = $row['user_id']; $user_firstname = $row['user_firstname']; $user_lastname = $row['user_lastname']; $username = $row['username']; $user_email = $row['user_email']; $user_phone = $row['user_phone']; //$user_image = $row['user_image']; $user_title_id = $row['user_title_id']; $user_role_id = $row['user_role_id']; } THE UPDATE QUERY CODE....................................................................................................................
<?php if(isset($_POST['update_user'])) { $user_id = $_POST['user_id']; $user_firstname = $_POST['user_firstname']; $user_lastname = $_POST['user_lastname']; $username = $_POST['username']; $user_email = $_POST['user_email']; $user_phone = $_POST['user_phone']; //$user_image = $_POST['user_image']; $user_title_id = $_POST['user_title_id']; $user_role_id = $_POST['user_role_id'];
$query = "UPDATE users SET "; $query .= "user_id = '{$user_id}', "; $query .= "user_firstname = '{$user_firstname}', "; $query .= "user_lastname = '{$user_lastname}', "; $query .= "username = '{$username}', "; $query .= "user_email = '{$user_email}', "; $query .= "user_phone = '{$user_phone}', "; //$query .= "user_image = '{$user_image}', "; $query .= "user_title_id = '{$user_title_id}', "; $query .= "user_role_id = '{$user_role_id}' "; $query .= "WHERE user_id = '{$the_user_id}' "; $update_user = mysqli_query($connection,$query); if(! $update_user) { die("QUERY FAILED" . mysqli_error($connection)); } } ?> THE "UPDATE USER" BUTTON THE USER CLICKS ON TO UPDATE....................................................................................................................
<div class="col-1"> <button class="btn btn-primary" type="submit" name="update_user">Update User</button> </div>
Any Help is Greatly Appreciated! Edited March 23 by ZsereneThis topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=311225.0 Hi there, I have a local server set up on my computer which I have used before and it worked flawlessly. It is running apache with PHPand mySQL set up as services. Recently I attempted to copy a project I have worked on at school onto my server. I have the database up and running, however when I try to run a PHP file it gives me the error: Quote Fatal error: Cannot redeclare getText() in C:\Server\htdocs\projects\tournament\includes\functions.php on line 20 When I rename that function (which I know is not being redeclared) I get a browser error: Quote This webpage is not available. The webpage at http://localhost/projects/tournament/index.php might be temporarily down or it may have moved permanently to a new web address. More information on this error Below is the original error message Error 101 (net::ERR_CONNECTION_RESET): Unknown error. Has anybody else experienced this error and have a solution to fix it? My guess is that it has to do with the function gettext() being available on this machine but not on the machine at school, however I thought PHP was case sensitive? |