[Solved] Myqli php login [duplicate]

You should have a database name for mysqli_connect. So, go like this: $connect=mysqli_connect(‘localhost’,’root’,”,’databse_name’); and why are you using __mysqli_ston for?Use this instead $query = mysqli_query($connect, “SELECT * FROM users WHERE username=”$username””); Do not use __mysqli_ston. This should work.If doesn’t work,get back to me. solved Myqli php login [duplicate]

[Solved] PHP Strip specific keys in array

Assuming that you want to so something(remove Arrival) on each of the values, you can use this: <?php $results = array ( ‘date’ => ’22. jan.’, ‘flightNumber’ => ‘EZY6747’, ‘airline’ => ‘easyJet’, ‘from’ => ‘Belfast International’, ‘plannedArrival’ => ’18:35′, ‘realArrival’ => ‘Estimated Arrival 18:32’ ); $result2 = array_map(function($s) { return str_replace(‘Arrival ‘, ”, $s); }, … Read more

[Solved] Issue with returning the last 10 lines of a file in PHP

If the problem is missing line breaks (not clear from the question) wrap everything in <pre>. echo ‘<pre>’; echo `tail /home/food.txt`; echo ‘</pre>’; Edited to add: <pre> will give you a monospace font by default; you can fix that easily with CSS if it’s a problem. solved Issue with returning the last 10 lines of … Read more

[Solved] How to Upload Image files Using Codeigniter? [closed]

Here is an example. Hope this would help you 🙂 in your controller. lets say upload.php public function upload() { if($this->input->post(‘upload’)) { $config[‘upload_path’] = APPPATH . ‘your upload folder name here/’; $config[‘file_name’] = filename_here; $config[‘overwrite’] = TRUE; $config[“allowed_types”] = ‘jpg|jpeg|png|gif’; $config[“max_size”] = 1024; $config[“max_width”] = 400; $config[“max_height”] = 400; $this->load->library(‘upload’, $config); if(!$this->upload->do_upload()) { $this->data[‘error’] = … Read more

[Solved] How do i multiply values of an array

You are not reconstructing an array in your foreach loop. So your $od variable does just get overridden each time you loop. Your code should be foreach($_POST[‘gm’] as $key => $answer) { if($answer != ”) { $odd = explode(” “,$answer); $od[] = trim($odd[0]); } } $total = array_product($od); echo $total; 0 solved How do i … Read more

[Solved] WordPress Prevent 404 page for private posts

If you don’t already have a custom 404 page, simply generate the template file in your WordPress theme. https://codex.wordpress.org/Creating_an_Error_404_Page Regardless of whether or not you are going to prompt users to log in to view your private posts or not, creating a 404 page that’s styled to match your site’s brand is strongly recommended. As … Read more

[Solved] How to search duplicate value in array

You can do it with simple for loop : $arr = array([“id” => 7, “a” => “”], [“id” => 6, “a” => “AAA”], [“id” => 4, “a” => “AAA”]); $ans = []; foreach($arr as $elem) $ans[$elem[“a”]][] = $elem[“id”]; This will output associative array with the “a” value as keys – if you only want to … Read more

[Solved] select what is being shown on index, Php [closed]

I’ll try to get you on the right way. But you’ll have to try and update it yourself to suit your needs. Below code could be your index page. <?php if(isset($_POST[‘submit’])) { $page = $_POST[‘page’]; } else { $page=”home”; } ?> <form method=”post” action=”<?php echo $_SERVER[‘PHP_SELF’]; ?>”> <select name=”page”> <option value=”home”>Home</option> <option value=”something”>Some other page</option> … Read more

[Solved] How to use variables of one php file in to an other [closed]

Very urgently? than very urgently use $_SESSION Store the value in a session like this $_SESSION[‘whatever’] = $value_holder; Note: Don’t forget to use session_start() at the very top of your website, also you need to use conditions to increment decrement value of that session 0 solved How to use variables of one php file in … Read more

[Solved] How do I convert arrays into functions in PHP? [closed]

function states() { return array( “ct”=>”Connecticut”, “ma”=>”Massachusetts”, “nj”=>”New Jersey”, “ny”=>”New York”, “ri”=>”Rhode Island” ); } function destinations() { return array( “easterncaribbean”=>”Eastern Caribbean”, “southerncaribbean”=>”Southern Caribbean”, “westerncaribbean”=>”Western Caribbean”, “bermuda”=>”Bermuda”, “bahamas”=>”Bahamas” ); } $states = states(); $destinations = destinations(); Is this what you were after? Functions are just recyclable snippets of code, so make sure you remember that. … Read more

[Solved] I am designing signup page, every time it displays your password dont match

Important note If you’re using this code for anything requiring real security (i.e. not just a student project) MD5 is not an appropriate hashing algorithm. Read through the OWASP advice to learn how to do this properly. Answering your question You have: $psd= md5($_POST[‘psw’]); $confirm_psd= $_POST[‘confirm_psw’]; if ($psd == $confirm_psd) { … which looks like … Read more