hi all i have recently purchased a script and im attempting to fix it would anyone know how to solve these 2 errors which appear to be coming from this function [09-Jun-2018 12:40:57 UTC] PHP Warning: Division by zero in /home/public_html/includes/functions.php on line 126 [09-Jun-2018 12:41:19 UTC] PHP Fatal error: Maximum execution time of 30 seconds exceeded in /home/public_html/includes/functions.php on line 135 if(!function_exists('Pagination')){ function Pagination($config=array()){ if($_SESSION['lang']=='L1'){ $firstpage = 'First'; $lastpage = 'Last'; } else{ { $firstpage = 'Trang đầu'; $lastpage = 'Trang cuối'; } } $output = ''; ////FIRST ERROR $rs_maxpage = $config['js_numrows_page']>0?ceil($config['js_numrows_page']/$config['per_page']):0; $eitherside = ($config['showeachside'] * $config['per_page']); $paga = …

Member Avatar
Member Avatar
+0 forum 2

hi all im getting the following error PHP Notice: Array to string conversion in /home/public_html/includes/database.php(23) : eval()'d code on line 1 in this file <?php $link = @mysqli_connect($hostname, $username, $password, $database); if (!$link) { die('Could not connect !'); exit(); } else{ mysqli_set_charset($link,'utf8'); } $sqlcf = 'select Variable, Value from '.$table_prefix.'site_settings where IsRead = 0'; $qrycf = mysqli_query($link,$sqlcf); if(!$qrycf) die('Can not load config data !'); elseif(mysqli_num_rows($qrycf)>0){ while($rowcf = mysqli_fetch_assoc($qrycf)){ if('filetype'==trim(strtolower($rowcf['Variable']))) $$rowcf['Variable'] = explode(',', $rowcf['Value']); elseif('numof_record_perpage'==trim(strtolower($rowcf['Variable']))) $$rowcf['Variable'] = intval($rowcf['Value']); elseif('default_language'==trim(strtolower($rowcf['Variable']))) $_SESSION['lang'] = isset($_SESSION['lang'])?$_SESSION['lang']:$rowcf['Value']; else eval("$\$rowcf['Variable'] = \"$rowcf[Value]\";"); } } else die('Can not find setting table !'); and im not sure what i …

Member Avatar
Member Avatar
+0 forum 11

hi all im attempting to update coryApp script and im getting the following error PHP Warning: Division by zero can anyone help on this please be much appreicated heres is where the error is coming from if(isset($error) && !empty($error)) echo '<p style="margin:0px; padding:5px 20px"><font color="#FF0000"><small><i>'.$error.'</i></small></font></p>'; $config['showeachside'] = 4; $config['per_page'] = 20; $config['js_numrows_page'] = mysqli_num_rows(getListState($str, '')); $config['curpage'] = empty($_GET['p'])?1:$_GET['p']; $config['rs_start'] = ($config['curpage']*$config['per_page'])-$config['per_page']; if($config['js_numrows_page'] < $config['per_page']) $config['per_page'] = $config['js_numrows_page']; $page = (isset($_GET['p']) && intval($_GET['p'])>0)?'&p='.$_GET['p']:''; $config['cururl'] = $base_url.'admincp/states.php'.$pstr; $rs_maxpage = ceil($config['js_numrows_page']/$config['per_page']); $paging = Pagination($config); $list = getListState($str, " limit ".$config['rs_start'].", ".$config['per_page']); if(mysqli_num_rows($list)>0){ and here is the function for it if(!function_exists('getListState')){ function getListState($str='', $limit=''){ …

Member Avatar
Member Avatar
+0 forum 3

hi im working on a php script and i have come across the following error does anyone have a ideal what can cause this the error is: PHP Warning: count(): Parameter must be an array or an object that implements Countable in /home/letsswin/public_html/dating_V1/dating/admincp/educations.php on line 74. the code where it comes from is : <?php if(isset($error) && !empty($error)) echo '<p style="margin:0px; padding:5px 20px"><font color="#FF0000"><small><i>'.$error.'</i></small></font></p>'; $list = getListed(array('EducationID' => 'Id', 'L1Education' => 'L1Value', 'L2Education' => 'L2Value'), array($table_prefix.'educations', 'Id')); if(count($list)>0){ ?> any help would be much appreciated ty jan x

Member Avatar
Member Avatar
+0 forum 6

hi im attempting to update a php srcipt and fixing errors and i have a error in the following block but cannot work out where if($_SERVER['REQUEST_METHOD']=='POST' && isset($_POST['smcomplete'])){ if(empty($_POST['abouth'])) $err_h = $aboutherorhis; elseif(strlen($_POST['abouth'])<6) $err_h = $datashort; else{ ERROR ON THIS LINE>>> $match = ($_POST['matchsame']=='on')?1:0;slBodyType'], $_POST['slHeightfrom'], $_POST['slHeightt $data = array($_POST['rdgender'], $_POST['slagefrom'], $_POST['slageto'], $_POST['slDatingInterest'], mysqli_real_escape_string($link,$_POST['abouth']), $_POST['slMarital'], $_POST['slReligion'], $_POST['slEducation'], $_POST['o'], $_POST['slSmoking'], $_POST['slDrinking'], $match); if(!yourmatch($data, $_SESSION['user_temp'])) $error = $errordata; else{ $_SESSION['memberid'] = $_SESSION['user_temp']; $_SESSION['memberemail'] = $_SESSION['email_temp']; unset($_SESSION['user_temp']); unset($_SESSION['email_temp']); mysqli_close($link); header('Location: '.$base_url.'members/myaccount.php'); exit(); } } } Ive attempted to put $_POST['slHeightt']; in but it doesnt solve error any ideas or solutions much appreciated many thanks …

Member Avatar
Member Avatar
+0 forum 1

Hi i have several user types i.e female, male couple etc and when they register each group goes to there own page for profile setup but when they login they go to one standard profile page that came with script how would i redirect them to there own profile page that goes with there group that they sign up into heres code to header them to profile setup page that ive already done which works if($_POST['gender']=='Couple MF') { header('location:registration2MF.php'); } else if($_POST['gender']=='Couple MM') { header('location:registration2MM.php'); } else if($_POST['gender']=='Couple FF') { header('location:registration2FF.php'); } else if($_POST['gender']=='Male') { header('location:registration2M.php'); } else if($_POST['gender']=='Female') { …

Member Avatar
Member Avatar
+0 forum 1

hi all im attempting to update some script and i have a undefined error in a page see coding for error $column = "select * "; $sql .= " from favorites where user_id = '".$_SESSION['userid']."' "; of which the information a want to echo shows up so when i put the following in if(!empty($sql)) { $sql .= " from favorites where user_id = '".$_SESSION['userid']."' "; } the information echoed no longer shows up here is the full code for this <?php include("config/db_connect.php"); include("config/ckh_session.php"); // Add user favorite list if(isset($_POST['favor_id'])) { $check_refer = mysqli_query($conn,"select favor_id , user_id from favorites where favor_id …

Member Avatar
Member Avatar
+0 forum 5

Before I get into the specific issues, I want to provide some other details: - Normally, I work on a live, paid server (even in dev); I realize that is not advised, but it is a bad habit I developed over the years. I've tried using Xammp, but do not really care for that environment for various reasons. Recently, I stopped paying for web-hosting (GoDaddy,) and have been developing various scripts on a free host. - Overall, free hosting is quite limited, that is, many do not give access to error logs, for example. There are other vital features that …

Member Avatar
Member Avatar
+0 forum 4

I've been reseraching the best way(s) to store both ipv4 & ipv6 ip addresses. Simply put, so far there seems to be much debate as to how to do so properly ranging from storing them as varchar or in a binary format. I'm really not sure at this point. I suppose I would like to hear from some folks here as to your experience doing so. Some things I need to consider: 1. At some point, I may be storing possibly millions of ips, so I do need to consider storage size in advance, obviously. 2. I also assume when …

Member Avatar
Member Avatar
+0 forum 5

newbie here! I am working with a simple PHP form with few fields and few uploads. I want to use the Modal pop up form for this. Below codes are working fine. I was able to insert the fields into MYSQL successfully but I don't know how to add file upload of docs/images into a folder and insert the URL into MYSQL. Here are my codes: Calling the Modal Form -> <button class="btn btn-success btn-lg" data-toggle="modal" data-target="#modalForm"> Add </button> The MODAL FORM -> <div class="modal fade" id="modalForm" role="dialog"> <div class="modal-dialog"> <div class="modal-content"> <!-- Modal Header --> <div class="modal-header"> <button type="button" …

Member Avatar
Member Avatar
+0 forum 5

hi i want to know how to delete duplicate rows in imported csv files in phpmyadmin in php..below is my code to import csv file in php,i want to delete duplicated rows in my imported csv files which is in database of xampp(phpmyadmin)can anyone add thecode for it <?php $user = 'root'; $pass = ''; $db = 'testdb'; $db = new mysqli('localhost',$user,$pass,$db) or die("unable to connect"); $connect = mysqli_connect("localhost", "root", '', "testdb"); echo"great work!!!"; if(isset($_POST["submit"])) { if($_FILES['file']['name']) { $filename = explode(".", $_FILES['file']['name']); if($filename[1] == 'csv') { $handle = fopen($_FILES['file']['tmp_name'], "r"); while($data = fgetcsv($handle)) { $item1 = mysqli_real_escape_string($connect, $data[0]); $item2 = …

Member Avatar
Member Avatar
+0 forum 1

I am querying a MYSQL database and would like to return the results so that all of the job numbers that are the same are grouped together and expandable when clicking on the common name. so when the bag loads all you see is a list of job numbers. I have tried lots but nothing seems to work please help. Code is attached along with screen shot of MYSQL data <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>IPL - International Procurement And Logistics</title> <link rel="stylesheet" href="../styles/login.css" media="all" /> </head> <body> <div …

Member Avatar
Member Avatar
+0 forum 2

I am using the following mysql query: CREATE TEMPORARY TABLE temp_table ENGINE=MyISAM AS (SELECT age, performance, wind,name,surname,dob,prov,pos,place,date, @curRank := IF(@prevRank = performance, @curRank, @incRank) AS rank, @incRank := @incRank + 1, @prevRank := performance, CONCAT(name,' ',surname) AS 'athlete' FROM results p, ( SELECT @curRank :=0, @prevRank := NULL, @incRank := 1 ) r WHERE event='60m' AND gender='male' AND age='senior' AND year='2017' AND wind<=2 AND wind<>'NW' ORDER BY performance ASC); SELECT @curRank := IF(@prevRank = performance, @curRank, @incRank) AS rank,@incRank := @incRank + 1 temp1,@prevRank := performance temp2, rank pos,MIN(performance) performance, wind,athlete, dob, prov, pos, place, date FROM temp_table, (SELECT @curRank …

Member Avatar
Member Avatar
+0 forum 2

I have a code that is working to show images and description. But I am trying to get it to loop through 3 pictures wide, then loop again. and display them, I am going to add pagination to the script, but before i do that i need it to loop. here is my script: include ("lock.php"); $my_que[0] = mysqli_query($bd,"SELECT * FROM `products`"); for( $i = 0; $i < mysqli_num_rows( $my_que[0] ); $i++ ) { $row = mysqli_fetch_array( $my_que[0] ); print '<div><img width="200" height="200" src="'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];.'admin/'. $row['path'] . '" / class="img-rounded">'.$row['description'].'</div><br>'; }

Member Avatar
Member Avatar
+0 forum 11

Hey everyone, I have a MYSQLI statement that i would like to add pagination to. I would like to have it set to 5 per page, and not have a negative value if you are on page 1 (disables back link) Every tutorial i have been seeing allows for a negative back and i cannot figure it out. My code is as follows and I know that i have to introduce the Pagination before the while statement and it needs to finish after the while statement.. <?php $query = "SELECT * FROM `blog_posts` ORDER BY postID DESC "; $result = …

Member Avatar
Member Avatar
+0 forum 6

ive just done a simple register form where i can check username exists and before i put the username exists in the register works but when i have the username check in it doesnt work can someone check this over for me the script and error log are as follows: with username check included <?php require 'Connections/connections.php'; ?> <?php if(isset($_POST['register'])) { $username = mysqli_real_escape_string($conn, $_POST['username']; $email = mysqli_real_escape_string($conn, $_POST['email']; $password = mysqli_real_escape_string($conn, $_POST['password']; $storePassword = password_hash($password, PASSWORD_BCRYPT, array('cost' => 10)); //username check start $username = mysqli_query($conn,"SELECT username FROM users WHERE username='$username'"); $count = mysqli_num_rows($username); if($count!=0){ die("Username already exists! Please type …

Member Avatar
Member Avatar
+0 forum 4

I have a code in two files and I want to convert it from mysql to mysqli. func.php: <?php $con = mysql_connect('*','*','*'); mysql_select_db("*",$con); function search_results($keywords){ $returned_results = array(); $where = ""; $keywords = preg_split('/[\s]+/',$keywords); $total_keywords = count($keywords); foreach ($keywords as $key => $keyword) { $keyword = strtolower($keyword); $where .= "LOWER(`keywords`) LIKE '%$keyword%'"; if ($key != ($total_keywords -1)) { $where .= " AND "; } } $results = "SELECT name, image_url, game_url, alt FROM search_games WHERE $where"; $results_num = ($results = mysql_query($results))? mysql_num_rows($results):0; if($results_num === 0){ return false; } else{ while ($results_row = mysql_fetch_assoc($results)) { $returned_results[] = array( 'name' => $results_row['name'], …

Member Avatar
Member Avatar
+0 forum 2

Guys, i am getting an unexpected T_While Error on my code, I cannot figure it out. can you help? ` <?php` $sql = "SELECT id, u_name, u_email, subj, phone FROM tb_cform "; $result = $conn->query($sql); echo '<table><tr><th>Name</th><th>Email</th><th>Subjec</th><th>Phone</th></tr>'; if ($result->num_rows > 0) {     while($row = $result->fetch_assoc()) {         echo "<tr><td>".$row["u_name"]."</td><td>".$row["u_email"]."</td><td>".$row["subj"]."</td><td>".$row["phone"]."</td></tr>";     } } else {     echo "0 results"; } echo "</table>"; $bd->close(); ?>

Member Avatar
Member Avatar
+0 forum 4

hi ive got a html table echoing through php and im having problems displaying image in the table heres what i have so far if($fetch_image['user_image']!='') { echo '<td>'.$fetch_image['user_image'].'</td>'; } else { echo '<td>'.<img src='images/blank_big.jpg' height='150px;' width='150px;' />.'</td>'; } and here is the fetch section $user_image = mysqli_query($conn,"select * from user_images where user_id = '".$fetch_user['user_id']."' and main_image = '1' "); $fetch_image = mysqli_fetch_array($user_image); and here is the error i am getting PHP Parse error: syntax error, unexpected '<' in any help on this would be much appreciated ty jan x

Member Avatar
Member Avatar
+0 forum 1

good got job nearly finished but one slight glitch i have 2 entries in database but only one is showing twice in table results how can i get to show both results heres code fetch and connection block <?php include("config/db_connect.php"); //include("config/ckh_session.php"); $sql = "SELECT * FROM meets"; $result = mysqli_query($conn, $sql); //fetch user $meets = mysqli_query($conn,"select * from meets"); $fetch_meets = mysqli_fetch_array($meets); $query = mysqli_query($conn,"select * from user"); $fetch_user = mysqli_fetch_array($query); $user_birthdate = $fetch_user['user_birthdate']; $partneruser_birthdate = $fetch_user['partneruser_birthdate']; //fetch user image $user_image = mysqli_query($conn,"select * from user_images where user_id = '".$fetch_user['user_id']."' and main_image = '1' "); $fetch_image = mysqli_fetch_array($user_image); // for …

Member Avatar
Member Avatar
+0 forum 2

SO Basically i have this problem with this test build of a little project im rewriting and so far its not looking to good I have multiple tables that are all the same, they have been set up this way for simplicity as far as i can tell. Tables +----+----------+-----------------+---------------+-------------------+ | id | sec_id | customer_name | customer_date | etc... | +----+----------+-----------------+---------------+-------------------+ | 0 | 14328778 | Somebody Once | 2/1/2016 | Role Me I | +----+----------+-----------------+---------------+-------------------+ | 1 | 14428755 | Told Me The | 2/6/2015 | Aint The Sharpest | +----+----------+-----------------+---------------+-------------------+ | 2 | 15548447 | World Was …

Member Avatar
Member Avatar
+0 forum 11

I want to collect basic user information when they land on an index page, such as: IP Country City State Zip Code I've looked into sites such as ipinfo.io that offer a service regarding these details, but think it may be easier to collect the same info via PHP. From some sample PHP code I've looked at, it seems easy and possible. My question is what would generally be a better option: PHP or using a service (the service limits the amount of hits processed per day, 10,000, so that is a consideration)? I am just looking for advice on …

Member Avatar
Member Avatar
+0 forum 4

Hello, Recently I am dealing with bad performance in an php application that I have build, googling this issue I found out that using services like memcached you can archive a huge performance improvements. The weird thing comes when I try to find a very good and detailed example I failed to find something. Could someone helps me giving a good url or example using php + mysql + memcached?! Thank you!

Member Avatar
Member Avatar
+0 forum 3

Hi, I am looking to create a MySQLi class(MVC pattern), I already have the following functions: Query, Execute, Results. Below is a PDO version of a Bind statement and was wondering if you could do the following in MySQLi or something similar in MySQLi: public function bind($param, $value, $type=''){ if(is_null($type)){ switch(true){ case is_int($value): //Thinking something like, for integer etc $type = mysqli_stmt::bind_param(i); $type = PDO::PARAM_INT; break; case is_bool($value): $type = PDO::PARAM_BOOL; break; default: $type = PDO::PARAM_STR; } } $this->stmt->bindvalue($param,$value,$type); } Then in my MySQLiUser class where I want Bind to be called $database->query(SELECT/INSERT/UPDATE/DELETE); $database->bind($type, $userName); $database->execute(); $rows = $database->results(); Any …

Member Avatar
Member Avatar
+0 forum 3

Any ideas why this is not actuall writing to the database <form method="post" action=""> <p>&nbsp;</p> <table width="300" border="0" align="center" cellpadding="0" cellspacing="10"> <tr> <td width="100" align="right"> Film Title : </td> <td><input type="text" name="Film_Title"></td> </tr> <tr> <td width="100" align="right"> Film Format : </td> <td> <select name="Format_ID"> <option>- Select Film Format -</option> <option value="1">DVD</option> <option value="2">DVD BoxSet</option> <option value="3">UMD</option> <option value="4">Bluray</option> <option value="5">Bluray BoxSet</option> <option value="6">HD DVD</option> <option value="7">HD DVD BoxSet</option> </select> </td> </tr> <tr> <td width="100" align="right"> Certificate : </td> <td> <select name="Film_Certificate"> <option>- Certificate -</option> <option value="U">U</option> <option value="PG">PG</option> <option value="12">12</option> <option value="15">15</option> <option value="18">18</option> </select></td> </tr> <tr> <td width="100" align="right"> …

Member Avatar
Member Avatar
+0 forum 2

Hey everyone, I have a question about prepared statements for PHP and mySQL. I have been able to do them for a single row such as ID and such for a particular object, but is it possible to do a SELECT all command as well? I want to be able to print out the entire table in a page, but I don't know what to do exactly. I think the issue I have is with trying to fetch it or put it in a while loop. This is what I have. What you see commented out is what I had …

Member Avatar
+0 forum 0

Here is the error it gives me Warning: mysqli::query(): Couldn't fetch mysqli in C:\xampp\htdocs\bootstrap\tickets_info.php on line 27 db problem. Warning: main(): Couldn't fetch mysqli in C:\xampp\htdocs\bootstrap\tickets_info.php on line 31 Fatal error: Wrong SQL: SELECT `Uplata`, `Dobivka`, `Date`, `sharedTime`, `match1`, `match2`, `match3`, `match4`, `match5`, `match6`, `match7`, `match8`, `match9`, `match10`, `match11`, `match12`, `match13`, `match14`, `match15`, `match16`,`Odds`, `tip1`, `tip2`, `tip3`, `tip4`, `tip5`, `tip6`, `tip7`, `tip8`, `tip9`, `tip10`, `tip11`, `tip12`, `tip13`, `tip14`, `tip15`, `tip16`, `isActive`, `ticket_id`, `isShared`, `Username`, `Liked`, `is_wined` FROM `kladilnica` WHERE Username='s' Error: in C:\xampp\htdocs\bootstrap\tickets_info.php on line 31 And here is the code: $user = getUserData('users', 'UserUsername'); $ticket = getUserData('kladilnica', 'ticket_id'); $sql …

Member Avatar
Member Avatar
+0 forum 12

hi all im in the middle of following a tutorial online for a rating system and im encountering a problem when i click a number of 1/5 to rate a topic the rating is not going into the database can someone check the code to see what going off sql tables CREATE TABLE IF NOT EXISTS `articles` ( `id` int(11) NOT NULL, `title` varchar(255) COLLATE utf8_unicode_ci NOT NULL ) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -- Dumping data for table `articles` -- INSERT INTO `articles` (`id`, `title`) VALUES (1, 'test article one'), (2, 'test article two'), (3, 'test article three'); …

Member Avatar
Member Avatar
+0 forum 3

hya all i have sorted the checkbox group out and its echoing through ok but its also echoing through userid, username twice and email address when all i want is to echo options ticked any ideals of what can be causing this please php block at top of page: <?php ini_set('session.cookie_lifetime', 86400); ini_set('session.gc_maxlifetime', 86400); session_start(); //print_r($_SESSION); include("config/db_connect.php"); //echo "<pre>"; //echo $all_interests_value = implode(",",$_POST); //print_r($_POST); if (isset($_POST['submit'])) { @$_SESSION["option1"]=$_REQUEST['option1']; @$_SESSION["option2"]=$_REQUEST['option2']; @$_SESSION["option3"]=$_REQUEST['option3']; @$_SESSION["option4"]=$_REQUEST['option4']; } $check_exist_qry="select * from interests"; $run_qry=mysqli_query($conn,$check_exist_qry); $total_found=mysqli_num_rows($run_qry); if($total_found >0) { $my_value=mysqli_fetch_assoc($run_qry); $my_stored_interests=explode(',',$my_value['interest_name']); } if(isset($submit)) { $all_interests_value = implode(",",$_POST); if($total_found >0) { //update $upd_qry="UPDATE interests SET interest_name='".$all_interests_value."'"; mysqli_query($conn,$upd_qry); } else …

Member Avatar
Member Avatar
+0 forum 6

Hello i want to make notification when new message is received, i have a row `seen` with values `0` and `1` if is 0 then its unread else is seen i got this code but when it displays the output shows the number of rows but for example i have 3 uread messages it displays `111` and not just `3` i tried with strlen to get the value but i cant please any help ? function check_messages() { global $conn; $user = getUserData('users', 'UserUsername'); $sql = "SELECT seen FROM ticket WHERE receiverName='{$user}'"; $result = $conn->query($sql); $count = 0; if(!$result){ echo …

Member Avatar
Member Avatar
+0 forum 5

The End.