import Sakila Database to PhpMyAdmin

I Want Import Sakila DB to PhpMyAdmin In Windows But I Can’t , I can import Schema to phpmyadmin in import section but i dont can import sakila data to that , when i want import data to phpmyadmin it has error with this content No data was received to import. Either no file name was submitted, or the file…
Read more

Preventing SQL Injection in PHP without parameterized queries?

I know this topic has been covered to death but I would like some feedback from the community regarding security within our web application. We have standard LAMP stack web app which contains a large number of database queries which are executed using mysqli_query. These queries are not parameterized and at the moment but there is some naive escaping of…
Read more

read and compare data through a while loop in php

I work with oracle database and php.I want to select all values of a field from one table.and then compare them in a while loop to find the biggest one(they are numbers).what should I do?I will show my code: $dql=”SELECT T21_5 FROM T21″; $dqlresult=oci_parse($conn,$dql); oci_execute($dqlresult); $rew=oci_fetch_assoc($dqlresult); $max=0; while($rew){ if($max>$rew[‘T21_5’]){ $max=$max; }else{ $max=$rew[‘T21_5’]; } } Source: php

How to read this object in php to retrieve email

This just one loop but I want retrieve all the emails. GuzzleServiceResourceModel Object ( [structure:protected] => [data:protected] => Array ( [type] => user.list [pages] => Array ( [type] => pages [next] => [page] => 1 [per_page] => 50 [total_pages] => 234 ) [users] => Array ( [0] => Array ( [type] => user [id] => 560b99861cf5c8112a00012e [user_id] => [anonymous]…
Read more

Converting a string to UNIX standard

Problem I have a bunch of strings that I’d like to convert to a lower-case-and-dashes-only format. Example “Some Example” => “some-example” “Some example with sp3c!als and number5” => “some-example-with-sp3c-als-and-number5” Question Is there some sort of library that does this for you, in PHP? Obviously, my mind went to regex first, but that seems like shooting a fly with a bazooka….
Read more

Advanced Search Form Results URL Friendly

i have a search form where there is one input box and 2 select box´s, i need my search form result to be url friendly, and its working fine, almost fine, the only problem is in the search form when i search by a category, is search by the id of the column, so the url always ends with the…
Read more

How to remove the extra line when using PHP SplFileObject and READ_CSV flag?

When iterating over a csv file using PHP SplFileObject and the READ_CSV flag I get an extra row with a null value. Is there a way to remove this line automatically? $file = new SplFileObject(__DIR__.’/technologies.csv’, ‘r’); $file->setFlags(SplFileObject::READ_CSV); foreach ($file as $row) { var_dump($row); } This will produce a row with a null value. … array(1) { [0] => NULL }…
Read more

Recursive(?) algorithm design

I have a requirement to allow my end users to input formula much like a spreadsheet. I have an array like this: $table = array( 1=>array( “id”=>1, “Name”=>”Regulating”, “Quantity”=>”[2]Quantity+[3]Value”, “Value”=>”[2]Cost” ), …) The first level array key is always the same value as the id key in that array. A tabulated example follows: id Name Quantity Value 1 Regulating [2]Quantity+[3]Value…
Read more

PHP date() returning empty string

I have the following function, which I’m sure was working when I wrote but haven’t looked at for some time. function updateDate_last_notification($id) { echo “taskID = $id”; global $DB_HOST; global $DB_NAME; global $DB_USER; global $DB_PASS; $conn = new mysqli($DB_HOST, $DB_USER, $DB_PASS, $DB_NAME); if ($conn->connect_error) { die(“Connection failed: “.$conn->connect_errno); } $date = date(“Y-m-d”); $sql = “UPDATE tasks SET last_notification = ‘$date’…
Read more