[Solved] Change status from not complete into completed PHP

From my best understanding, i feel you need to manage status flag while moving from one page to another. For this you may use Session variable and initialize it with ‘not complete’ and manipulate it accordingly. For example : $_SESSION[‘Status’]=’not complete’; function menu() { if(status1 == true) { $_SESSION[‘status’] = ‘complete’; } else { echo … Read more

[Solved] need this item in table and border like this form

this is the way to wrap your already exist php code in table, try it: $e = array(“item1”, “item2”, “item3”, “item4”, “item5”, “item6”, “item7”, “item8”, “item9”, “item10”, “item11”, “item12”); $i = 0; echo “<table border=1><tr>”; //tr to start the 1st row foreach ($e as $value) { $i++; if ($i % 3 != 1) echo “<td>&nbsp;</td>”; … Read more

[Solved] PHP Message success function [HELP]

echo ‘Message Succesfully Sent!<script>$(\’response-message\’).text(\’Message Succesfully Sent!\’);var form = document.getElementById(“contact-form”);form.reset();</script>’; The error is in this part. $(\’response-message\’) should be $(\’.response-message\’). Notice the . you’re missing? You’re trying to target the ELEMENT called response-message, not the div with the class of it. 3 solved PHP Message success function [HELP]

[Solved] do I calculate the percentage of two hours?

That was the result I was looking for, thanks for your help. <?php date_default_timezone_set(‘Europe/Istanbul’); $baslangic = strtotime(“2019-11-13 00:10:00”); $bitis = strtotime(“2019-11-13 01:00:00”); $simdi = time(); if ($simdi < $baslangic) { $percentage = 0; } else if ($simdi > $bitis) { $percentage = 100; }else { $percentage = ($baslangic – $simdi) * 100 / ($baslangic – … Read more

[Solved] Ajax post returns multiple arrays with objects that have multiple values

Your ajax.php should be like this <?php foreach ($messages as $message) { $from = $message[‘contact_value’]; $text = $message[‘message’]; $date = $message[‘date’]; $num = $user[‘phone_number’]; echo json_encode(array(“from”=>$from, “text”=>$text,”date”=>$date,”num”=>$num)); ?> if you really want the quotes then use ‘ ‘ (singlequotes) instead. And the javascript file. success: function (response) { var success = $.parseJSON(response); $(“.messages-table”).append(“<tr><th>”+success.from+”</th><th>”+success.text+”</th><th>”+success.date+”</th><th>”+success.num+”</th></tr>”); } i … Read more

[Solved] Fetch Json from MySQL in Jquery calender

Depends on the programming language you are using, if you’re using Java/php, create a service method which would get the JSON from the database and return the JSONobject through ajax, and introduce it into the calendar through jquery javascript. i would also recommend you to use full calendar as its very easy to grasp. $(‘#calendar’).fullCalendar({ … Read more

[Solved] MySql query don’t work [closed]

No need to have ” for the table column , it’s needed for the variable that need to be inserted into the table column. Between, remove the ; after ). The correct code should be looked like this: $query = “INSERT INTO Zakazes( id, dateDelivery, timeCok, nameClient, phoneClient, metro, adress, comments, product, summ, skidka, result, … Read more

[Solved] I have a string : good morning*12, i want to show like this good morning and remove the numeric value included with “*”, [closed]

There are a couple of ways to do this: using explode() $old_string = “good morning*12”; $array = explode(“*”, $old_string); $new_string = $array[0]; using preg_replace() $old_string = “good morning*12”; $new_string = preg_replace(“/\*.*/”, “”, $old_string); 1 solved I have a string : good morning*12, i want to show like this good morning and remove the numeric value … Read more

[Solved] How to unset session on close page

Looks like this is too much server intensive. Something like a Long Polling! Also, PHP Sessions get automatically destroyed when the window is closed. But still if you insist, you can use something like attaching an AJAX Call with the event onbeforeunload this way: $(window).on(‘beforeunload’, function(){ $.getScript(“killsession.php”); }); This gets a JavaScript before the window … Read more

[Solved] PHP inserting data into database results in an error [closed]

Your immediate problem is that long is a reserved word. You need to wrap it in backticks, eg INSERT INTO … pribank, `long`, avbal, … See http://dev.mysql.com/doc/refman/5.0/en/identifiers.html This says nothing for the security of your application. I strongly suggest you read up on PDO, PDO::prepare() and PDOStatement::bindParam() 1 solved PHP inserting data into database results … Read more

[Solved] PDO login.php needs help finishing [closed]

The prepare statement returns an object, you can execute that object. Thus $query->execute() – the first parameter of execute can be an array. Alternatively, you can use the bindParam function first on that same $query object instead of passing an array though. Anyways, here you are: <?php if(isset($_POST[‘username’], $_POST[‘password’])){ try{ $username=”root”; $password = ”; $conn … Read more

[Solved] Undefined offset:1, 2 3 etc

$csv_array[1];, $csv_array[2]; and $csv_array[3]; don’t exists inside your $csv_array. As suggested, do a var_dump($csv_array) below $csv_array = explode(“,”, $csv_data[$i]); and see what is in there! 0 solved Undefined offset:1, 2 3 etc

[Solved] Trying to convert mysql to mysqli, not working

Just for a quick testing purpose, try this below which is a bare bones method. You can then slowly build up sanitizing and troubleshoot from thereon. <?php $username = $_POST[‘username’]; $password = sha1($_POST[‘password’]); $link = mysqli_connect(‘xxx’, ‘xxx’, ‘xxx’, ‘xxx’); $query = “SELECT password, id FROM users WHERE username=”$username” AND password=’$password'”; $result = mysqli_query($link, $query); if(mysqli_num_rows($result) … Read more