WinstonLA
-
Posts
23 -
Joined
-
Last visited
Posts posted by WinstonLA
-
-
Change name for second variable in the foreach
foreach ($swap["sims"] as $swap)
foreach ($swap["sims"] as $swap)
This formatting looks better
<select name="sim_for_swap[]"> <?php foreach ($swap["sims"] as $item): ?> <option value="<?php echo $item['voice']; ?>"> <?php echo $item['voice']; ?> </option> <?php endforeach; ?> </select>
-
Instead
$('.likestatusclass').click(function(x){
use
$('body').on('click', '.likestatusclass', function(x){
This should solve the problem.
-
-
For PHP >= 5.3 you should use preg_* functions instead ereg(), instead of eregi() you should use preg_* funcitons with modificator i
In your case you need use preg_match with modificator i
-
Try to add CURLOPT_PORT
curl_setopt($ch, CURLOPT_PORT, 84);
-
Open init.js file, find the line with code
var finalDate = '2016/01/01';
And change finalDate to what you need
-
Before using $_POST[ 'modsToBeChecked' ] you need check if this element is exists
if(isset($_POST[ 'modsToBeChecked' ])) { //Element exists, you may use it }
-
@Asumi
You're welcome
Please mark this topic as answered if you can do it
-
OK. Try comment this line $anime = $file = str_replace(' ', '\ ', $anime);
And after line $anime = "Sous-titres/".$anime."/"; write var_dump(file_exists($anime)); this will show that is there that directory. If so than uploading should be successful, if no, you need find that path that is will be returned true by file_exists() function.
-
As I know filename can't be Akame\ ga\ killFilename.jpg because Akame\ ga may be considered as a directory.
You should avoid slashes in filenames or create appropriate directories and then specify slashes in filename
-
Maybe the directory that you're trying upload file in, hasn't write permissions.
Set error reporting level to
error_reporting(-1);
May some errors will be output
-
I don't understand what problem? Did you never see default parameters for functions?
-
I don't quite understand... Do you trying do F5 protection?
-
@Barand
Thanks for benchmark
-
I just looked at http://php.net/manua....preg-match.php but didn't really understand it
Regular expressions is a magiс, not all can understand it xD
In the end I need a string (it can be one of the array elements)
You can get access to the string in array specify array key index. No problem
link me to a good source of info on preg_match
You need not preg_match() but regular expressions before. Good book about it http://shop.oreilly.com/product/9780596528126.do
-
After email added, add redirect
header('Location: some_location?added=ok');
And where it need add checking
if(isset($_GET['added']) && $_GET['added'] == 'ok') { echo 'Email was added successfully'; }
It is the simplest way
-
String functions that you're using will be more performance than RegExp used me xD
-
$page = file_get_contents("http://www.curse.com/mc-mods/minecraft/railcraft"); preg_match('#<li class="newest-file">(.*?)</li>#is', $page, $version); echo '<pre>' . htmlspecialchars(print_r($version, 1)) . '</pre>';
The result is
Array ( [0] => <li class="newest-file">Newest File: Railcraft 9.4.0.0</li> [1] => Newest File: Railcraft 9.4.0.0 )
Or like this
preg_match('#<li class="newest-file">.*([0-9\.]++).*</li>#Uis', $page, $versionNum); echo $versionNum[1]; //9.4.0.0
If you need only version number -
OK
- session_start() must be at first line of your file
- Check your the files ecoding. If it UTF-8 check that it should be UTF-8 Wihtout BOM
These rules compliance?
-
Try like this
for ($i = 0; $i < $k; $i++) { $z = $i + 1; //fetch data from database $id = 'the id of the row that the entry/item is at'; $item_name = 'the name of the item'; $current_quantity = 'the current quantity of the item'; //create a table of entries echo '<tr> <td>' . $z . '</td> <td>' . $item_name . '</td> <td>' . $current_quantity . '</td> <td> <select id="quantity' . $i . '" name="quantity"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> </select> </td>'; echo '<td> <button type="button" value="' . $id . '" name="updatebtn" class="quantity_updatebtn">Update Quantity</button> </td>'; echo '</tr>'; }
$(document).ready(function(){ $('body').on('click', '.quantity_updatebtn', (function(){ //i use this value to find the exact entry in the database var id = $(this).attr('value'); var quantity_selected = $(this).closest('tr').find('select[id^="quantity"] option:selected').val(); $.ajax({ type: "POST", url: "js/ajax/updatequantity.php", data: {id: id, new_quantity: quantity_selected} }); //this is for testing alert('ok'); }); });
-
Also you can use file_get_contents() (if server configuration enabled allow_url_fopen setting) + RegExp
-
OUTPUT:
PHP Notice: Undefined index: age in session.php on line 3
PHP Warning: Invalid argument supplied for foreach() in session.php on line 3
I can't see session_start() in your file1.php, therefore age key don't saving in session.
foreach to create dropdown list problem
in PHP Coding Help
Posted · Edited by WinstonLA
Hm...
Try this code
Something is outputting on the screen?
If so, go back to your code and open (Ctrl+U) code of you page and find there your select tag. Will there be any options?