
countdrac
Members-
Posts
40 -
Joined
-
Last visited
Never
Everything posted by countdrac
-
Thanks for the answer if you have the time could you please explain to me where/how the exclusion takes place. i really need to learn this stuff... not just copy and paste... thanks again
-
hi im trying to get all the userId's that have been inactive in the last 30 days... so far i have SELECT userid FROM users (all the users) and i have SELECT userid FROM transactions WHERE DATE_SUB(CURDATE(), INTERVAL 28 DAY) <= EndAt so i need to exclude the second query from the first... how do i do that and just end up with the userid's of those not been used in the last 28 days (EndAt is a list of all transaction dates) thanks
-
hi i need to write an application that takes all the files in a directory, move them, and add the information to a DB based on where the files were uploaded to. eg. upload/name1/category2/file.ext needs to move to main/name1/category2/file.ext but the name1, category2 and file.ext all need to be added to a database. im not sure of the best way to do this. im sure there must be a better way to get information from the directories and files then the way i have it at the moment. also if the decide to change how many directories they will be using its a bit of a mess at the moment. at the moment ive got: function listdirs($dir) { static $alldirs = array(); $dirs = glob($dir . '/*', GLOB_ONLYDIR); if (count($dirs) > 0) { foreach ($dirs as $d) $alldirs[] = $d; } foreach ($dirs as $dir) listdirs($dir); return $alldirs; } $dirs = listdirs('../audioUpload'); array_unshift($dirs, "../audioUpload"); foreach($dirs as $dir) foreach (glob($dir."/*.mp3") as $file) { $fileName = split("/*/",$file); $num = count($fileName); echo "<option value='".$file."'>.."; for ($i=2;$i<$num;$i++) echo "/".$fileName[$i]; echo "</option>"; } $file = $_POST['fileID']; $fileName = split("/",$file); $num=count($fileName); $dir = "../audioMain/".$speaker; if(!file_exists($dir)) { if(mkdir($dir,777)) { $dir = "../audioMain/".$speaker."/".$category; if(mkdir($dir,777)) {}else echo"error"; } } else { $dir = "../audioMain/".$speaker."/".$category; if(!file_exists($dir)) if(mkdir($dir,777)) {}else echo"error"; } $newFile = $fileName[0]."/audioMain/".$speaker."/".$category."/".$fileName[$num-1]; $setPath = "../audioMain/".$speaker."/".$category."/"; $query = "INSERT INTO ... .. '".$fileName[0]."/audioMain/".$speaker."/".$category."/', '".$fileName[$num-1]."' if(rename($_POST['fileID'], $fileName[0]."/audioMain/".$speaker."/".$category."/".$fileName[$num-1])) { $dirCheck = $_POST['fileID']; $dir = $dirCheck; $check=split("/",$dirCheck); $numDirs = count($check); for($i=2;$i<$numDirs;$i++) { $dirDel = split($check[$i],$dir); if(is_emtpy_dir($dirDel[0])) { if(rmdir($dirDel[0])) { // echo "DELETED FOLDER: <br />"; } } } } thanks
-
i did. thats how i get the new lines. my question was regarding that i need it to indent, not make a new line one <--- new line two one one one <--- no indent one one one <--- indent how do iget the indent to show? i hope this is more clear
-
hi i have form where a person enters their message in a textarea, this is saved in mysql db and then it needs to be displayed on another page. the problem im having is that lets say someone wants something like this: Blah Blah Blah Blah BlahBlah Blah Blah Blah Blah how can i show the indent when i display it as html? (they use just spaces in the textarea to create the indent) thanks
-
thanks it worked! do you know what the problem was?
-
im having trouble with this ajax! when the javascript function gets called it does what it is supposed but it just puts it in the wrong place - not in the span as its meant to and what is meant to be changed in the span just stays there.... function getSearch() { alert(document.getElementById('searchDiv').value); // this just says 'undefined' document.getElementById('searchDiv').innerHTML = "WHAT???"; //this never appears anywhere ... all othe ajax stuff ... } function StateChangedSearch() { if (xmlHttp.readyState==4) { document.getElementById('searchDiv').innerHTML = xmlHttp.responseText; // this does not insert into 'searchDiv' - it inserts it above where its meant to be } } and then the form and the page.... <form class="uploadForm" name="goNext" onsubmit="return formValidatorUpload()" method="post" > <span id="theForm"> <table> <?php .............. ............ .......... <span id='searchDiv'> <tr><td colspan=1><u>Recently Added Shiurim</u></td></tr>"; $query = "SELECT * FROM shiurim, speakers, category ORDER BY shiur_upload_date DESC LIMIT 5"; $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { echo "<tr><td>"; echo "Speaker: ".$row['speaker_name'] ."<br />"; echo "Title: ".$row['title'] ."<br />"; echo "Year: ".$row['shiur_year'] ."<br />"; echo "Category: ".$row['category_name'] ."<br />"; echo "Description: ".$row['description'] ."<br />"; echo "Date: ".$row['shiur_date'] ."<br />"; echo "<a href='./audioEditShiur.php?shiur_id=".$row['shiur_id']."'>Edit Shiur</a>"; echo "</tr></td>"; } echo "</span>"; .... ?> </table> </span> </form> thanks!
-
im trying to do an INSERT then right away a SELECT (on that insert ) and for some reason the SELECT it returns nothing... im kinda new to mysql... $query = "INSERT INTO category (category_name) VALUES('".$category."')"; $result = mysql_query($query) or die(mysql_error()); $query = "SELECT category_id FROM category WHERE category_name = '".$category."'"; $result = @mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { $category_id = $row['$category_id']; } thanks
-
i have two window.onload functions im trying to get working but only one will work... im not sure how to get them both working i think it has to do with the javascript ive written... function init() { getSpeakers(); getCategory(); } window.onload=init; function getspeakers() {....} function getCategory() {....} i dont know what im doing wrong... both functions get some stuff from a db and populate a select box
-
so while trying to debug i did this... <?php session_start(); if (isset($_GET['redir'])) { $redir = "?redir=".$_GET['redir']; $redirIn = $_GET['redir']; } else { $redirIn="admin.php"; $redir="?redir=admin.php"; } if (isset($_SESSION['logged_in'])) { if ($_SESSION['logged_in'] == 1) { echo "logged in... redir "; } } else if (isset($_POST['password'])) { if ($_POST['password'] == "OApass") { $_SESSION['logged_in'] = 1; echo "passwrd logged in... "; } } ?> and the echos are executed exactly where they should be!
-
so what happens is that it just continues to reload the page and doesnt redirect as it should when the correct password is entered
-
for some reason this page does not redirect as it should... very strange... i have no idea why?! <?php session_start(); if (isset($_GET['redir'])) { $redir = "?redir=".$_GET['redir']; $redirIn = $_GET['redir']; } else { $redirIn="admin.php"; $redir="?redir=admin.php"; } if (isset($_SESSION['logged_in'])) { if ($_SESSION['logged_in'] == 1) { header("Location: admin.php"); } } else if (isset($_POST['password'])) { if ($_POST['password'] == "password") { $_SESSION['logged_in'] = 1; header("Location: admin.php"); } } ?> these headers are never executed? thanks
-
on a listbox change i need populate a new listbox getting info from a DB i can get all the info but im sitting with an array in my php form... can someone please explain what the best way to handle an array from the php and then put those into the new listbox... i was thinking i could just return (from php) one long string with a seperator (eg commas) - then i can get each one individually in the JS (when populating the listbox) but there must be an easier way? this is kinda what im having trouble with... while ($row = mysql_fetch_array($result)) { $list[$i][0] = $row['title']; $list[$i][1] = $row['file_name']; $i++; } mysql_close($connection); echo $listArray; //dont really know how to return this properly as an array So this is what i was doing before returning the array... should i keep this one and change the way php returns (string instead of array)? var response = xmlHttp.responseText; var plist = response.split(","); var pfile = ""; var length = plist.length; for (var i=0; i < length-1; i++) { var parshaEl = document.createElement('option'); //create option var El = document.getElementById('list'); El.appendChild(parshaEl); //then append it to the second dropdown list pfile = plist[i].split("##"); //when using the string the string was like title1##filename1,title2##filename2,... pfile[1]+=".inc"; parshaEl.value = pfile[1]; parshaEl.innerHTML = pfile[0]; thanks
-
this is my table: name id description topic year category so now i want to know - i only have around 5 categories so is it worth me have a seperate table for it? this is for a website which i populate a dropdown box with the categories... i just want to know as a design aspect if its better to just hardcode the categories into the html or populate them from the DB (ie making a table for them and getting them from there)? thanks
-
hi i need to check a file to see if its encoded in windows-1250 so ican convert if it is... i cant just convert the files that are in the correct encoding because this adds some strange characters where there shouldnt be does anyone know how i can check? ie if (windows1250($doc)) { iconv(...); } how do i do that check?
-
when you replied and said i need a br2nl and said i need the code: str_replace("","\r\n",$string); str_replace("","\r\b",$string); i assume you meant str_replace("\r\n","",$string); str_replace("\r\b","",$string); however im still getting the same problems... i think it could be the \r\b... when i try str_replace("\r\b","XXXXXXXXXX",$string); the X's dont show up... am i doing something wrong? thanks
-
this str_replace("","\r\n",$string) and str_replace("","\r\b",$string); im assuming that its meant to be the other way... replace the \r\n and \r\b with "" but i couldnt get this working... whats the \r\b? i feel im missing something...
-
that it seems to do the same as the $editFile = preg_replace("/\r?\n/", "\\n",$file); the other files still arent going through...
-
hey i tried nl2br() and still not working im trying to set up a file editing thing where you select a file and it populates a textarea with the contents of the file sometimes it seems though that when i try to use onclick when the save button is hit... basically the data is not passed through so like i said if i do a $editFile = preg_replace("/\r?\n/", "\\n",$file); now about half the files are accepted by the javascript function (i mean the function actually executes...) at the moment it doesnt even get into the function if theres something wrong with the format of the variable it seems... thanks
-
hi im trying to format text for a textarea - the text comes from files which are (in essense) the same just what different content however the textarea is a part of a form so when it gets submitted it needs to be formatted for javascript so as far as i understand i need to strip the string for carriage returns (anything else?) but when i try this... $parsha = $parsha = preg_replace("/\r?\n/", "",$parsha); so this manages to work for about half of the files... but the other half are still not working... the truth is that i dont know if this is getting every carriage return - im not so clued up on regex... can someone please help me out here? thanks
-
[SOLVED] strange characters � from fread()
countdrac replied to countdrac's topic in PHP Coding Help
Thanks did the job! $result = iconv("WINDOWS-1250","UTF-8",$result); -
[SOLVED] strange characters � from fread()
countdrac replied to countdrac's topic in PHP Coding Help
ok cool so i got textpad and it seems they for sure something different... when i highlight the wierd character the code comes up: 0x92, 0x93, 0x94 and 0x97 (depending on which i go over) from a couple of files ive looked at these are the ones that are giving problems..... im not sure if there are others at this point... what are they and how can i isolate them in a string replace (-or whatever) thanks -
[SOLVED] strange characters � from fread()
countdrac replied to countdrac's topic in PHP Coding Help
do you mean physically go into the included file? i have like 50 files... how do i isolate what that � is? ive been trying but i cant figure out how to do it... -
[SOLVED] strange characters � from fread()
countdrac replied to countdrac's topic in PHP Coding Help
ye i tried to stick that in the header... didnt help -
[SOLVED] strange characters � from fread()
countdrac replied to countdrac's topic in PHP Coding Help
hi thanks for the help so i tried first: $result = preg_replace('/\s\s+/',' ',$result); and $result = preg_replace(' ',' ',$result); which just crashed and returns nothing then i tried string replace which even when i tried $result = str_replace(' ',' ',$result); which as a function works and does what it supposed to... but doesnt get rid of the � characters... besides all that like i said i think that they are certain: single quotations, double quotations and dashes in the file im still kinda new to php so any help would be helpful... what do you recommend the best way to to fix this is? thanks