PHP - Multi Url Browsing
Hi guys
I got an issue that when a link on the site is loading, the other links does not load until the previous is complete but it will work if i try on 2 different browsers. How can i browse multiple links silmultanously? Thanks Similar TutorialsAll, Looking for a way to browse and get empty directory. All the examples I see are using the: Code: [Select] <input type='file'>with extra button, but that means you can not browse for an empty directory. I'm sure there are good examples of this so would appreciate a quick shot with link to some source. Thanks! OMR This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=321494.0 Hi
I have an ecom site and some customers prefer to call with their order. I was thinking of creating an online 'shopping list' popup where they can type their order whilst browsing the site and then send via email when they're ready.
I'm not sure what to look for if there is anything like this already available. Does anybody know of any type of widget/plugin/functionality I could use for this?
Thanks
Sam
I have a made a section on my site where I can upload files to a specific directory, rename them and delete them. So I don't have to go through a FTP program. When renaming and deleting a file I connect using FTP commands with PHP, except when uploading. When uploading it gets the file that has been uploaded from the form on the page before which has its own code using <input type="file"> to search for a local file, then when submit is clicked it uploads it. Then on my PHP script it moves that file from the temp upload folder to the actual site. Bottom line is, is there any way I can make a button that opens a file browser on the users PC and returns the filepath chosen? So I can use FTP to upload the file rather than the form? Hi Chaps, I'm trying to put together a Nested Set Model (Hierarchical Data), but I have having problems when it comes to deleting/updating the 'nested' table. I'm using this as a guide: http://dev.mysql.com/tech-resources/articles/hierarchical-data.html But when trying to run a query, such as: SELECT @myLeft := lft, @myRight := rgt, @myWidth := rgt - lft + 1 FROM nested_category WHERE name = 'GAME CONSOLES'; DELETE FROM nested_category WHERE lft BETWEEN @myLeft AND @myRight; UPDATE nested_category SET rgt = rgt - @myWidth WHERE rgt > @myRight; UPDATE nested_category SET lft = lft - @myWidth WHERE lft > @myRight; I get a MySQL syntax error. This code works fine in something such as Windows Command Prompt, but not in PHP. Is there a special way to run multiple queries in 1 PHP script? Many thanks How i can delete record from table `order` and move it to `order2`
the table `order2` structure is exactly like table `order`.here is the code that i made.
<? include("connection.php"); $id_product=$_GET["pid"]; $sql_delete="DELETE FROM `order` WHERE id_product='$id_product'"; $result=mysql_query($sql_delete) or die("Error in sql due to ".mysql_error()); if ($result) header("Location: order_list.php"); ?> hello, is there a way to insert something 17 times into a database and change the 3rd field one at a time (from 1-17)? Code: [Select] $sql = "INSERT INTO picks VALUES ( NULL, '" . mysql_real_escape_string($userid) ."', '" . mysql_real_escape_string($weekid) ."', '" . mysql_real_escape_string($pickid) ."' )"; mysql_query($sql) or die('Error, Check you fields and try again.'); hi , i want to make 5 forms with 1 submit button , how i do that? thanks , Mor. common.php Code: [Select] <?php session_start(); header('Cache-control: private'); // IE 6 FIX if(isSet($_GET['lang'])) { $lang = $_GET['lang']; // register the session and set the cookie $_SESSION['lang'] = $lang; setcookie("lang", $lang, time() + (3600 * 24 * 30)); } else if(isSet($_SESSION['lang'])) { $lang = $_SESSION['lang']; } else if(isSet($_COOKIE['lang'])) { $lang = $_COOKIE['lang']; } else { $lang = 'en'; } switch ($lang) { case 'en': $lang_file = 'lang.en.php'; break; case 'de': $lang_file = 'lang.de.php'; break; case 'el': $lang_file = 'lang.el.php'; break; default: $lang_file = 'lang.en.php'; } include_once 'languages/'.$lang_file; ?> ip2locationlite.class.php Code: [Select] <?php final class ip2location_lite{ protected $errors = array(); protected $service = 'api.ipinfodb.com'; protected $version = 'v3'; protected $apiKey = ''; public function __construct(){} public function __destruct(){} public function setKey($key){ if(!empty($key)) $this->apiKey = $key; } public function getError(){ return implode("\n", $this->errors); } public function getCountry($host){ return $this->getResult($host, 'ip-country'); } public function getCity($host){ return $this->getResult($host, 'ip-city'); } private function getResult($host, $name){ $ip = @gethostbyname($host); if(preg_match('/^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:[.](?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$/', $ip)){ $xml = @file_get_contents('http://' . $this->service . '/' . $this->version . '/' . $name . '/?key=' . $this->apiKey . '&ip=' . $ip . '&format=xml'); try{ $response = @new SimpleXMLElement($xml); foreach($response as $field=>$value){ $result[(string)$field] = (string)$value; } return $result; } catch(Exception $e){ $this->errors[] = $e->getMessage(); return; } } $this->errors[] = '"' . $host . '" is not a valid IP address or hostname.'; return; } } ?> index.php Code: [Select] <?php include_once('ip2locationlite.class.php'); //Set geolocation cookie if(!$_COOKIE["geolocation"]){ $ipLite = new ip2location_lite; $ipLite->setKey('*****************'); $visitorGeolocation = $ipLite->getCountry($_SERVER['REMOTE_ADDR']); if ($visitorGeolocation['statusCode'] == 'OK') { $data = base64_encode(serialize($visitorGeolocation)); setcookie("geolocation", $data, time()+3600*24*7); //set cookie for 1 week } }else{ $visitorGeolocation = unserialize(base64_decode($_COOKIE["geolocation"])); } var_dump($visitorGeolocation); ?> im using this http://ipinfodb.com/ in index.php i got this message array(5) { ["statusCode"]=> string(2) "OK" ["statusMessage"]=> string(0) "" ["ipAddress"]=> string(13) "94.68.211.211" ["countryCode"]=> string(2) "GR" ["countryName"]=> string(6) "GREECE" } how to switch automatic if GR go to index.php?lang=el if DE go to index.php?lang=de etc... Hello friends, I've tried to search over the Internet but didn't found any tutorial how to do the following :- let say we have form with input username and input email just 2 field HTML Code Code: [Select] <form> <table> <tr> <td>Username :</td> <td><input id="username" size="20" type="text" name="username"></td> </tr> <tr> <td>Email :</td> <td><input id="email" size="20" type="text" name="email"></td> </tr> </table> </form> As you can see no submit button cause we will only check out if username and/or email is not stored already, by using ajax My problem : i can only check out for username (1 field) but i can not check for 2 fields or more and i want to know how to apply it for 2 fields (username and email) Here is my idea for only one field (username) I'll add in the HTML code this Code: [Select] <td><div id="status"></div></td> and will add this java code Code: [Select] <SCRIPT type="text/javascript"> pic1 = new Image(16, 16); pic1.src = "loader.gif"; $(document).ready(function(){ $("#username").change(function() { var usr = $("#username").val(); if(usr.length >= 4) { $("#status").html('<img src="loader.gif" align="absmiddle"> Checking availability...'); $.ajax({ type: "POST", url: "check.php", data: "username="+ usr, success: function(msg){ $("#status").ajaxComplete(function(event, request, settings){ if(msg == 'OK') { $("#username").removeClass('object_error'); $("#username").addClass("object_ok"); $(this).html(' <img src="tick.gif" align="absmiddle">'); } else { $("#username").removeClass('object_ok'); $("#username").addClass("object_error"); $(this).html(msg); } }); } }); } else { $("#status").html('<font color="red">The username should have at least <strong>4</strong> characters.</font>'); $("#username").removeClass('object_ok'); $("#username").addClass("object_error"); } }); }); </SCRIPT> Explain : it will get the input of username and will send it to check.php Now check.php code (should have all usernames that will compare with it) Code: [Select] <?php if(isSet($_POST['username'])) { $usernames = array('john','michael','terry', 'steve', 'donald'); $username = $_POST['username']; if(in_array($username, $usernames)) { echo '<font color="red">The username<STRONG>'.$username.'</STRONG> is already in use.</font>'; } else { echo 'OK'; } } ?> Now it is very clear , if will automatic check the username now my problem is how to apply it for also email hello all, i have been sitting here googleing and googling but i can't seem to find what im looking for. i am tring to create a personal site that lets me note services i do for my cars. I have multiple tables (cars, color, mfg, ...) in the main table cars i insted of putting the color black i put and int(11) of 1 which is suppose to "if statement" to the table colors and produce the correct color. same for mfg. although nothing i have tried has helped i always just have the else of the if echoed out. i have heard of union and join left right i am so unsure of what is need any insite would be useful. thanks in advance. Whats the most efficient way of searching within a multi dimensional array? My Array = Array ( => Array ( => Item 1 [title] => Item 1 [1] => 2012-03-21 [eventDate] => 2012-03-21 [2] => 21 [eventDay] => 21 ) [1] => Array ( => Item 2 [title] => Item 2 [1] => 2012-03-21 [eventDate] => 2012-03-21 [2] => 21 [eventDay] => 21 ) ) String to find = '21' If (MY ARRAY contains STRING TO FIND) {} Clearly in this case there are several '21' (s) so if I only wanted to search the [eventDay] keys...would there be a fast effective and efficient manner? Thoughts and help gratefully received. Will Okay, I currently have a query that is like: Code: [Select] $sql = "SELECT SQL_CALC_FOUND_ROWS a.ItemID, a.spec, a.description, a.sport, a.category, a.price, a.unit_qty, a.is_visible, a.AdminID, b.name, b.ItemID as catID, c.Name as nameSport, c.ItemID as sportID FROM purchase_request_category_item as a LEFT JOIN purchase_request_category as b ON b.itemID = a.category LEFT JOIN ro_school_sports as c ON c.ItemID = a.sport WHERE a.AdminID = '".$dist."' GROUP BY a.ItemID, b.name, c.Name ORDER BY a.ItemID DESC LIMIT ". $start.",".$limit; I am building a custom search function which I intend to be able to change the WHERE line to: WHERE a.AdminID = '".$dist."' ".$query $query will be created via if statements for every element in the form which will be called either by the button on the form, or the links in my pagination. The form would have the following: Level(s): dynamic field, Multi Select Status: Both/Enabled/Disabled single select Sports: dynamic field, Multi Select Category: dynamic field, single select. the sport column is a single selected item on the add page, its of type int(11) the levels table, is also a multi select on the add item page, and is of the type set('1','2','3','4','5','12','13') So real question is I guess, how on earth do I work with these 2 multi selects to create this search? I am having a hell of a time getting this to work. I need the keys in an array to be specific, not a sequential number or a row in my database. I need to add to the array through each loop of my while() statement. This code does it, but does not use the keys I specify, after the first entry, it starts assigning numbers to keys. Any guidance would be great. <?php require_once ('includes/config.php'); require_once ('includes/connect.php'); $echoarray = array(); $resultsql = mysql_query("SELECT * FROM clients")or die(mysql_error()); while($row = mysql_fetch_array($resultsql)){ if(empty($echoarray)){ $echoarray = array( 'id' => $row['ID'], 'name' => $row['First_Name'] . " " . $row['Last_Name'], 'price' => $row['Status'], 'number' => $row['Sex'], 'address' => $row['Phys_Street'], 'company' => $row['Agency'], 'desc' => $row['Notes'], 'age' => $row['Date_Birth'], 'title' => $row['Occupation'], 'phone' => $row['Phone'], 'email' => $row['Email'], 'zip' => $row['Phys_Zip'], 'country' => $row['Phys_City'] ); } else { array_push($echoarray, $echoarray['id'] = $row['ID'], $echoarray['name'] = $row['First_Name'] . " " . $row['Last_Name'], $echoarray['price'] = $row['Status'], $echoarray['number'] = $row['Sex'], $echoarray['address'] = $row['Phys_Street'], $echoarray['company'] = $row['Agency'], $echoarray['desc'] = $row['Notes'], $echoarray['age'] = $row['Date_Birth'], $echoarray['title'] = $row['Occupation'], $echoarray['phone'] = $row['Phone'], $echoarray['email'] = $row['Email'], $echoarray['zip'] = $row['Phys_Zip'], $echoarray['country'] = $row['Phys_City'] ); } Any Ideas? In javascript you can do multiple methods on the same line like: if(document.getElementById('myElement').className.match(/^[0-9]/)){/*Do something*/} in that we have getElementById() and match() on the same line, and it works the same as if you were to split them on multiple lines. Is it possible to do that with php? For example: $obj = new MyObject(); $obj->add(2, 3)->to_string(); l have a video site, and each title is generated dynamically on a <li>. The problem is some titles are longer than others and spill on to the next <li> throwing my site all off. What i need to do is designate 2 lines for the titles just in case the title is too long. Code: [Select] <ul> <li><?php echo $title; ?></li> <li>///continue $title or add blank line so it doesn't throw everything off</li> </ul> i want to edit a product and allocate industries to a product refer following link to view http://meriwebsite.net/envytech/admin/industryallocate.php?pageNum=1SELECT%20a.products_id,%20a.products_image,%20b.language_id,%20b.products_description,%20b.products_name%20%20%20FROM%20products%20a%20,%20products_description%20b%20WHERE%20a.products_id%20=%20b.products_id%20and%20language_id=1%20and%201%20order%20by%20%20b.products_id,%20%20b.products_description I can update prouct name and serial number but cannot get values for industries the do while loop for industry display is given below (displaying industry id before check box here) $iquery="SELECT * from industry "; mysql_select_db($database_DBconnect, $DBconnect); $iResult = mysql_query($iquery, $DBconnect) or die(mysql_error()); $irows = mysql_fetch_assoc($iResult); $itotalrows=mysql_num_rows($iResult); $j=-1; do { $j++; ?> <br /><?php echo "id=". $irows['id'];?><input name="ind[$i][$j]" type="checkbox" class="vardana12" id="ind[$i][$j]" value="<?php echo $irows['id'];?>" /> <?php echo $irows['name'];?> <?php } while ( $irows = mysql_fetch_assoc($iResult) ); ?> I am trying to display values using following code if ( (isset($_POST['sub'] )) or (isset($srno['sub'] ))) { echo "<br> count=".count($_POST['srno']); for($i=0; $i< count($_POST['srno']); $i++){ echo "on 'save' clicked <br>"; echo "<br> products ".$_POST['products_id'][$i]; echo "<br>srno ". $_POST['srno'][$i]; echo "<br>industry ".print_r($_POST['ind'][$i]); echo "<br>product name ". $_POST['products_name'][$i]; Updateindustry($_POST['products_id'][$i], $_POST['srno'][$i],$_POST['industry'][$i],$_POST['products_name'][$i]); } $update=1; $alert= "udation done"; } I am not getting correct values for $_POST['industry'][$i] please help What am I missing here? The array: protected $form_bonus = array( "Attacker" => array( "Ashwin" => array( "normal" => 1.15, "rps" => 1.38), "Cordelon" => array( "normal" => 1.15, "rps" => 1.38), "Mersan" => array( "normal" => 1.15, "rps" => 1.38), "Phlanixian" => array( "normal" => 1.195, "rps" => 1.494), "Slythe" => array( "normal" => 1.15, "rps" => 1.38) ), "Defender" => array( "Ashwin" => array( "normal" => 1.15, "rps" => 1.38), "Cordelon" => array( "normal" => 1.15, "rps" => 1.38), "Mersan" => array( "normal" => 1.15, "rps" => 1.38), "Phlanixian" => array( "normal" => 1.15, "rps" => 1.38), "Slythe" => array( "normal" => 1.15, "rps" => 1.38) ) ); accessing it: $bonus *= form_bonus[$this->role][$this->race]['rps']; error: PHP Parse error: syntax error, unexpected '[' How do I do this? It only does the first nine records and wont cycle through the many records in the second dimension. Thanks. // External Loop is 1 - 9 // Internal Loop is 0 - whatever it is //$muarray_s[0] = $facility_id; //$muarray_d[$external_loop][$interal_loop] = $objfields['139339_date']; //$muarray_t[$external_loop][$interal_loop] = $objfields['139339_time']; //$muarray_i[$external_loop][$interal_loop] = $objfields['139339_main_id']; //$array_of_mu[$external_loop][$interal_loop] = $checklist_item_disc; echo "Begin Draw Runway Image Function <br>"; echo "Establish Array Looping Procedure"; for ($j=0; $j<10; $j=$j+1) { // External Loop // This is actually the Condition not the mu for ($k=0; $k<count($array_of_mu); $k=$k+1) { // Internal Loop // This is the Mu Value; echo "Mu Value is ".$array_of_mu[$j][$k]."<br>"; } } |