[Solved] How to get image src in php/javascript

[ad_1] I believe the PHP code you are specifically asking for is $_FILES[“fileToUpload”][“name”] However, take a look at the tutorial from w3schools. HTML upload form <form action=”upload.php” method=”post” enctype=”multipart/form-data”> Select image to upload: <input type=”file” name=”fileToUpload” id=”fileToUpload”> <input type=”submit” value=”Upload Image” name=”submit”> </form> Php uploader <?php $target_dir = “uploads/”; $target_file = $target_dir . basename($_FILES[“fileToUpload”][“name”]); $uploadOk … Read more

[Solved] How to Print the Errors on Console?

[ad_1] showErrsInConsole([‘err1’, ‘error2’, ‘error3’]); function showErrsInConsole(array $errors) { array_walk($errors, function (&$err) { $err=”echo ” . $err; }); $errors = implode(‘;’, $errors); $exec = “gnome-terminal -x bash -c ‘$errors; sleep 1; read -n 1 -p \”press any key to close\”‘;”; `$exec`; } [ad_2] solved How to Print the Errors on Console?

[Solved] MySql database structure for : Search based on single column and different value [closed]

[ad_1] try this: create table City ( Id int, Name varchar(50) ); insert into City (Id, Name) VALUES (1, ‘Toronto’), (2, ‘Chicago’) create table Libraries( Id int, Name varchar(50), CityId int ); insert into Libraries (Id, Name, CityId) VALUES (1, ‘Toronto Library 1’, 1), (2, ‘Toronto Library 2’, 1), (3, ‘Chicago Library 1’, 2), (4, … Read more

[Solved] Show Value in pop up window

[ad_1] Get data using input id and set form delay for submit and read javascript and jquery basic concept on w3 school <html> <head> <title>Demo</title> <script type=”text/javascript” src=”http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js”></script> <script src=”http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/jquery-ui.js” type=”text/javascript”></script> <link href=”http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/themes/blitzer/jquery-ui.css” rel=”stylesheet” type=”text/css” /> </head> <body> <form name=”example” action=”” method=”post” id=”example”> <table width=”257″ border=”1″> <tr> <td>Name</td> <td><input type=”text” name=”name” id=”name” /></td> </tr> <tr> … Read more

[Solved] my query doesn’t work [closed]

[ad_1] You need to use your condition inside the if($query), but i dont think is there any need to recheck because you are already checking in Query WHERE username = $username. So i have modified your code as: Modified Code: $sql = “SELECT id, username, password FROM login WHERE username=”$username” LIMIT 1″; $query = mysqli_query($dbcon, … Read more

[Solved] Rest API w with SlimPhp take too much time

[ad_1] All frameworks are by definition slower than no-code as there’s more going on. i.e. <?php echo ‘metro’; is going to be much faster than a Slim application with this code: use \Slim\App; $config = include ‘Config/Container.php’; $app = new App($config); $app->get(‘/metro’, function($request, $response){ return $response->write(“metro”); }); $app->run(); This is because the Slim application is … Read more

[Solved] How to get the result of json into the header

[ad_1] Did you try like this? <?PHP $details1=json_decode(file_get_contents(“http://2strok.com/download/download.json”)); $details2=json_decode(file_get_contents($details1->data)); header(“Location: “.$details2->data); 10 [ad_2] solved How to get the result of json into the header

[Solved] Pipe Delimited List with numbers into array PHP

[ad_1] Here’s how I went about it for anyone else wondering $SurveyOptions = preg_match_all(‘/(\d+)-([^|]+)/’, $res[‘survey_response_digit_map’], $matches); $finalArray = array_combine($matches[1], $matches[2]); Pretty straight forward. [ad_2] solved Pipe Delimited List with numbers into array PHP

[Solved] Count visitors to website with php

[ad_1] You are truncating counterfile.txt every time you open it: w+: Open for reading and writing; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it. Source: the php manual Please note that you probably want to flock() … Read more

[Solved] hello world! implement password_verify

[ad_1] First of all, you only have to use “WHERE username =”. You don’t have to check the password when you do the request. Secondly, you have to verify the password. Finally, you should also used prepared statements, it’s more secure. So, your code should look like this (the code provided may not be usable … Read more

[Solved] Parsing Jason Object

[ad_1] Here is the final code: <?php header(“Cache-Control: no-store, no-cache, must-revalidate, max-age=0”); header(“Cache-Control: post-check=0, pre-check=0”, false); header(“Pragma: no-cache”); $url=”https://www.quandl.com/api/v3/datasets/WIKI/CNK.json?start_date=2017-11-03&end_date=2017-11-03&order=asc&transformation=rdiff&api_key=xxxx”; $content = file_get_contents($url); $json = json_decode($content, true); $name = $json[‘dataset’][‘name’]; $str_pos = strpos($name,”(“); $closing_price = $json[‘dataset’][‘data’]; echo ‘Name ‘.substr($name,0, $str_pos).'<br/>’; echo ‘Closing price ‘.$closing_price[0][4].'<br/>’; ?> [ad_2] solved Parsing Jason Object

[Solved] PHP array is having a gap when printed out

[ad_1] Your array 2nd value has newline char See Demo <?php $arr = array(1,’2′.PHP_EOL,3); print_r($arr); echo implode(” “, $arr); ?> Would produce: Array ( [0] => 1 [1] => 2 [2] => 3 ) 1 2 3 –edit– Solution : $arr = array_map(‘trim’, $arr); after $arr = explode(” “, fgets($_fp)); because when reading a file … Read more

[Solved] Curl php not loading website style

[ad_1] Because curl only gets html (source code) of specified url and i think styles are addressed relatively on server(not full path). this is why no style has been found . you can also check console in google chrome or firefox by pressing F12 on each browsers and see errors. [ad_2] solved Curl php not … Read more