PHP - Lots Of Exploding
I am trying to get more than one row from a database at once, then explode each value into a seperate variable. is there a way of doing this?
Similar TutorialsI need to explode data separated with text separators, like this: banana|carrot|salmon|oak|tuna|apple|elm|pineapple So far so good with this: <?php $items = explode('|', $stuff); foreach($items as $key=>$value){ ?> But now I need a list, with categories from another table (column1=items, column2=corresponding categories) and order by categories (not worried about the order of the items under each category), like this: FISH salmon tuna FRUIT banana apple pineapple TREE oak elm VEGETABLE carrot Any suggestions on an approach would be appreciated. I'm foggy about creating arrays, but I think I need one here? $characterIDs = explode(',', $_POST['characterIDList']); After the explode I want to take all those values and do a select statement in a database table for any of the values that match any of the values inside that variable variable. Not sure how to do this since there is no limit to how may there could be. Hello, I fetch information from an URL, and this is the output I get using cURL (there's no other way I can get it): Quote 4377.54,11069.02,13.15,3,101,11342,1512492 Now I want to explode this, but I can't directly explode this using explode. How do I do this? Once I use curl_exec it is always displayed. Regards, NLCJ Heres the code of the line im trying to trim
$r = mysql_query("insert into points values ('','${v[0]}', ${v[1]}, '$At')")or die (mysql_error()); mysql_query("insert ignore into toc values ('','$p1', '$At'),('','$p2', '$At'), ('','$p3', '$At'), ('','$p23', '$At')") or die (mysql_error()); if (!$r) die (mysql_error());the line pertaining to the question is the insert into points . what that part of the code does is takes this preformatted text START POINTS MrsSpacely 1 nanatravels 1 Trust_Me_honey 2 moratala 3 xxBIGDAVExx 3 Spring_Chicken 5 tomrarose 5 sitdownnplay 7 _Antoinette_ 11 Melyn 25 mokan40 30 dj_lia 10 STOP POINTS And inserts it into the points table. Which works fine but if you put a space after Stop points or before any name it comes back with an error about check spaces, and doesnt post the whole thing what i need to do is trim all the spaces from the text before it tries to go into the table I have the following code which has deliimiters of |||| and I need to break it apart into three strings and have a variable assigned to each string. I've tried exploding it but won't dynamically increase the variable. I know at one point about a year ago I used something like $var.=$foo and the $var would increase $var1, $var2, etc... Here's the string I need to break.j (And the string will be different every time, and some will have 2 string delimited some will have 20, and some inbetween. The rich contemporary style of the "Theo" Counter Height Table combines faux marble and a warm finish to create dining room furniture that adds an exciting style to the decor of any home. The thick polyurethane coated faux marble table top perfectly accentuates the warm brown finish flowing over the straight-lined contemporary design of the apron and legs to help create an exceptional dining experience. With the beautiful stitching and button tufting details of the faux leather upholstered bar stools, the "Theo" Counter Height Table is a refreshing addition to any home.||||Table top made with polyurethane coated print marble. Aprons and legs made from select veneer and solids with a warm brown finish. Chair is upholstered in a brown PVC with accent top stitching. D158-233 bar stool dimension: 18"W x 21"D x 40"H.||||Click here for complete image download listing for series D158. In a perfect world it would be: Code: [Select] $desription1="The rich contemporary style of the "Theo" Counter Height Table combines faux marble and a warm finish to create dining room furniture that adds an exciting style to the decor of any home. The thick polyurethane coated faux marble table top perfectly accentuates the warm brown finish flowing over the straight-lined contemporary design of the apron and legs to help create an exceptional dining experience. With the beautiful stitching and button tufting details of the faux leather upholstered bar stools, the "Theo" Counter Height Table is a refreshing addition to any home."; $description2="Table top made with polyurethane coated print marble. Aprons and legs made from select veneer and solids with a warm brown finish. Chair is upholstered in a brown PVC with accent top stitching. D158-233 bar stool dimension: 18"W x 21"D x 40"H.": $description3="Click here for complete image download listing for series D158."; Hi, I've been asked to modify a section on a site for a local club. Basically, I've been asked to improve the name input section (a user may have to input up 15 names in one visit to the site). At the moment the site works like this: The user enters one members first name in one form box, then the surname in another, then presses "add name" which adds it to the list. What i want to be able to do (and i'm sure i've seen it somewhere), is have the user enter the list of names into one big text area: Type in the first name then the surname, hit enter for a new line in the text area then type the next name....etc. When the list is complete press "add names" button. Is there a name for this type of input? And does it work on the following principle: 1. The entire text sent from the text area can be exploded into an array using the line break as the delimiter 2. Each value in the array is then the first name and second name. 3. I can then explode each value further now using the space as the delimiter. 4. I am left with a bunch of arrays containing the first name in one value and the surname in the second Any help or pointers here would be class Cheers, John Hey guys! im currently learning javascript, PHP and SQL. I have a pretty solid understanding of HTML and CSS. I want to make a site similar to facebook (a good facebook). this is going to be a big project and i plan on moving to a bigger server system in a year or so to keep up with demands.
Heres how the site will function:
1. Basic registration/splash page. I understand that the finished form is sent to a php file on the server side, correct? (ill change my server name files of course)
2. after the registration page, while the user is logged in with their new account, there are 3 pages after that that explain what the website is all about and how to use it. the last page allows the user to setup their profile information, ask friends to join, and asks what type of things they like. After the last page, it sends the user to their main control panel, where social media feed can be seen, friends and online chats, news, advertisements, links, pages and groups (think facebook and linkedin)
3. the user will have the ability to look at their profile (not the control panel), and of course switch back to their control panel. social media, friends, groups and ads will also be on their individual profile page as well.
4. i want the site to have two views: a standard view and an enhanced view. the enhanced view will reposition divs and all that stuff so they can see a background image (either stock or one they uploaded) this image will eventually change to an animated image of a 3d environment.
5. the site is going to be heavily social media based. This means social media feeds, image uploading, a structured comment system, a friend system, search functions and targeted advertising.
This is obviously a lot to ask, but since their is so much to learn related to PHP and SQL, can someone point me to the right tutorials on how to get these things done? I am currently learning javascript, PHP and SQL on lynda.com. Expect me to be on this forum a lot and asking a lot of questions. Thanks for any help.
Edited by PHPlearner32, 10 January 2015 - 11:19 PM. First, I gotta say I am new to JavaScript, but not new to languages like PHP/C++.
I am working on a large huge JS file that has a lot of things and I have a feeling that it can be made better. How is where I am at a loss. If it was PHP, I'd split that JS file into probably 20 other smaller JS files, aka "classes", and it may or may not be the right thing to do, but let me focus on one particular aspect for now, and maybe deal with others later.
Here is the piece of code that bugs the me most (truncated for clarity):
if (selection[index].selected) { result += '<TABLE class="list_grey" style="float: left; margin-left: 20px;">'; result += '<TR>'; result += '<TH colspan="2">Data</TH>'; result += '</TR>'; var flag = "All"; if (selection[index].flag == 'P') flag = "Premium"; result += '<TR>'; result += '<TD>Flag</TD>'; result += '<TD>' + flag + '</TD>'; result += '</TR>'; result += '</TABLE>'; } else { result += '<TABLE class="list_grey" style="float: left; margin-left: 20px;">'; result += '<TR>'; result += '<TH colspan="2">Frame</TH>'; result += '</TR>'; result += '<TR>'; result += '<TD>Frame</TD>'; result += '<TD>' + selection[index].frame + '</TD>'; result += '</TR>'; result += '</TABLE>'; }So what it does is this: 1. it gets "selection" var with eval() from a DIV block of HTML page, where that DIV has a looooong prepared-by-PHP JSON string with all the options prepopulated from various sources accessible to PHP. var selection = eval("(" + document.getElementById("result").innerHTML + ")");2. It then dynamically constructs and populates further HTML using logic and data found in "selection" var. 3. This particular JS implements a selection algorithm, where basically user clicking buttons can navigate "selection" var forwards and backwards, and as user does, the dynamic portion of HTML updates per behavior defined in the JS file. My Problem / Question: I have a feeling that putting HTML the way it is done here in JS file is not proper separation of concerns and not good way to code. HTML should be. .. in HTML, when possible, but being new to JS I don't know if there is a better way. Is there a more recommended way to code what I have now ? hi, I am building a web app and need all my php on one page and links posting to same page etc, at the moment, I am linking to my townpubs.php page see code below: townpubs.php Code: [Select] <!doctype html> <?php include "../config.php"; $loggedIn = (isset($_COOKIE['loggedin']) && $_COOKIE['loggedin'] == 'true')?true:false; $town = $_REQUEST['RSTOWN']; $towns = mysql_query("SELECT * FROM pubs WHERE RSTOWN = '".$town."' ORDER BY RSTOWN ASC"); ?> <html> <head> <meta charset="UTF-8" /> <title>My Pub Space v1.0 β</title> <style type="text/css" media="screen">@import "jqtouch/jqtouch.min.css";</style> <style type="text/css" media="screen">@import "themes/jqt/theme.min.css";</style> <script src="jqtouch/jquery.1.3.2.min.js" type="text/javascript" charset="utf-8"></script> <script src="jqtouch/jqtouch.min.js" type="application/x-javascript" charset="utf-8"></script> <script type="text/javascript" charset="utf-8"> var jQT = new $.jQTouch({ icon: 'jqtouch.png', addGlossToIcon: false, startupScreen: 'jqt_startup.png', statusBar: 'black', preloadImages: [ 'themes/jqt/img/back_button.png', 'themes/jqt/img/back_button_clicked.png', 'themes/jqt/img/button_clicked.png', 'themes/jqt/img/grayButton.png', 'themes/jqt/img/whiteButton.png', 'themes/jqt/img/loading.gif' ] }); </script> </head> <body> <!-- TOWNS --> <div id="towns" class="current"> <div class="toolbar"> <h1>View Pubs</h1> <a class="back" href="index.php" rel="external">Home</a> </div> <h2>Pubs in <?php echo $town ?></h2> <ul class="plastic"> <?php while($row1 = mysql_fetch_array($towns)) { echo '<li class="arrow"><a href="pubinfo.php?PUBID='.$row1['PUBID'].'" rel="external">'.$row1['rsPubName'].'</a></li>'; } ?> </ul> </div> </body> </html> I would like to have this on my index.php page: index.php Code: [Select] <!doctype html> <?php include "../config.php"; $loggedIn = (isset($_COOKIE['loggedin']) && $_COOKIE['loggedin'] == 'true')?true:false; $query1 = "SELECT DISTINCT rsTown FROM pubs ORDER BY rsTown asc"; $result = mysql_query($query1); $towns = mysql_query("SELECT DISTINCT RSTOWN, COUNT(PUBID) As PubCount FROM pubs GROUP BY RSTOWN ORDER BY RSTOWN ASC"); $counties = mysql_query("SELECT DISTINCT RSCOUNTY, COUNT(PUBID) As PubCount1 FROM pubs GROUP BY RSCOUNTY ORDER BY RSCOUNTY ASC"); if ($loggedin == 'true'){ $locals = mysql_query("SELECT * FROM pubs INNER JOIN favepub_copy ON pubs.PUBID=favepub_copy.PUBID WHERE USERID='".$_SESSION['USERID']."' ORDER BY rsPubName asc"); } ?> <html> <head> <meta charset="UTF-8" /> <title>My Pub Space v1.0 β</title> <style type="text/css" media="screen">@import "jqtouch/jqtouch.min.css";</style> <style type="text/css" media="screen">@import "themes/jqt/theme.min.css";</style> <script src="jqtouch/jquery.1.3.2.min.js" type="text/javascript" charset="utf-8"></script> <script src="jqtouch/jqtouch.min.js" type="application/x-javascript" charset="utf-8"></script> <script type="text/javascript" charset="utf-8"> var jQT = new $.jQTouch({ icon: 'jqtouch.png', addGlossToIcon: false, startupScreen: 'jqt_startup.png', statusBar: 'black', preloadImages: [ 'themes/jqt/img/back_button.png', 'themes/jqt/img/back_button_clicked.png', 'themes/jqt/img/button_clicked.png', 'themes/jqt/img/grayButton.png', 'themes/jqt/img/whiteButton.png', 'themes/jqt/img/loading.gif' ] }); </script> </head> <body> <div id="about" class="selectable"> <p><img src="jqtouch.png" /></p> <p><strong>My Pub Space</strong><br />Version 1.0 beta<br /> <a href="http://www.jbiddulph.com" target="_blank">By John Biddulph</a></p> <p><em>Mobile Web Development</em></p> <p><a href="mailto:john.mbiddulph@gmail.com" target="_blank">E-mail</a></p> <p><a href="http://twitter.com/#!/jmbiddulph" target="_blank">@jmbiddulph on Twitter</a></p> <p><br /><br /><a href="#" class="grayButton goback">Close</a></p> </div> <div id="home" class="current"> <?php if (!$loggedIn){ ?> <div class="toolbar"> <h1>My Pub Space</h1> <a href="#about" id="infoButton" class="button slideup">About</a> </div> <ul class="rounded"> <li class="forward"><a href="#signup">Register an account</a></li> <li class="forward"><a href="#login">Login</a></li> <li class="forward"><a href="#towns">View pubs by town</a></li> <li class="forward"><a href="#counties">View pubs by county</a></li> </ul> <div class="info"> <p>All Rights Reserved © 2011 mypubspace.com Created by: jbiddulph.com</p> </div> <?php } else { ?> <div class="toolbar"> <h1>Hi <?php echo $_SESSION['s_username'];?></h1> <a href="dologoff.php" rel="external" class="button">Logout</a> </div> <ul class="rounded"> <li class="forward"><a href="#locals">View Locals</a></li> <li class="forward"><a href="#towns">View Towns</a></li> <li class="forward"><a href="#counties">View Counties</a></li> </ul> <div class="info"> <p>All Rights Reserved © 2011 mypubspace.com Created by: jbiddulph.com</p> </div> <?php } ?> </div> <!-- LOCALS --> <div id="locals"> <div class="toolbar"> <h1>My Locals</h1> <a class="back" href="#home">Back</a> </div> <ul class="plastic"> <?php while($row1 = mysql_fetch_array($locals)) { echo '<li class="arrow"><a href="pubinfo.php?PUBID='.$row1['PUBID'].'" rel="external">'.$row1['rsPubName'].', '.$row1['rsTown'].'</a></li>'; } ?> </ul> </div> <!-- TOWNS --> <div id="towns"> <div class="toolbar"> <h1>View Towns</h1> <a class="back" href="#home">Back</a> </div> <ul class="edgetoedge"> <?php $ltr = ''; while($row1 = mysql_fetch_array($towns)) { $letter1 = substr($row1['RSTOWN'],0,1); if ($letter1 != $ltr) { print'<li class="sep">'. $letter1 .'</li>'; } $ltr = $letter1; echo '<li class="forward"><a href="townpubs.php?RSTOWN='.$row1['RSTOWN'].'" rel="external">'.$row1['RSTOWN'].'<small class="listcounter">'.$row1['PubCount'].'</small></a></li>'; } ?> </ul> </div> <!-- COUNTIES --> <div id="counties"> <div class="toolbar"> <h1>View Counties</h1> <a class="back" href="#home">Back</a> </div> <ul class="edgetoedge"> <?php $ltr = ''; while($row1 = mysql_fetch_array($counties)) { $letter1 = substr($row1['RSCOUNTY'],0,1); if ($letter1 != $ltr) { print'<li class="sep">'. $letter1 .'</li>'; } $ltr = $letter1; echo '<li class="forward"><a href="countypubs.php?RSCOUNTY='.$row1['RSCOUNTY'].'" rel="external">'.$row1['RSCOUNTY'].'<small class="listcounter">'.$row1['PubCount1'].'</small></a></li>'; } ?> </ul> </div> <form id="login" action="dologin.php" method="POST" class="form"> <div class="toolbar"> <h1>Login</h1> <a class="back" href="#">Back</a> </div> <ul class="rounded"> <li><input type="text" name="rsUser" value="" placeholder="Username" /></li> <li><input type="Password" name="rsPass" value="" placeholder="Password" /></li> </ul> <a style="margin:0 10px;color:rgba(0,0,0,.9)" href="#" class="submit whiteButton">Submit</a> </form> <form id="signup" action="dosignup.php" method="POST" class="form"> <div class="toolbar"> <h1>Sign up</h1> <a class="back" href="#">Back</a> </div> <ul class="rounded"> <li><select name="RSTOWN" class="postcodedrop"> <option value="">Choose your Town...</option> <?PHP while($row = mysql_fetch_array($result)) { echo '<option value="'.$row['rsTown'].'">'; echo $row['rsTown']; echo '</option>'; }?> </select></li> <li><input name="RSUSER" type="text" class="textbox" id="RSUSER" value="" placeholder="Username" /></li> <li><input type="Password" name="RSPASS" value="" placeholder="Password" /></li> <li>Male <input name="RSGENDER" type="radio" value="Male" /> Female <input name="rsGender" type="radio" value="Female" /></li> <li><input name="RSEMAIL" type="text" class="textbox" id="rsEmail" placeholder="Email" /></li> <li><input name="RSMOBILE" type="text" class="textbox" id="rsMobile" placeholder="Mobile No." /></li> <li><input name="RSAGE" type="text" class="textbox" id="datepicker" placeholder="DOB: dd/mm/yyyy" /></li> </ul> <a style="margin:0 10px;color:rgba(0,0,0,.9)" href="#" class="submit whiteButton">Submit</a> </form> </body> </html> I need to set empty variables at the top and link page to itself?! Hi i followed a guid to create a login area to my site however i believe its a little outdated and therefore not working, i have done a little bit but being quite new i cannot find all the problems at the moment i have: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/a9855336/public_html/checklogin.php on line 12 here is my script line 12 is marked <?php $host="*************"; // Host name $username="a9855**6_root"; // Mysql username $password="************"; // Mysql password $db_name="****3***36_mail; // Database name // Connect to server and select databse. mysql_connect($host, $username, $password) mysql_select_db($db_name); // username and password sent from form $myusername=$_POST['myusername']; // line 12 $mypassword=$_POST['mypassword']; // To protect MySQL injection (more detail about MySQL injection) $myusername = stripslashes($myusername); $mypassword = stripslashes($mypassword); $myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string($mypassword); // encrypt password $encrypted_mypassword=md5($mypassword); $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$encrypted_mypassword'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1){ // Register $myusername, $mypassword and redirect to file "login_success.php" session_register("myusername"); session_register("mypassword"); header("location:login_success.php"); } else { echo "Wrong Username or Password"; } ?> if you help please tell me the error so i can learn to debug scripts myself in the future thanks blink359 We have a database that shows for example: 2500-5000 5000-10000 10000-15000 15000-20000 I need to show in a screen what people are have 3000 followers, and as such as grouped into that 2500-5000. The best way I can see how to do this, is to run through the database table for these values. Then for each value, put the first and second set of numbers into two respective variables, say $low, $high. Then find those people who are on a particular platform with followers between those two values. So how do I turn $row->followsrange (which might be for example: "2500-5000"), into:
$low = 2500 Many thanks. ps I have a feeling the hyphen might play a bit part, as it cannot be done by the amount of characters.......... My site seems to be going well, but on the back end, the users database is going crazy with duplicate entrys. but its not doing it from an INSERT. it seems to be doing it with this code: Code: [Select] $bitquery = $bitcoin->move("bittleship$username", "bittleships", $cost, $minconfirmations); if ($bitquery == true){ $query = mysql_query("INSERT INTO `transactions` ( `id` , `username` , `type` , `amount`, `address`) VALUES ('', '$username', 'buyclicks', '$cost', '')") or die(mysql_error()); $query = mysql_query("UPDATE users SET `clicks` = `clicks`+$quantity, `balance`=`balance`-$cost WHERE `username` = '$username' ") or die(mysql_error()); include('update.php'); Hi there, I'm creating a shopping cart and to work out postage cost I need to add all the items weights together. The weight of each item is in the database. I currently have this code: Code: [Select] $basket = $_SESSION['basket']; if ($basket) { $items = explode(',',$basket); $contents = array(); foreach ($items as $item) { $contents[$item] = (isset($contents[$item])) ? $contents[$item] + 1 : 1; } foreach ($contents as $id=>$qty) { $sql = "SELECT * FROM store WHERE id LIKE '$id' AND live LIKE '0'"; $result = mysql_query($sql); while ($rows = mysql_fetch_array($result)) { extract($row); so to work out each item's weight I can do $rows['weight'] * $qty. but how could i add all the item's weight together? i hope that makes some sense. thanks, jack Hey guys, I'm having a strange problem with cURL that I'm drawing an absolute blank to. It works completely fine locally, but when I upload the files to my webhost and test it over there, it doesn't work at all - it loads for about 2 minutes, and then displays: Server error. The website encountered an error while retrieving http://www.craigwatcher.me/playground/units.php. It may be down for maintenance or configured incorrectly. I've checked the error logs but nothing new is being added into there. Basically I'm just iterating through a list of URLs and cURLing each of them. Let me show you the code that I'm working with: ini_set('max_execution_time',0); require_once('../system/utilities.php'); // This will give us our getLocations() function, which has been tested to work 100% both locally and online $categories = array('jjj', 'ggg', 'bbb', 'sss', 'hhh'); $locations = getLocations(); if (!$locations) exit; $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); curl_setopt($ch, CURLOPT_TIMEOUT, 10); foreach ($locations as $country => $cities) { $countryCode = getCountryCode($country); foreach ($cities as $city) { foreach ($categories as $category) { $url=$city.'.en.craigslist.'.$countryCode.'/'.$category.'/index.rss'; echo $url.'<br/>'; curl_setopt($ch, CURLOPT_URL, $url); $rss = curl_exec($ch); if (!$rss) echo ' FAILED to load: '.$url.'<br/>'; } } } curl_close($ch); I've already tested everything else (eg. the getLocations() and getCountryCode(), and they prove to work 100% fine both locally and online. What could it POSSIBLY be!? I'm pulling my hair out over here, my mind is boggling and I'm completely lost at what could possibly be going wrong. I am having a problem I have encounted like no other. I am running a MySQL query from PHP and for some bizarre reason, its just not working... Ok, that sounds really general. lol To start off, here is my database: http://i56.tinypic.com/2hh0up1.png I am writing my own user interface with HTML/PHP/MySQL for every day catalog management: http://i54.tinypic.com/axxsb7.png To catalog a product is done from here (this page works): http://i51.tinypic.com/2e0qs7s.png ETC ... <FORM action="result.html" enctype="multipart/form-data" method="post"> ... ETC ETC ... Name: <INPUT name="name" type="text"> <BR> Brand: <INPUT name="brand" type="text"> <BR> Country of origin: <INPUT name="country" type="text"> <BR> Material: <INPUT name="material" type="text"> <BR> Primary colour: <INPUT name="primarycolour" type="text"> ... ETC result.html: ETC ... $query = "INSERT INTO products(name, brand, country, material, primarycolour) VALUES('".$_POST['name']."', '".$_POST['brand']."', '".$_POST['country']."', '".$_POST['material']."', '".$_POST['primarycolour']."')"; ... ETC To alter a product, you enter in a product ID: http://i56.tinypic.com/2lcsqch.png Code: [Select] <FORM action="dataentry.html" method="post"> <DIV class="drop">Alter product ID: <INPUT name="id" type="text">    <INPUT type="submit" value="Submit"></DIV> The data entry page pulls all the values from the MySQL database and populates them into the INPUT fields, so the user does not have to write them all again: http://i56.tinypic.com/2zh0hgn.png ... ETC echo '<FORM action="result.html" enctype="multipart/form-data" method="post">'; ETC ... ... ETC echo 'Name:'; $query = "select name from products where id=".$_POST['id'].""; $result = mysql_query($query); $row = mysql_fetch_array($result); echo ' <INPUT name="name" type="text" value="'.$row['name'].'">'; echo $query; ETC ... I will now change the value of "Name" from 'a' to 'c' and submit the changes: http://i55.tinypic.com/dzi9hc.png http://i54.tinypic.com/ab5lyg.png Now, you would think the result has been inserted into my database yeah? It failed... but when I enter the same command directly into MySQL. Success! http://i51.tinypic.com/29z5y5x.png Why the F is this happening?! Hi there im not quite sure how to do something and was wondering if anyone can help me, I am going to create a large database with lots of fields and these are going to be displayed on a page i want to limit it to 20 per page and be able to sort them aswell by ID (default) and then a-z or z-a, i dont know how to do this and i also need to know how to create the next previous and last and first links im guessing theres a count++ involved ? im not quite sure but anyway if someone can help it will be great. Thanks, Blink359 Hi, in Mysql have a row with FLOAT 10,2 In form put the number 20.20 and after reload in form show: 20.200000762939 Using curl_multi, I have loaded up 3 url's and then printed the array. 1) How can I also set a timestamp on output to let me know when each url was run? 2) How can I explode the array to only display the data and timestamp, excluding the text "Array ( =>", "[1] =>", "[2] =>" and " )"? Code <?php function multiRequest($data, $options = array()) { // array of curl handles $curly = array(); // data to be returned $result = array(); // multi handle $mh = curl_multi_init(); // loop through $data and create curl handles // then add them to the multi-handle foreach ($data as $id => $d) { $curly[$id] = curl_init(); $url = (is_array($d) && !empty($d['url'])) ? $d['url'] : $d; curl_setopt($curly[$id], CURLOPT_URL, $url); curl_setopt($curly[$id], CURLOPT_HEADER, 0); curl_setopt($curly[$id], CURLOPT_RETURNTRANSFER, 1); // post? if (is_array($d)) { if (!empty($d['post'])) { curl_setopt($curly[$id], CURLOPT_POST, 1); curl_setopt($curly[$id], CURLOPT_POSTFIELDS, $d['post']); } } // extra options? if (!empty($options)) { curl_setopt_array($curly[$id], $options); } curl_multi_add_handle($mh, $curly[$id]); } // execute the handles $running = null; do { curl_multi_exec($mh, $running); } while($running > 0); // get content and remove handles foreach($curly as $id => $c) { $result[$id] = curl_multi_getcontent($c); curl_multi_remove_handle($mh, $c); } // all done curl_multi_close($mh); return $result; } $data = array(array(),array()); $data[0]['url'] = 'http://search.yahooapis.com/VideoSearchService/V1/videoSearch?appid=YahooDemo&query=Pearl+Jam&output=json'; $data[1]['url'] = 'http://search.yahooapis.com/VideoSearchService/V1/videoSearch?appid=YahooDemo&query=Black+Eyed+Peas&output=json'; $data[2]['url'] = 'http://search.yahooapis.com/VideoSearchService/V1/videoSearch?appid=YahooDemo&query=Nirvana&output=json'; $r = multiRequest($data); print_r($r); ?> Output Array ( => Pearl Jam [1] => Black Eyed Peas [2] => Nirvana ) Preferred Output 01:00:01 Pearl Jam 01:00:02 Black Eyed Peas 01:00:03 Nirvana |