PHP - Help Really Needed - Loop, Is_numeric And Txt File
Similar TutorialsTaken from http://php.net/manual/en/function.is-numeric.php <?php $tests = array( "42", 1337, "1e4", "not numeric", Array(), 9.1 ); foreach ($tests as $element) { if (is_numeric($element)) { echo "'{$element}' is numeric", PHP_EOL; } else { echo "'{$element}' is NOT numeric", PHP_EOL; } } ?> Outputs: Quote '42' is numeric '1337' is numeric '1e4' is numeric 'not numeric' is NOT numeric 'Array' is NOT numeric '9.1' is numeric WHY does 1e4 validate as TRUE using is_numeric? I have a link echo '<p>View All Items listed for <a href="item.php?mem-items='.$mem_id.'">"'.$name.'"</a></p>'; That goes to a file http://localhost/folder/item.php?mem-items=26 with 26 being an actual member id number I use the GET function like this if (isset($_GET['mem-items']) && is_numeric($_GET['$mem-items'])) { $mem_items = $_GET['mem-items']; } My problem is $mem_items isn't assigned a variable, but when I take the "is_numeric($_GET['$mem-items'])" out, it works like a charm. I use this same format on the same file for "if (isset($_GET['item']) && is_numeric($_GET['item']))" AND it works great. Can anyone see what's wrong. Thanks Code: [Select] <FORM METHOD=POST ACTION=""> <p>Breeder or Business Name<br /> <input type = "text" name = "breedername" size= "25" maxlength = "50" /> </p> <p>Breeder Telephone<br /> <input type = "text" name = "breedertelephone" size= "25" maxlength = "50" /> </p> <p>Breeder Location<br /> <input type = "text" name = "breederlocation" size= "25" maxlength = "50" /> </p> <p>Breeder Desription<br /> <input type = "text" name = "breederdescription" size= "25" maxlength = "50" /> </p> <p>Leave blank<br /> <input type = "text" name = "breederverify" size= "5" maxlength = "5" /><br /><br /> </p> <input type="submit" value="Submit" name='submit' /> <br /> <br /> </form> <?php if (is_string($breederverify)) { <-- If $breederverify is set , then echo "Please leave the lowest box empty!" echo "Please leave the lowest box empty!"; } else { <-- else if $breederverify is unsigned/null execute this block. $con = mysql_connect("localhost","xxxxxxxxxx","xxxxxxxxxx"); mysql_select_db("cichlid",$con); $breedername = $_POST['breedername']; $breedertelephone = $_POST['breedertelephone']; $breederlocation = $_POST ['breederlocation']; $breederdescription = $_POST ['breederdescription']; $breederverify = $_POST ['breederverify']; $sql = "INSERT INTO breedersinfo SET breederNAME = '$breedername' , breederTELEPHONE = '$breedertelephone' , breederLOCATION = '$breederlocation' , breederDESCRIPTION = '$breederdescription'"; if(!mysql_query($sql,$con)) { die('ERROR:Could not connect ' . mysql_error ()); } echo ""; mysql_close ($con) ; } ?> All i am trying to accomplish is a form field that will only update records if the last $breederverify = $_POST ['breederverify']; is null/unasigned . I was thinking in order to do this i could use is_numeric , or is_string function to check $var ,to see what it's state is. Any help or advice would be appreciated , provided this is even possible. Cheers guys . Okay, I'm going nuts here. I have a (nested) array of search terms that I'm working with. When I run a foreach loop on it, things go bad. Here's a test loop I ran: Code: [Select] echo $pqPhrases[0]["terms"]." - ".$pqPhrases[1]["terms"]." - ".$pqPhrases[2]["terms"]."<br>"; foreach($pqPhrases as $pqPhrase) { echo $pqPhrases[0]["terms"]." - ".$pqPhrases[1]["terms"]." - ".$pqPhrases[2]["terms"]."<br>"; } Output (emphasis added): doberman - camaro - little green buddha with pink nose doberman - camaro - doberman doberman - camaro - camaro doberman - camaro - camaro If I switch to a "for" loop, the results are as expected: Code: [Select] echo $pqPhrases[0]["terms"]." - ".$pqPhrases[1]["terms"]." - ".$pqPhrases[2]["terms"]."<br>"; for($x=0;$x<count($pqPhrases);++$x) { echo $pqPhrases[0]["terms"]." - ".$pqPhrases[1]["terms"]." - ".$pqPhrases[2]["terms"]."<br>"; } Output: doberman - camaro - little green buddha with pink nose doberman - camaro - little green buddha with pink nose doberman - camaro - little green buddha with pink nose doberman - camaro - little green buddha with pink nose The other thing I tried was to redefine a simplified array, which also gives results that are expected: Code: [Select] $pqPhrases=array(); $pqPhrases[0]["terms"]="camaro"; $pqPhrases[1]["terms"]="doberman"; $pqPhrases[2]["terms"]="little green buddha with pink nose"; echo $pqPhrases[0]["terms"]." - ".$pqPhrases[1]["terms"]." - ".$pqPhrases[2]["terms"]."<br>"; foreach($pqPhrases as $pqPhrase) { echo $pqPhrases[0]["terms"]." - ".$pqPhrases[1]["terms"]." - ".$pqPhrases[2]["terms"]."<br>"; } Output: doberman - camaro - little green buddha with pink nose doberman - camaro - little green buddha with pink nose doberman - camaro - little green buddha with pink nose doberman - camaro - little green buddha with pink nose I'm thoroughly flumoxed. I can't figure out why the first example doesn't work. Am I missing something obvious here? Can anyone help? Hi. I have text files in the directory that contain rapidshare.com links. Now what I need to do is take them one by one and check links inside them one by one using rapidshare API. Everything works fine apart from one thing. It reads files and deletes the ones containing dead links but the problem is that it only deletes the file if ALL links are dead, but not when only one link is dead or some of them. Code: Code: [Select] <?php function rs_check($url){ if (!$url) return false; $files_pattern= '/\/files\/([^\/]*)\//'; $filename_pattern= '/\/files\/.*\/(.*)/'; preg_match($files_pattern, $url, $matches_id); preg_match($filename_pattern, $url, $matches_name); $res= file_get_contents("http://api.rapidshare.com/cgi-bin/rsapi.cgi?sub=checkfiles_v1&files={$matches_id[1]}&filenames={$matches_name[1]}"); list($fId,$fName,$fSize,$fServerId,$fStatus,$fShortHost,$fmd5) =explode(',',$res); return ($fStatus==1 || $fStatus==2); } $directory = "download/"; $linksfiles = glob("" . $directory . "*.txt"); foreach($linksfiles as $linkfile) { $lf = file_get_contents($linkfile); $purefilename = str_replace($directory, "" , $linkfile); if($purefilename != "5100c00fdb545e12e8cb4f9c5f69ec21.txt"){ if(rs_check($lf) != 1){ unlink($directory . $purefilename); echo("<br />"); } } } ?> I had Tom Cat Java installed on my Linux sever and I need to call a java file, which isn't working. Someone told me to verify Java is in fact installed on my server using this command: Code: [Select] echo exec('which java'); but when I run it, nothing displays! The java command I'm trying to run is this: Code: [Select] exec('java -Xmx1024m -jar "/home/account/public_html/java -cp b4a_c2dm.jar anywheresoftware.b4a.c2dm.C2DM send $php_device_id \"test\""'); The .jar file is there. My path to java is: /usr/local/jdk/bin/java Thanks for any help... Hi guys <?php sleep(00); $handle = fopen("http://www.myurl.com/?bla=bla=bla" , "r"); fclose($handle); ?> How do i prevent this from outputing to a file on my server. I only need the url to be accessed to add a new row of data to my DB. Any Ideas? Regards Mark Hi! I hope somebody can help me what im do wrong. i have checked that the data from the file is in $source_file but nothing imports to the database Code: [Select] <?php include('config.php'); include('opendb.php'); if(isset($_POST['upload'])) { $source_file = @$_POST['userfile']; //$source_file = fopen('http://localhost/test/upload/test.csv', 'r'); $target_table = 'foretag'; function csv_file_to_mysql_table($source_file, $target_table, $max_line_length=10000) { if (($handle = fopen("$source_file", "r")) !== FALSE) { $columns = fgetcsv($handle, $max_line_length, ","); foreach ($columns as $column) { $column = str_replace(".","",$column); } $insert_query_prefix = "INSERT INTO $target_table (".join(",",$columns).")\nVALUES"; while (($data = fgetcsv($handle, $max_line_length, ";")) !== FALSE) { while (count($data)<count($columns)) array_push($data, NULL); $query = "$insert_query_prefix (".join(",",quote_all_array($data)).");"; mysql_query($query); } fclose($handle); } } function quote_all_array($values) { foreach ($values as $key=>$value) if (is_array($value)) $values[$key] = quote_all_array($value); else $values[$key] = quote_all($value); return $values; } function quote_all($value) { if (is_null($value)) return "NULL"; $value = "'" . mysql_real_escape_string($value) . "'"; return $value; } } include('closedb.php'); echo "<br>done<br>"; ?> I have purchased a ad manager type script and have put so much work in to the site but i cannot get the cron file to execute properly due to errors. The makers of the script arent answering my emails so I am left to find the answer myself im hoping some experts can shine a light on this for me
I have the cron running once daily as required
the error messages are as follows:
/home2/net2you/public_html/2xx.co.uk/include/CronStats.php: line 1: ?php: No such file or directory /home2/net2you/public_html/2xx.co.uk/include/CronStats.php: line 2: syntax error near unexpected token `;' /home2/net2you/public_html/2xx.co.uk/include/CronStats.php: line 2: `ob_start();' I have installed the script on two different hosts and get the exact same errors. any help would be much appriciated the contents of the cron file are below ______________________________________________ <?php Is there a way I can readily stream-process a compressed XML file in PHP? Something like this NON WORKING example: Code: [Select] $reader = new XMLReader(); $reader->open(bzopen($planet_file,"r")); while ($reader->read()) { ... See also http://php.net/manual/en/xmlreader.open.php Hi all I am trying to write a piece of code that copies files from a multiple selected form. Here's the form: Code: [Select] <form action="" method="post" enctype="multipart/form-data"> <input type="file" name="image[]" multiple="multiple" /> <input name="submit" type="submit" value="submit"> </form> Here's my PHP code: Code: [Select] if(isset($_POST['submit'])) { $count=0; foreach($_FILES['image'] as $filename){ copy($_FILES['image']['tmp_name'], WEB_UPLOAD."/images/galleries/".$filename) or die("Error uploading image "); $count++; } } I get the message, Array to string conversion and no such directory found. Am I right in thinking I am sending the files as arrays? Many thanks for your help. This is probably a trivial task to most of you, but I can't for the life of me figure out how to do this. I want to write a script that will open an image directory, go through each of the images inside and change their permissions, owner and group. Thanks in advance. Got a little stuck here. I'm trying to format an existing .txt file, format it and then write it to .sql file. Here's my code: Code: [Select] $handle = @fopen("nations.txt", "r"); if ($handle) { while (($buffer = fgets($handle, 1024)) !== false) { $column = explode("|",$buffer); // format file $myFile = "nation_dump_".date("Y-m-d").".sql"; // create file $fh = fopen($myFile, 'w') or die("can't open file"); foreach($column as $col) { fwrite($fh, $col[0]); //write the first broken segment from explode() to file } fclose($fh); } if (!feof($handle)) { echo "Error: unexpected fgets() fail\n"; } fclose($handle); } The error is on this line, within the foreach loop. fwrite($fh, $col[0]); When I removed the index it only wrote the last line to the file, but I want it to loop through all the lines.. What am I doing wrong here? I have a php script defined that parsed the xml file and runs through the 1st record - encased within the EOF tags. However, I need to capture ALL records - each defined between "EOF" tags - of the select xml file that will be pass to the script. Currently, the php script I have finds the 1st set of info from the xml file but doesn't loop through the remaining records which all encased between the "EOF" tags. I know I need a while loop but not sure on the syntax to get it through the remaining files. Any comments appreciated to help edit code to form the required loop: $xml = simplexml_load_file($new_location); foreach($xml->EOF as $eof) { $autoNoT = $eof->AutoNo; $vegregnoT = $eof->TruckNo; $clientIDT = $eof->ClientID; } Here's the example xml file which contains multiple records that I need to extract each set of date between the <EOF></EOF> tags. Note: the above php code extract just the 1st record then stops (I know I'm missing the loop but need help defining it...) Code: [Select] - <DocumentElement> - <EOF> <AutoNo>109531</AutoNo> <TruckNo>XLX885GP</TruckNo> <ClientID>3</ClientID> </EOF> - <EOF> <AutoNo>109532</AutoNo> <TruckNo>ZFN726GP</TruckNo> <ClientID>3</ClientID> </EOF> - <EOF> <AutoNo>109533</AutoNo> <TruckNo>ZFP113GP</TruckNo> <ClientID>3</ClientID> </EOF> - <EOF> <AutoNo>109534</AutoNo> <TruckNo>WSG299GP</TruckNo> <ClientID>3</ClientID> </EOF> - <EOF> <AutoNo>109872</AutoNo> <TruckNo>XKR493GP</TruckNo> <ClientID>3</ClientID> </EOF> </DocumentElement> Hi, Have a text file that is being read. I want to print the contents however I want each line of the text file to appear on a new line in the browser. So far $str = file_get_contents('records.txt'); $lines = explode("\n", $str); echo $lines[0]; Help appreciated Here's what I'm trying to do, and I am having trouble getting started with this. It's a very simple process, but I didn't want to spend the next 6 hours in frustration, so some help getting started would be great. Here's the purpose of the script: 1. Allow user to add a text file to a form. 2. Take the text file, add HTML code to the beginning and end of each paragraph (a single line of text, usually paragraphs would be separated by a line return) 3. Send the user an email with the HTML file attached and thank them or whatever. 4. Allow the system to throttle itself (one-at-a-time) so that many people using the site won't bog it down. These files will probably be anywhere from 100 KB to 1,000 KB in size, usually hitting in the 300-500KB range. Here's what I can do very easily: 1. Allow user to add a text file - very simple and straightforward. 2. Take the text file, add HTML... - this is what I need a little help figuring out. Each paragraph needs to have <p> at the beginning and </p> at the end, and the script will also search for keywords on certain lines (section headers) and add a <align="center"> tag to that, and so forth. I can handle the formatting rules, but making sure the loop runs correctly could be a problem. 3. Send the user an email... - very easy, I can do that myself. 4. Allow the system to throttle itself... - this could be tricky. I was thinking a database with a TINYINT field, 0 for not processed yet, 1 for processing, 2 for processed. Cron job checks the next one on the list to see if it needs to send it to the processor, if the file is already being processed, or can be sent to a different database (completed entries) and removed from the current queue. The cron job would also be responsible for triggering the "Your file is converted!" email and the attachment. Any/all help would be greatly appreciated on this. I am going to work on the parts that I can do myself, and I'll be checking back for the discussion - in between Mountain Dew runs. Hello, I'm working on a script which should read lines from a file keyword.txt create a new file with that variable name, insert the content close and loop through all the lines in the keyword file. The loop itself works but now that i'm adding the fopen fwrite and fclose i'm running into trouble. I'm not that great a coder and have pieced this together so far. I'd appreciate any suggestions on how to fix the fopen and other file functions to create unique files using the keywords from the file Thanks in advance <?php $read_file = file('keywords.txt'); foreach($read_file as $var) { $file = fopen($var, "x"); $content = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"> <html xmlns=\"http://www.w3.org/1999/xhtml\"> <head> <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /> <title>This is the title</title> </head> <body> <h2>The keyword is $var</h2> <p><p> </body> </html>"; fwrite($file, $content); fclose($file); } ?> Hey.
So the issue I'm having is consecutive loops on semi-large arrays, over and over. Consider this array:
$firstArray = array( 'row1' => array( 'dates' => array( '2014-01-01' => array('key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3', 'key4' => 'value4', 'key5' => 'value5', 'key6' => 'value6', 'key7' => 'value7', 'key8' => 'value8', 'key9' => 'value9', 'key10' => 'value10'), '2014-01-02' => array('key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3', 'key4' => 'value4', 'key5' => 'value5', 'key6' => 'value6', 'key7' => 'value7', 'key8' => 'value8', 'key9' => 'value9', 'key10' => 'value10'), '2014-01-03' => array('key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3', 'key4' => 'value4', 'key5' => 'value5', 'key6' => 'value6', 'key7' => 'value7', 'key8' => 'value8', 'key9' => 'value9', 'key10' => 'value10'), '2014-01-04' => array('key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3', 'key4' => 'value4', 'key5' => 'value5', 'key6' => 'value6', 'key7' => 'value7', 'key8' => 'value8', 'key9' => 'value9', 'key10' => 'value10'), '2014-01-05' => array('key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3', 'key4' => 'value4', 'key5' => 'value5', 'key6' => 'value6', 'key7' => 'value7', 'key8' => 'value8', 'key9' => 'value9', 'key10' => 'value10'), '2014-01-06' => array('key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3', 'key4' => 'value4', 'key5' => 'value5', 'key6' => 'value6', 'key7' => 'value7', 'key8' => 'value8', 'key9' => 'value9', 'key10' => 'value10'), '2014-01-07' => array('key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3', 'key4' => 'value4', 'key5' => 'value5', 'key6' => 'value6', 'key7' => 'value7', 'key8' => 'value8', 'key9' => 'value9', 'key10' => 'value10'), ) ), 'row2' => array( 'dates' => array( '2014-02-01' => array('key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3', 'key4' => 'value4', 'key5' => 'value5', 'key6' => 'value6', 'key7' => 'value7', 'key8' => 'value8', 'key9' => 'value9', 'key10' => 'value10'), '2014-02-02' => array('key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3', 'key4' => 'value4', 'key5' => 'value5', 'key6' => 'value6', 'key7' => 'value7', 'key8' => 'value8', 'key9' => 'value9', 'key10' => 'value10'), '2014-02-03' => array('key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3', 'key4' => 'value4', 'key5' => 'value5', 'key6' => 'value6', 'key7' => 'value7', 'key8' => 'value8', 'key9' => 'value9', 'key10' => 'value10'), '2014-02-04' => array('key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3', 'key4' => 'value4', 'key5' => 'value5', 'key6' => 'value6', 'key7' => 'value7', 'key8' => 'value8', 'key9' => 'value9', 'key10' => 'value10'), '2014-02-05' => array('key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3', 'key4' => 'value4', 'key5' => 'value5', 'key6' => 'value6', 'key7' => 'value7', 'key8' => 'value8', 'key9' => 'value9', 'key10' => 'value10'), '2014-02-06' => array('key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3', 'key4' => 'value4', 'key5' => 'value5', 'key6' => 'value6', 'key7' => 'value7', 'key8' => 'value8', 'key9' => 'value9', 'key10' => 'value10'), '2014-02-07' => array('key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3', 'key4' => 'value4', 'key5' => 'value5', 'key6' => 'value6', 'key7' => 'value7', 'key8' => 'value8', 'key9' => 'value9', 'key10' => 'value10'), '2014-02-08' => array('key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3', 'key4' => 'value4', 'key5' => 'value5', 'key6' => 'value6', 'key7' => 'value7', 'key8' => 'value8', 'key9' => 'value9', 'key10' => 'value10'), '2014-02-09' => array('key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3', 'key4' => 'value4', 'key5' => 'value5', 'key6' => 'value6', 'key7' => 'value7', 'key8' => 'value8', 'key9' => 'value9', 'key10' => 'value10'), ) ) );Originally the data comes from ~2-3 database tables, of course. But to ilustrate the point, this is how the main array looks like. This array usually contains anywhere between 10-50 rows, each row containing at least 10 dates, with 10 key/values each. And after setting up all the data, it needs to be processed. Currently this is how a friend of mine did it.. $placeDataHere = array(); foreach($firstArray as $key => $dates) { foreach($dates as $date => $values) { foreach($values as $key => $value) { $placeDataHere['DV_' . $date]['SM_' . $key] = 'KS_' . $value; //Followed by another ~50-70 lines of processing the 3 loop's data.. ... ... .... .... .... .... .... .... } } }Obviously this isn't good practise, but we can't seem to figure out a better way of doing it, since both the data and the loops are horribly nested. This loop and setup of $firstArray is run anywhere between 10-20 times/request, due to amount of users we wish to process. So, the result is that this code can take up to over 2-3 minutes to complete, which isn't really optimal performance. In short my question is, are there any better methods of handling this with the data setup we currently have? Below is my output on the browser: Student: Kevin Smith (u0867587) Course: INFO101 - Bsc Information Communication Technology Course Mark 70 Grade Year: 3 Module: CHI2550 - Modern Database Applications Module Mark: 41 Mark Percentage: 68 Grade: B Session: AAB Session Mark: 72 Session Weight Contribution 20% Session: AAE Session Mark: 67 Session Weight Contribution 40% Module: CHI2513 - Systems Strategy Module Mark: 31 Mark Percentage: 62 Grade: B Session: AAD Session Mark: 61 Session Weight Contribution 50% Now where it says course mark above it says 70. This is incorrect as it should be 65 (The average between the module marks percentage should be 65 in the example above) but for some stange reason I can get the answer 65. I have a variable called $courseMark and that does the calculation. Now if the $courseMark is echo outside the where loop, then it will equal 65 but if it is put in while loop where I want the variable to be displayed, then it adds up to 70. Why does it do this. Below is the code: Code: [Select] $sessionMark = 0; $sessionWeight = 0; $courseMark = 0; $output = ""; $studentId = false; $courseId = false; $moduleId = false; while ($row = mysql_fetch_array($result)) { $sessionMark += round($row['Mark'] / 100 * $row['SessionWeight']); $sessionWeight += ($row['SessionWeight']); $courseMark = ($sessionMark / $sessionWeight * 100); if($studentId != $row['StudentUsername']) { //Student has changed $studentId = $row['StudentUsername']; $output .= "<p><strong>Student:</strong> {$row['StudentForename']} {$row['StudentSurname']} ({$row['StudentUsername']})\n"; } if($courseId != $row['CourseId']) { //Course has changed $courseId = $row['CourseId']; $output .= "<br><strong>Course:</strong> {$row['CourseId']} - {$row['CourseName']} <strong>Course Mark</strong>" round($courseMark) "<strong>Grade</strong> <br><strong>Year:</strong> {$row['Year']}</p>\n"; } if($moduleId != $row['ModuleId']) { //Module has changed if(isset($sessionsAry)) //Don't run function for first record { //Get output for last module and sessions $output .= outputModule($moduleId, $moduleName, $sessionsAry); } //Reset sessions data array and Set values for new module $sessionsAry = array(); $moduleId = $row['ModuleId']; $moduleName = $row['ModuleName']; } //Add session data to array for current module $sessionsAry[] = array('SessionId'=>$row['SessionId'], 'Mark'=>$row['Mark'], 'SessionWeight'=>$row['SessionWeight']); } //Get output for last module $output .= outputModule($moduleId, $moduleName, $sessionsAry); //Display the output echo $output; I think the problem is that it is outputting the answer of the calculation only for the first session mark. How in the while loop can I do it so it doesn't display it for the first mark only but for all the session marks so that it ends up showing the correct answer 65 and not 72? Hey guys, Got another question im hoping someone can help me with. I have a foreach loop (for use in a mysql query): foreach ($interests as $interest) { $query .= "($id, $interest), "; } problem is i do not want the comma(,) in the last loop. Is there some kinda of function i can use so it does not insert it on last loop? Or should i just use a for loop with a nested if loop? something like ; for($i=0; $i < count($interests); $i++){ $query .= "($id, '$interests[$i]')"; if($i + 1 < count($interests)) { $query .= ", "; } } Cheers guys |