PHP - Removing Certain Text With Php?
Hi
I want this URL: php.net/manual/en/function.explode.php to become php.net using php .. I tried with the explode fuction but couldnt get it to work ... list ($finalurl, $blabla) = explode('/', $url); Anyone have any tips? Thanks in advance Similar TutorialsOk i have just installed anope irc services on my irc network and they use MySQL databases. Through this, I can use the same info/passwords to link user/website accs. However it stores passwords as md5:someHashHere How would i get a php script to remove the md5: from the start, or would it just be easier checking against md5:$md5(enteredpassword)? I need to remove some text from a php variable. right now $testv = <span id="sobi2Details_field_street">www.google.com</span> I need to remove the <span id="sobi2Details_field_street"> and the </span> so im left with $testv = www.google.com Hello, I have a field in which when a user types something into it, it saves it into a table in my SQL. But is it possible to remove a particular phrase from the field if the user enters it. Example: I have a text field that says 'please enter your website domain here'. The user then enters 'www.domain.com'. Is it possible for PHP to remove the 'www.' and only save the 'domain.com' to my SQL (bearing in mind that not all users may enter www.) Here is the code for the text field: Code: [Select] <input name="website_name" type="text" class="text-box" id="website_name" value="<?php echo $website_name; ?>" size="24" /> Here is the code for the _POST: if(isset($_POST['send'])) { $database->updateUserField($session->username, "website_name", $_POST['website_name']); } (the code so far all works fine - I just want to add an extra 'variable', if you will, to the code) Thanks for your help!! This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=308166.0 Merry xmas and happy new in advance to you all. I have a web form where user submit an ad. Everything is working just fine. However there is a field name brief. The brief field is where user add info about their ad. Now people are including web url, phone numbers and email address in this field which make the ad look like spam. In the code there is already a function that check if they have entered their email address in the email field. I want to add a function to the check field to include the brief field. The function should either automatically delete any phone number/email addr/web url or replace with with my website name if detected in the brief field. Your help will be highly appreciated. Code: [Select] <?php function check_fields() { global $db_entry, $visible_val, $cat_fields, $email, $HTTP_POST_VARS, $photos_count, $phptomaxsize, $userfile, $prviewphotomax, $incl_prevphoto, $incl_mtmdfile, $mtmdfile_maxs, $userfile_name, $select_text, $msg2; if(!get_magic_quotes_gpc()) { foreach ($HTTP_POST_VARS as $key5 => $value ) { $HTTP_POST_VARS[$key5]=addslashes($HTTP_POST_VARS[$key5]); } } foreach ( $cat_fields as $key => $value ) { $HTTP_POST_VARS[$key]=ereg_replace('<', '&#060;', $HTTP_POST_VARS[$key]); $HTTP_POST_VARS[$key]=ereg_replace('>', '&#062;', $HTTP_POST_VARS[$key]); if ($cat_fields[$key][2]=="minmax") { $HTTP_POST_VARS[$key]=ereg_replace(',', '', $HTTP_POST_VARS[$key]); $HTTP_POST_VARS[$key]=preg_replace ('/[A-Za-z]|\$|,|\?|\+/', "", $HTTP_POST_VARS[$key]); } if ($cat_fields[$key][4]=="date") { $key_d=$key."_dd"; $key_m=$key."_mm"; $key_y=$key."_yy"; $HTTP_POST_VARS[$key]=$HTTP_POST_VARS[$key_y]."-".$HTTP_POST_VARS[$key_m]."-".$HTTP_POST_VARS[$key_d]; if (($HTTP_POST_VARS[$key_m] > 12) or ($HTTP_POST_VARS[$key_m] < 1) or ($HTTP_POST_VARS[$key_d] > 31) or ($HTTP_POST_VARS[$key_d] < 1) or ($HTTP_POST_VARS[$key_y] < 1)) { $message=" <center> <font class='msgf2' > ".$msg2['incorr_date_f']." ".$cat_fields[$key][0]." </font> </center> "; output_mssg_ex($message); return; } } if ($cat_fields[$key][4]=="checkbox") { $aa5=split('<option>',$cat_fields[$key][7]); $i_aa5=0; foreach ($aa5 as $value1) { $i_aa5++; $namechbx=$key.$i_aa5; if ($HTTP_POST_VARS[$namechbx]!="") {$HTTP_POST_VARS[$key]=$HTTP_POST_VARS[$key].$HTTP_POST_VARS[$namechbx]."; ";} } } $str_length1=strlen($HTTP_POST_VARS[$key]); $aa4=split(':',$cat_fields[$key][3]); $fmaxsize=$aa4[1]; if ($aa4[2]!="") $fmaxsize=$aa4[2]; $fmaxsize=2*$fmaxsize; if ( $str_length1 > $fmaxsize) { $message=" <center> <font class='msgf2' > ".$msg2['Ad_info_in_field']." <font class='msgf1' >".$cat_fields[$key][0]." </font> ".$msg2['is_too_large_inf']."</font> </center> "; output_mssg_ex($message); return; } if ($HTTP_POST_VARS[$key]==$select_text) {$HTTP_POST_VARS[$key]="";} if ($cat_fields[$key][5]=='1') { if (( $HTTP_POST_VARS[$key]=="") or ( $HTTP_POST_VARS[$key]=="http://")) { $message=" <center> <font class='msgf2' > ".$msg2['Ad_field_c']." <font class='msgf1' > ".$cat_fields[$key][0]." </font> ".$msg2['was_mising_on_form']."</font> </center> "; output_mssg_ex($message); return; } } } if ($cat_fields['email'][5]=='1'){ $HTTP_POST_VARS['email']=check_email($HTTP_POST_VARS['email']); } for ($i=1; $i<=$photos_count; $i++) { $i1=$i-1; if (file_exists($userfile[$i1])){ if (filesize($userfile[$i1]) > $phptomaxsize) { $phptomaxsize1=$phptomaxsize/1000; $message=" <center> <font class='msgf2' > ".$msg2['Your_photo_n']." $i ( ".$userfile_name[$i1]." ) ".$msg2['is_too_large_ph']." < $phptomaxsize1 ".$msg2['Kbyte_v'].". </font></font> </center> "; output_mssg_ex($message); return; } } } if ($incl_prevphoto=="yes") { $i1++; if (file_exists($userfile[$i1])){ if (filesize($userfile[$i1]) > $prviewphotomax) { $prviewphotomax1=$prviewphotomax/1000; $message=" <center> <font class='msgf2' > ".$msg2['Your_preview_photo_d']." ( ".$userfile_name[$i1]." ) ".$msg2['is_too_large_prph']." < $prviewphotomax1 ".$msg2['Kbyte_v'].". </font></font> </center> "; output_mssg_ex($message); return; } } } if ($incl_mtmdfile=="yes") { $i1++; if (file_exists($userfile[$i1])){ if (filesize($userfile[$i1]) > $mtmdfile_maxs) { $mtmdfile_maxs1=$mtmdfile_maxs/1000; $message=" <center> <font class='msgf2' > ".$msg2['Your_multimedia_file']." ".$userfile_name[$i1]." ".$msg2['is_too_large_mmf']." < $mtmdfile_maxs1 ".$msg2['Kbyte_v'].". </font></font> </center> "; output_mssg_ex($message); return; } } } } function checknusrads() { global $cat_fields, $table_ads, $ct, $page, $adsonpage, $html_header, $html_footer, $usrads_chcktime, $usrads_max, $categories,$ch_nmusr, $REMOTE_ADDR, $msg2, $msg, $templ, $indx_url; $timech1=time() - $usrads_chcktime*86400; $sql_query="select count(idnum) from $table_ads where ipaddr1='$REMOTE_ADDR' and time > $timech1"; $sql_res=mysql_query("$sql_query"); $row=mysql_fetch_row($sql_res); $count=$row[0]; if ($count >= $usrads_max) { $message=" <font class='msgf2'> <center> ".$msg2['exceeded_max_n_ads']." ($usrads_max) ".$msg2['allowed_per_time_p']." ($usrads_chcktime ".$msg2['days_v']." <p> <font class='stfnt'> <a href='{$indx_url}md=browse&ipaddr1=$REMOTE_ADDR&visunvis=1'>".$msg2['Click_here_v']." </a> ".$msg2['to_see_your_ads']." </font> </center> </font> "; $thtml= " <center><table width='400'><tr><td> <font class='stfntb'> <b><a href='$indx_url'>".$msg['top'].":</a></b></font> <font class='stfntb'> <b> <a href='{$indx_url}ct=$ct'>".$categories[$ct][0]." </b></a> </font> <hr size='1'><p> $message <p><hr size='1'> </tr></td></table> </center> "; include($templ['msg']); return; } } function check_duplication() { global $pradsdupl, $HTTP_POST_VARS, $table_ads, $msg2, $ct, $indx_url; if ($pradsdupl=='yes'){ $email_d=$HTTP_POST_VARS['email']; $title_d=$HTTP_POST_VARS['title']; $dupl_k="0"; $time1=time() - 1000; $sql_query="select idnum from $table_ads where title='$title_d' and email='$email_d' and catname='$ct' and (time > $time1)"; $sql_res=mysql_query("$sql_query"); while ($row = mysql_fetch_array ($sql_res)) { $dupl_id=$row['idnum']; $dupl_k="1"; } if ($dupl_k=="1"){ global $moderating; $title_d=stripslashes($title_d); if ($moderating!="yes"){ $ttlad1="<a href='{$indx_url}md=details&ct=$ct&id=$dupl_id'>$title_d (ID# $dupl_id)</a>"; } else {$ttlad1="<font color='#000077'>$title_d (ID# $dupl_id)</font>";} $message=" <center> <font FACE='ARIAL, HELVETICA' COLOR='#880000' > <b> ".$msg2['tried_duplicate_ad']." <br> $ttlad1 </font></b></font> </center> "; output_mssg_ex($message); return; } } } function submit_ad() { global $db_entry, $visible_val, $cat_fields, $email, $HTTP_POST_VARS, $ch_nmusr, $photo_url, $photo_path, $id_count, $userfile, $userfile_name, $visible_val, $html_header, $html_footer, $msg, $msg2, $paymgtw, $photos_url, $photos_path, $photos_count, $moderating, $ad_idnum, $sndadmnotif,$use_spmg, $templ; global $actadoptv; if($actadoptv=="yes"){$moderating="yes"; include_once("actlink.php");} global $usevrfcode; if ($usevrfcode=="yes"){include_once("vrfuncs.php"); if(!ch_vrcode()){return;}} if($paymgtw=="yes"){include("ecmc.php"); check_pmsubmit();} if ($ch_nmusr=="yes"){checknusrads();} check_fields(); ?> Many thanks again I have the following text file: Code: [Select] 09/16/2011 - 09/16/2011 323780048 FedEx Ground Shipment Detail Report 09/22/2011 CAFE2472 Page: 1 TRACKING # RECIPIENT CD ZIP ZN CARRIER SVC BILL WGT COD DECL VALUE C GR CHG C SRCHG C NET ---------------- --------------- ------ --- ------- - --- -------- ---------- ---------- ---------- ---------- ---------- 561895962528473 97913 440607 4 Ground , RH 2.0 0.00 99.00 6.22 2.45 8.27 561895962528480 97928 352424 5 Ground , RH 17.0 0.00 99.00 9.89 2.45 10.60 561895962528497 97943 857164 6 Ground , RH 17.0 0.00 99.00 12.38 2.45 14.75 561895962528503 97955 193825 5 Ground , RH 4.0 0.00 99.00 7.17 2.45 8.42 561895962528510 6792 491069 3 Ground , RH 3.0 0.00 99.00 5.97 2.45 8.27 561895962528527 97967 030703 5 Ground , RH 1.0 0.00 99.00 5.75 4.10 10.06 561895962528534 97978 665429 4 Ground , RH 4.0 0.00 99.00 6.86 4.10 10.06 561895962528541 97992 371844 4 Ground , RH 1.0 0.00 99.00 5.51 4.25 10.22 561895962528558 98005 386108 4 Ground , RH 18.0 0.00 99.00 9.21 4.25 12.01 GRAND TOTALS COURTESY NET CHARGE 92.66 TOTAL WEIGHT(OF LBS) 63.7 TOTAL WEIGHT(OF KGS) 0.0 CSY DECL VAL SCHG 0.00 COURTESY DISCOUNT 12.52 COURTESY SPECIAL FEES 28.95 CSY FUEL SURCHARGE 7.27 PACKAGE COUNT 9 And I'm attempting to pull ONLY the tracking number and reference number (or order #) from this file. I've been able to get rid of the empty lines, get rid of the first few lines I don't need and grab just tracking and reference numbers , but I can' t figure out how to get rid of of the last few lines....here's my code: Code: [Select] $arr=file("/home/onest4/public_html/beta/fedex.txt"); $x=1; foreach($arr as $str) { if (trim($str) != '') if ($x > 3) { list($tracking,$ordernumber)=explode(" ",$str); echo $tracking; echo "<br />"; echo $ordernumber; echo "<br /><br />"; } else { $x++; continue; } } Here's the result: Code: [Select] 561895962528473 97913 561895962528480 97928 561895962528497 97943 561895962528503 97955 561895962528510 6792 561895962528527 97967 561895962528534 97978 561895962528541 97992 561895962528558 98005 GRAND TOTALS COURTESY NET CHARGE TOTAL WEIGHT(OF LBS) TOTAL WEIGHT(OF KGS) CSY DECL VAL SCHG COURTESY DISCOUNT COURTESY SPECIAL FEES CSY FUEL SURCHARGE PACKAGE COUNT Anyone help with this? Thanks! I have a form on my website with a text area input field. I am looking for a php function that can strip the formating from the Text and take out line breaks and paragraphs so that when i retrieve the information from database i can change it from this _____________________________________ FANTASTIC BARGAINS ALL SPRING / SUMMMER 2010 ...... STOCK NOW REDUCED to this FANTASTIC BARGAINS ALL SPRING / SUMMMER 2010...... STOCK NOW REDUCED does anyone know what fucntion i could use for this? i have this so far but it doesnt seem to be working $descr = ''; if(strlen($row['description']) > DESCR_LIMIT) { $descr = (substr($row['description'], 0, DESCR_LIMIT).'...'); } else { $descr = $row['description']; } $descr = preg_replace("/(\r\n)+/", " ", $descr); $descr = preg_replace("/ +/", " ", $descr); $status .= $descr; Hey guys, im using UNIX time and trying to figure out how to remove the leading 0 when it shows the hour. "07:06 am" to make it read "7:06 am" manual says i need to use %i with strftime. So I guess Im suppose to be removing the zero before the date format? which is why strftime isnt working after the date function. Or is there a way to do this in the date function. $time = 1327493219; date_default_timezone_set('UTC'); $user_offset = date('h:i a M/d', $time); echo "<td>". strftime("%l",$user_offset) ."</td>"; How can I remove certain string from a statement. For example: A blagh blah blah blah blah. http://blah.com Where I would want to remove everything from "http" and after. So the final statement would show as: A blagh blah blah blah blah. What I want to do is simple: The string "this_is_an_example.php" should return "this_is_an_" while: "this_is_an_example_filename.php should return "this_is_an_example_" Is there a simple function which can cut off the part after the last _ ? I have been looking and trying several functions, but can't seem to find the right one for this. (the last _ being cut off of course wouldn't be a problem I couldn't live with :-) ) Any help will be greatly appreciated! Hy guys I try to rebuild a PTC site The thing is when the member is click on the ad, they get money after x sec. I have the code, and the question is how i can remove the top frame, but i would like to keep the money part. So when they open a link its will looks a normal link no frame no timer but they still get the monye after x second. Can i do this?? The code is he <? session_start(); /********************************************************************************************************************************************** ScriptBux Version 2.50 beta This Script has been created and coded by Gabrola and edited by hassan ahmady. If you find any bugs in the script report at support@thealternatif.info or contact hassan ahmady. Copywrite ScriptBux 2008; Please make donations if you use this sript for commercial use to My paypal account "bisnis-usd@plasa.com" ************************************************************************************************************************************************/ require('config.php'); global $c; require('data.php'); global $config; require('funciones.php'); $adse=securedata($_GET["ad"]); if(isset($_GET['example'])) { die("<body bgcolor='#FFFFFF'></body>"); } if(!$_GET['ad']) { die("<b>Error</b> - You need the advertisement ID."); } if(!isset($_COOKIE["usNick"]) && !isset($_COOKIE["usPass"])) { $sqlz = "SELECT * FROM ads WHERE ad_id='$adse'"; $resultz = mysql_query($sqlz); $myrowz = mysql_fetch_array($resultz); if(!$loggedin) { $numero=$myrowz["outside"]; $sqlex = "UPDATE ads SET outside=outside +'1' WHERE ad_id='$adse'"; $resultex = mysql_query($sqlex); } } $checkad = mysql_query("SELECT * FROM ads WHERE ad_id='$adse'"); $ad_exist = mysql_num_rows($checkad); if ($ad_exist<1) { echo "You can only click an ad once every 24 hours."; exit(); } $ad = mysql_fetch_array($checkad); ?> <html> <head> <meta http-equiv="Pragma" content="no-cache"> <meta http-equiv="Expires" content="-1"> <title><?=$config["title"]?></title> <script> <?php if ($r["account"]=="premium") { ?> var x = <?=$config['pro_click'] + 1; ?>; <?php } else { ?> var x = <?=$config['free_click'] + 1; ?>; <?php } ?> var y = 1; function startClock() { if (x !== 'Done') { x = x-y; document.frm.clock.value = x; setTimeout("startClock()", 1000); } if (x == 0) { x = 'Done'; document.frm.clock.value = x; var code = "<?php if($loggedin==1) { $site_code = md5(time().sha1(microtime())); } else { $site_code = "Not Login"; } $_SESSION["adcode"] = $site_code; print($site_code); ?>"; var ad= "<?=$_GET['ad']?>"; success.location.href="success.php?ad="+ad+"&code="+code+"&verify=1"; } } </script> </head> <body leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0" onLoad="startClock()"> <form name="frm"> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tbody> <tr> <td class="maintopright" style=" background:url(images/adloading.gif) no-repeat 150px;border-bottom: 2px solid rgb(51, 51, 51); font-family: Verdana; font-size: 13px;" width="50%"> <div class="maintopright"> <img src="images/top_small.jpg" align="middle" /> <input name="clock" size="3" readonly="readonly" style="border: medium none ; padding: 0pt; font-size: 25pt; font-family: Verdana; vertical-align: top;" type="text"> <iframe name="success" src="view.php?example" border="0" framespacing="0" marginheight="0" marginwidth="0" vspace="0" hspace="0" style="vertical-align: top;" frameborder="0" height="48" scrolling="no" width="48"></iframe> </div> </td> <td style="border-bottom: 2px solid rgb(51, 51, 51); font-family: Verdana; font-size: 13px; " align="left" valign="middle" width="50%"> <strong>Please take the time to visit the sponsor below.<br> Show your website below for only <a href="index.php?option=advertise" target="_blank">$<?=$rowz1["price"]?></a> per 100 views!</strong> </td> </tr> </tbody> </table> <iframe src="<?=$ad["ad_url"]?>" border="0" framspacing="0" marginheight="0" marginwidth="0" vspace="0" hspace="0" frameborder="0" height="100%" scrolling="yes" width="100%"></iframe> </form> </body> </html> Hi all, I am new to PHP and MySQL and I am expierencing an issue which i need help with. I am creating a pupil record system for an assignment in Uni. we have been given some sample code and we have to build onto this and finish the system. I have created an add a student page and when the student is added I want to move to the next page and then display the record that has been added (see image below) Also see code below Code: [Select] <?php print "<H2>Thank you, <i>"; print $_POST['firstname']; print " "; print $_POST[ 'surname']; print "</i> has been sucessfully added to the system.</H2>"; print "<a href=\"add_student.php\"><h4>Add Another Student</h4></a>"; function doquery($query) { $db = "prs"; $link = mysql_connect("localhost","..........","........") or die("Could not connect to server! Error: ".mysql_error()); mysql_select_db($db,$link) or die("Could not select $db! Error: ".mysql_error()); $result = mysql_query($query,$link) or $result = "Query Error!<p>Query: $query<p>Error: ".mysql_error(); mysql_close($link); return($result); } $firstname="'".$_POST['firstname']."'"; $surname="'".$_POST['surname']."'"; $address1="'".$_POST['address1']."'"; $address2="'".$_POST['address2']."'"; $town="'".$_POST['town']."'"; $county="'".$_POST['county']."'"; $postcode="'".$_POST['postcode']."'"; $phone="'".$_POST['phone']."'"; $email="'".$_POST['email']."'"; $class_set="'".$_POST['class_set']."'"; $query = "SELECT MAX(upn) + 1 as upn FROM students"; $result = doquery($query); $row = mysql_fetch_array($result); $upn = $row['upn']; $query = "INSERT INTO students (upn, firstname, surname, address1, address2, town, county, postcode, phone, email, class_set) VALUES ($upn, $firstname, $surname, $address1, $address2, $town, $county, $postcode, $phone, $email, $class_set)"; doquery($query); echo "<table width=\"350px\" border=\"1\" cellspacing=\"0\" cellpadding=\"5\" bordercolor=\"#de5f57\" align=\"center\"> <tr> <td colspan=\"2\"><h3>Recorded Added</h3></td> </tr> <tr> <td width=\"150px\" class=\"form_labels\">Student Number</td> <td width=\"300px\" class=\"table_data\">".$upn."</td> </tr> <tr> <td class=\"form_labels\">First Name</td> <td class=\"table_data\">".$firstname."</td> </tr> <tr> <td class=\"form_labels\">Surname</td> <td class=\"table_data\">".$surname."</td> </tr> <tr> <td class=\"form_labels\">Address 1</td> <td class=\"table_data\">".$address1."</td> </tr> <tr> <td class=\"form_labels\">Address 2</td> <td class=\"table_data\">".$address2."</td> </tr> <tr> <td class=\"form_labels\">Town</td> <td class=\"table_data\">".$town."</td> </tr> <tr> <td class=\"form_labels\">County</td> <td class=\"table_data\">".$county."</td> </tr> <tr> <td class=\"form_labels\">Postcode</td> <td class=\"table_data\">".$postcode."</td> </tr> <tr> <td class=\"form_labels\">Phone Number</td> <td class=\"table_data\">".$phone."</td> </tr> <tr> <td class=\"form_labels\">Email</td> <td class=\"table_data\">".$email."</td> </tr> <tr> <td class=\"form_labels\">Class</td> <td class=\"table_data\">".$class_set."</td> </tr> </table>"; ?> Hey again guys, i am building a site admin page and i want to do a php script with will show the heading and the date of my news database into a table, and on the right or left side of each row i want to put 2 small icons one which will remove the specific record and one which will open a new small window with the whole record viewing. any idears? Last question for the week now. Almost finished. All I need to do is: Remove characters from the beginning and the end of a string. Essentially: Code: [Select] a:4:{s:4:"full";s:111:"http://www.mothernatureinc.co.uk/wp-content/uploads/2011/02/166637_482678026567_509616567_6394964_6868412_n.jpg";i:96;s:117:"http://www.mothernatureinc.co.uk/wp-content/uploads/2011/02/166637_482678026567_509616567_6394964_6868412_n-96x96.jpg";i:60;s:117:"http://www.mothernatureinc.co.uk/wp-content/uploads/2011/02/166637_482678026567_509616567_6394964_6868412_n-60x60.jpg";i:32;s:117:"http://www.mothernatureinc.co.uk/wp-content/uploads/2011/02/166637_482678026567_509616567_6394964_6868412_n-32x32.jpg";} Needs to become Code: [Select] http://www.mothernatureinc.co.uk/wp-content/uploads/2011/02/166637_482678026567_509616567_6394964_6868412_n.jpg Any ideas? Hi, May I know how can I remove all characters after the first 3 characters after . e.g : 123.512645124 I want to maintain 123.512 without rounding up. Please advise and thanks. I wanted to use strstr and trim functions but I am not able to use it to get what I want.. can some guru please assist .. thanks again Hey Guys, I have a html page and I want to set some markers or tags so when I submit the page, I can strip out content between those tags. For example something like <!-- STRIP --> .. html content la la la.. <-- END STRIP --> or have a div with a class <div class="strip"> ... html content la la la </div> A. Which would be the best one? B. How can I do this with ereg exp? Helloo everyone can someone help me i thought i had this working but i guess not when it displays it wont display any off the results that are in the file that have a ' or , or " it returns all the results for any data in the file that doesnt contian one of these can someone plese help me i have a function but it seems to not be workign witht he file() here this code i have tried mysqli_real_escape, i cant get it to work it gives me a error saying its misisng info this is how i had that in there $data = file('/var/www/htdocs/mp32/playlist.lst', FILE_IGNORE_NEW_LINES); $linesgood = mysqli_real_escape_string($conn1, $data); but no luck $ip=$_SERVER['REMOTE_ADDR']; $date = date(DATE_RFC822); print "<p><center>Loged in as $ip The Date is $date</center></p>"; $data = file('/var/www/htdocs/mp32/playlist.lst', FILE_IGNORE_NEW_LINES); $bad_symbols = array("'",",");// remove these bad symbols $linesgood = str_replace($bad_symbols,"",$data); //this is wher eit removes them or is suppose to but i guess its not becuase the results from mysql dont show back. print "<center><table border=1 frame=void cellpadding=1 cellspacing=0 align=center rules=all><tr><th>Song Position</th><th>Artist</th><th>Title</th><th>Genre</th><th>Action</th></tr>"; require('dbconfig1.php'); while($n < count($linesgood)) { $query = mysqli_query($conn1, "SELECT * FROM mp_id3_tags WHERE filename LIKE '$linesgood[$n]'"); //query database for each one while($row = mysqli_fetch_array($query)){ print "<tr><td>$n</td><td>{$row['artist']}</td><td>{$row['title']}</td><td>{$row['genre']}</td></td><td><a href=\"playlist.php?remove=$n\">Delete</a></td></tr>"; // print whats returned from mysql and print the number it is in the file read from } $n = $n + 1; } print "</table></center>"; Pleas any help! In my php and html code I have lots of whitespace and line breaks between the <tags>. How I can remove all useless whitespace and linebreaks without altering the main text and codes? Hey all, I'm using the form 'method="get" action="results.php"' on my search form... Say someone uses my 'Photo search' to search my database for aircraft, and leaves all fields blank. In this case, the only field of the search is 'aircraft'. This will take the user to 'results.php?aircraft='. Is there anyway to remove the sting if there is no search value? So it would just read 'results.php'? This is the code i have so far: Code: [Select] <?php if(isset($_GET['aircraft'])){ $aircraft = $_GET['aircraft']; } if($aircraft==""){ $aircraft = mysql_query("IGNORE aircraft"); } ?> Thanks in advanced! I'm trying to remove a dash at the end of a title, for the times when a dash appears there (which isn't always). Since my titles are always different lengths, I don't think substr will work. How can I code the following... If $title ends with '-', replace with '' Thanks! |