Chmode With Mkidir Function, The Result Isn't As Expected
I've tried to create a directory with the php function mkdir(). I've used a "0777" mode , so that owner,group and other can read,write and exectue files in this directory.
There's no problem creating the directory, but after it has been created, its mode is "0755".
Where did I commit a mistake ?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Function Not Returning Expected Value
I have a php file that contains a couple of arrays used for state/country pull-down lists. I have two global arrays and an accessor method for each. I have some simple logging methods, so I know a little bit about what I'm getting back. When I try to get the arrays from another file using the accessor methods, I get no array back. Within the file that contains the arrays, I can access them by global name and also by the accessor methods. Any ideas why I cannot access the arrays from another file? Code below. <SNIP FROM CALLING METHOD> require_once BASE . '/config/formfields.inc.php' // file with needed arrays // the calling method function display_states($smarty){ logobj(function_exists(get_states)); // returning True/1 $s = get_states(); logobj($s); // no love here logobj(BASE . '/config/formfields.inc.php'); // it's the right file }
View Replies !
Why Mysql Isnt Connecting
trying to get php to connect with mysql so that I can start querying db(running locally on my machine and php works fine) however I'm having trouble. This is the error it spits out- Warning: mysql_connect(): Access denied for user 'ODBC'@'localhost' (using password: NO) in D:phpwebconnect.php on line 5 Unable to connect to MySQL Could anyone assist me on this matter.
View Replies !
How To Add Function Result To Array?
The way I'd like to set up a particular set of functions is to have them either return TRUE or, for example: $errors[type] = "Sorry, the file type is not allowed. Allowed types are ".print_array_inline($acceptedTypes).". "; Then later, I have a foreach loop that echos each array element. However, when I echo each array element is doesn't output the whatever the print_array_inline function does. Any suggestions?
View Replies !
Isnt ^ Common Regex Notation?
isnt ^ common regex notation? keep getting this error: Parse error: syntax error, unexpected '^' Code: $goalsheet.=preg_replace("/^[0-9]+ Year Career Goal #[0-9]+: *$", "/^<span class=hd2>[0-9]+ Year Career Goal #[0-9]+: *</span><br>$/", $goallist); aside from the error, i think the regex is off, but i hav had a hard time finding a tutorial that explains how I can ignore text in the middle. Here are some examples of what i'm trying to do: "1 Year Goal #1: Web Developer" -> "<span>1 Year Goal #1: Web Developer</span><br>" "10 Year Goal #2: IT Consultant" -> "<span>10 Year Goal #2: IT Consultant</span><br>" suggestions?
View Replies !
INSERT Code Isnt Working.
This probably has a really simple answer, but my INSERT code isnt working. mysql_query('INSERT INTO `members` (`id`, `uname`, `uemail`, `upass`, `GUID`, `data`, `permissions`) VALUES ('NULL', $psuser, $psemail, $psPassword, 'NULL', 'NULL', Ƈ')'); And I get an error saying unexpected T_STRING .
View Replies !
Query Result Navigator Function
I've just updated this, and I thought I'd also say that not only can this provide a page navigation for MySQL or other database results, but can be used to navigate other lists.. such as a file list. PHP Code:
View Replies !
Adding Result Row To Mail Function
I have an email script that will pull the addreses from my club membership database. That part works fine. the problem I am having is being able to include row results inside of the actual email message. My message variable is something like this: Code:
View Replies !
Saving Result Of Function Without Being Echoed
I am trying to save the function "rand(1, 1000000)" in a variable but when I am for example trying: $randomnumber = rand(1, 1000000); it is executing it right ahead while when i try $randomnumber = "rand(1, 1000000)"; or $randomnumber = 'rand(1, 1000000)' It is saving rand(1, 1000000) as variable. But what I need is a variable saving the result of rand(1, 1000000) so the number does not change either. Any ideas how I would do this?
View Replies !
Storing The Result Of Javascript Function
how do I store the result of a javascript function into a PHP variable? I have a div that is hidden or shown based on whether or not a checkbox is clicked. Initially the div needs to be hidden. So how do i make sure that it will be hidden in all browsers when the page loads. The code for hiding and unhiding it works in the different browsers i have tried, but not initially being hidden. attached is what I currently have.
View Replies !
How Do Sessions Work Cos Mine Isnt Working?
How do sessions work cos mine isnt working i got this: on a different page i have : $_SESSION['referer'] = '1'; then: if ($_SESSION['referer'] == '1'){ include ("include.php"); } but when i echo session it is blank =/ what did i do wrong.. i got many other sessions on the go so it should work..
View Replies !
Script Isnt Pulling The Basename From Upload
This upload script im using for some reason wont pull the file name and database it when you go to upload a file and it wont upload the file either... I used this script before and got it to work but for some reason it wont work now.. I checked the other forms and they still work so i must be missing something in the script. Code:
View Replies !
Simple Image Upload Isnt Working?
im working on a simple image upload script (my first try) well i noticed that for some reason its not even recognizing a file being uploaded...ive tried using the phpfreaks simple image upload tutorial but that wont seem to work for me. Code:
View Replies !
MySQL Result To Real Array In Function
I'd like to create a function which input is the result of a mySQL query. The output should be exactly the same, only not a mySQL result array, but a 'real' array. So it should also get the fieldnames returned by mySQL and use those as keys. I can't get things to work properly: it should return a multidimensional array, like $result_array[1] = array( [field1] => field1 value, [field2] => field2 value, etc. ) somehow my result is (with code below) $result_array[1] = array( [0] => field1 value, [field1] => field1 value, [1] => field2 value, [field2] => field2 value, etc. ) +++++ code ++++++ $get_res= mysql_query(QUERY); if( $res = mysql_fetch_array( $get_res ) ) { do{ $result[] = $res; }while( $res = mysql_fetch_array( $get_res ) ); }; foreach( $result as $key => $value ){ print_r($value); };
View Replies !
Assign MySQL Function Result To PHP Variable
I know to use: mysql_fetch_row($result) to convert a row from a SQL query result set into an array for use with PHP. but in the case of SQL queries that return one value, such as calls to MySQL functions, is there another PHP mysql api function I should use. For example, right now I use a "workaround" technique from PHPBuilder: $result=mysql_query("SELECT COUNT(*) FROM tablename"); list($numrows)=mysql_fetch_row($result); Rather than using this "workaround" code is there a way to simply assign the result of the MySQL function query to a variable. $result=mysql_query("SELECT COUNT(*) FROM tablename"); $numrows=mysteryfunction($result);
View Replies !
Using The Function Prevents Accessing The Result Of The Match.
I don't know if this is possible, but it should be. However, it doesn't seem to be working for me. how I can get it to work: I use :||: for my delimiter for str_replace, etc. When replying, the new PM is appended in front of the existing chain of replies, thus the same table entry is used and updated each time. Problem is in storing the sent date, and providing time zone and format adjustments: $string='This is the message that was sent on :|1161850848|:' $newString=preg_replace('/([0-9]*)/',format_time(adjust_time('${1}')),$string); // the result of this is as if ${1} = 0 $newString=preg_replace('/([0-9]*)/','${1}',$string); // returns 'This is the message that was sent on 1161850848' It seems that using the function prevents accessing the result of the match.
View Replies !
Search Function That Highlight Result Instead Of Filtering It Out
I am trying to create a search function that will jump to the page containing the result and highlight it instead of filtering it out. To more clearly illustrate what I mean take a look at this link: I would like to search for eg. "bruce wayne" (its record number 30) and just have that row highlighted. Anybody who could steer me in the right direction would be a massive help as I've spent the last 2 days trying to work this out with no joy.
View Replies !
INSERT Short Record = Fine, Long One Isnt
I have a mysql database table that I created by copying another one in phpadmin. The first table works fine. the second table works fine when I insert a short record, but when I do a long one it doesn't appear in the database. any idea what I'm doing wrong? It's not that its truncating the record, there is nothing there.
View Replies !
Function To Test If Mysql_fetch_array($result) Pointing Last Record?
I try to perform multiple insert statment, but the problem is in the below codes, the last sql concatenation ends with ",". I wonder if there is any php function to test if the $result set contains the last record. ------------------ //Get topic id of vote_topic from last insert record $sql_topic_id = "SELECT topic_id FROM vote_topic ORDER BY topic_id DESC LIMIT 1"; $result = mysql_query($sql_topic_id,$conn); $row = mysql_fetch_array($result); //Get all student info from stuinfo $sql_strn = "SELECT strn from stuinfo"; $result1 = mysql_query($sql_strn,$conn); //Dump all student strn into vote_status. //Multiple insert statement? How? $sql2 = "INSERT INTO vote_status (strn,topic_id) VALUES "; while ($row1 = mysql_fetch_array($result1)){ $sql2 .= "VALUES ('".$row1[strn]."','".$row[topic_id]."'),";} mysql_query($sql2,$conn); ---------------------
View Replies !
Refreshing Cache Through Php Header Function Yields No Result?
I am building a website for a client. He wants a login page with a "Your account" page for his clients. I am using a combination of javascript and php. Upon succesful login $_SESSION variables are set to 1. example: $_SESSION['logged']= 1; If the client logs out due to idle time or pressing 'logout' these values are set to zero. example: $_SESSION['logged']= 0; Upon loading of "your account" and any of its sub-pages, that page checks $_SESSION['logged']. If the value is zero it redirects automatically back to the login page. Providing oppertunity to log in again if you wish. The checking of $_SESSION['logged'] is supposed to redirect even if the client has logged out, but has pressed "back" on the browser to try and see a login page. The page does not do this. Pressing "back" reveals the page. Interacting with the page or pressing "refresh" THEN causes it to redirect. I need the page to auto-redirect, not show. I am aware that it is the page being cached and keeping those values until you interact with it. I have fully tested the header function in php. Using 'must-revalidate' & 'no-cache' and other version! (most info from php.net). I get no errors when testing the pages, so my code is correctly spelled! But there is simply no reaction by the page, it just does what it does, which is not what it is supposed to do? I ask for experience! Is there a specific way of doing the header functions? Perhaps it must be placed in a specific place in the page? And how can i check that the page is actually using the functions and not just moving over them with no action taken?
View Replies !
Security Code Image In PHPNuke Login Isnt Displaying
i installed the PHP Nuke in a remote web space bought from prackhost.Problem is that iam not able to get the security code to login to the site as admin or normal user. All the remaining images like links and logo are comming except that security code. Iam not able to do any furthur action.
View Replies !
Warning: Mysql_result() [function.mysql-result]: Unable To Jump To Row 0
i want to grab the value of a sql entry. but the thing is, sometimes this value is <NULL>. i thought, no biggy, i'll just have an if statement: if (is_numeric(mysql_result($query, 0))) { //do something } else { //do something else using mysql_result($category_id_query, 0); } however, this doe not work. i get this error: Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 3 is there a way to check to see if mysql_result() is <NULL> without throwing an error.
View Replies !
Expected Output
When I try to test my setup by making the file test.php with the single line PHP Code: <?php phpinfo(); ?> then goto http://localhost/test.php it displays Quote: <?php phpinfo(); ?> instead of all the info.
View Replies !
T_OLD_FUNCTION Expected???
I use EngIn editor, my code ran ok there... but not when I ran it on my apache server.. got the following error: Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in C:japachecaseFileCVf.php on line 5 Here's the code:
View Replies !
Loop Expected
i get it to loop, so that it keeps doing it for; $start =10 then 20 etc right up to 1000 the function is; function query($topic, $start = 0) { $googlelist = $this->_query("Google", $topic, $start); $yahoolist = $this->_query("Yahoo", $topic, $start); $this->found = array_unique(array_merge($googlelist, $yahoolist)); $this->counts = array("yahoo" => count($yahoolist), "google"=> count($googlelist), "total" => count($this->found)); return true;.
View Replies !
Could The Close_date Be One That Is Not The Expected Value?
Here's the code. $link="http://xbox360cheat.org"; $close_date=$_POST["close_date"]; #last content change check if ($close_date == 0) $close_date = date("Y-m-d H:m:s", mktime(12, 0, 0, date("m"), date ("d")+7, date("Y"))); else if ($close_date == 1) $close_date = date("Y-m-d H:m:s", mktime(12, 0, 0, date("m"), date Could the close_date be one that is not the expected value? For example, if the month is 11 and $close_date == 7, then the mktime function should return the next year for the year value, not the current year. And if the day is the last week of December, than the month and year should change if close_date == 7.
View Replies !
Implode() Not Working As Expected
I have one page with a form that uses an array ($order) to print out ordered items. This page then posts to a second page to get personal information from the person ordering. Before posting the form, I implode the array into another variable ($items_ordered), so that I can print a summary of the items ordered on the second page. (The following code is all within the <form> tags.): Code:
View Replies !
NULL Expected, Won't Show Up ...
I have tho following code. $_GET['artile'] looks like this: /2006/03/lorem_ipsum $locationinfo = explode('/', trim( $_GET['article'] , '/') ); list( $article_year, $article_month, $article_url ) = $locationinfo; echo '<br>year: '.(($article_year === NULL)? 'null': $article_year); echo '<br>month: '.(($article_month === NULL)? 'null': $article_month); echo '<br>article: '.(($article_url === NULL)? 'null': $article_url); The weird thing is, if $_GET['article'] is empty, $article_year isn't NULL, but the rest is. This doesn't make any sense to me ...
View Replies !
Ini_set() Not Working As Expected
When running the following code I get a warning: <? ini_set('session.use_cookies',0); ?> random text <? session_start(); ?> The output / warning I'm getting is this: random text Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /path/to/file.php:5) in /path/to/file.php on line 6 Shouldn't the fact that I'm setting session.use_cookies to 0, via ini_set, prevent this error from taking place?
View Replies !
Preg_replace Not Matching As Expected
I'm attempting to write a bit of code that will parse a HTTP_REFERER from google and return the search data and the nationality (.fr, .co.uk, etc). I can get a rough output (see bellow) but the search value (2 in the script) continues past the '&' character which is where I need it to stop. PHP Code:
View Replies !
CURL Results Not What Expected
I was playing with cURL on a website and it didnt work. So I switched to a different website and it worked just fine. So that little part of my brain that is always working started wondering why cURL wouldnt work with the first website that I had tried. I'm hoping that someone here can help me figure out why this particular website wont work with my cURL script, and help me get it working. Code:
View Replies !
Sort Results Not As Expected
In the actual array I'm working with, the a, b, c's are primary keys. One shouldn't expect them to actually be in order. This example uses a, b, c to verify if a sort worked properly. I want to sort the array so the result will have a,b,c,d,e,f,g,h, etc in order. Code:
View Replies !
Not Getting Expected MySQL Error
I am inserting values into a row.. works OK If I try to insert a value into a row that doesnt exist (using where) it always returns true the same as if it did work I want to update rows that have one unique field.. if the row doesnt exists it should return 0 rows updated.. I then create the row... But it always returns 1 even when I update a row that doesnt exist.. How do I get an error or a false return?
View Replies !
If Statement Not Working As Expected.
I am trying to get my error message to print if either the login is incorrect or the dropdown variable is "Unknown" I get no errors and I know that the variable is posting correctly. I think I'm missing something or put it in the wrong place. Code:
View Replies !
Ereg Not Behaving As Expected
I'm having a problem with the ereg function to verify a user submitted variable the situation is that the user is submitting a textarea post variable there are a number of allowed characters there are more in the actual application but i have removed to demonstrate the problem as removing them makes no difference the php code is as follows: $message=$_POST['textarea1']; if (ereg("^[A-Za-z0-9 ]*$",$message)) { $textValid=TRUE; } else { echo "error"; } but it seems to act like $message=$_POST['textarea1']; if (ereg("^[A-Za-z0-9]*$",$message)) { $textValid=TRUE; } else { echo "error"; }
View Replies !
Buffer Flush Doesn't Work Quite As Expected
I've got a PHP script (running on MacOS X, PHP 4.1.12) which uploads bookings from one database to another, and I'd like to have the screen show progress as it happens (each time I process a booking, I write a line summarising it to the browser with 'print') From RTFMing and Googling, it seems that I should be able to do this by turning output buffering on and using ob_flush() et al. However, this only sort-of works, in that instead of getting output line by line, I get a multi-line chunk on the browser from time to time. Am I stuck with having this chunk-by-chunk visualisation, or can anyone please suggest a way that I can make it force each line to the browser as I write it?
View Replies !
Unexpected Absence Of Expected Warning
The page 167 of book Learning PHP5 by David Sklar says that setcookie() and session_start() must be added before any output. I tried to use that functions at last line but no warning!. The warning which i got 1 month back is not issued now. ------------------------------------------------------------------ The following is my PHP program <?php function Intelli() { echo"Hello P"; } function Bitz() { echo"Hello MySQL"; } ; $a = 1; if($a) $myFunc = 'Intelli' else $myFunc ='Bitz' $myFunc(); print'header' session_start(); setcookie('userid') ?> ---------------------------------------------------------------- The following is the output i got. There is no warning [tdphpadmin@trgbws40 ~/public_html/demo]$ php dynamicfun.php X-Powered-By: PHP/5.2.0 Set-Cookie: ZDEDebuggerPresent=php,phtml,php3; path=/ Set-Cookie: PHPSESSID=bp1m17rlrgsa5g19tfekidov31; path=/ Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre- check=0 Pragma: no-cache Set-Cookie: userid= Content-type: text/html
View Replies !
Predefined Variable Not Working As Expected
I have a script that was working fine until I had to reinstall everything. Now my scripts says that : PHP Notice: Undefined index: LOGON_USER in D:Inetpubwwwroot ame.php on line 5 Where I have just made a new file to isolate the issue, but this derives from this script : <?php echo $_SERVER['LOGON_USER']; ?> Which worked fine before. Is this down to the way php is being run? As it stands it is being run via IIS 5 as cgi executable. I've looked over the install txt and it seems as though I have done everything correct.
View Replies !
Delete Query Not Working As Expected
I have 2 different php forms. One makes sure that a user has chosen an unique user name (below): $query_rsApp = "SELECT * FROM users where UserName=".$Registered." "; This Select query works right every time (as far as I can tell). I have a form that I want to use to delete user records. This Delete query works fine if the username and password are both numeric... But if the username or password is text, it returns the error "UNKNOWN FIELD 'whatever'" where whatever is my search criteria that I am trying to use.
View Replies !
Unexpected Absence Of Expected Warning.
The page 167 of book Learning PHP5 by David Sklar says that setcookie() and session_start() must be added before any output. I tried to use that functions at last line but no warning!. The warning which i got 1 month back is not issued now. Code:
View Replies !
Regex Doesent Work Expected...
i use this to get all html tags out of an string .. preg_match_all('/<[^>]*>|[^<>]+/', $data, $contentParts); worked wonderful till i noticed that this doesent work with something like "{if $commandCount > 0}" this will be split in 2 parts: "{if $commandCount " and " 0}" and the < is gone It shouldnt split anyway when it detects an " < " or ">=" or " <=" and so on..
View Replies !
Imagecolortransparent Not Working As Expected - Any Ideas?
I'm trying to rescale a gif file with transparency but am having difficulty with the imagecolortransparent() function - It's not working as I would hope... I'm telling it to replace the colour red with transparency and then overlay my transparent gif, but resized. For some reason, it is turning anything black in my transparent gif, transparent, instead of the red - Can anyone else figure out why it might be doing this? Code:
View Replies !
Elegantly Handling An Expected Error
I have a very modest database on my server and I use php to allow people to query it. Its very simple, they enter a value that should be in column 1 (account_num) and I return the value for column 2 (balance) (same row). Here is the question: What if the value they enter doesn't match any values in column 1? Right now, I get this ugly error message: Code:
View Replies !
Line Breaks Don't Work As Expected
I wrote this small bit of code for a college class, but the instructor offered no feedback. Our textbook offered nothing and the teach yourself book I bought had typos in it. :mad: I don't understand why the linebreaks in the php code didn't work properly. I ended up putting them at the beginnings of the next line, rather than the end of the previous line. I think that's sloppy; I want to undertand why the line break worked on the first line but not subsequent lines. I expect it's something semantic, quotes or such. Code:
View Replies !
Problem Getting Script's URL ($_SERVER['PHP_SELF'] Not What I Expected)
I have a function that restricts access to a page to logged in users. When a user who isn't logged in goes to the page, it will dynamically generate a login form. I'm trying to use it in conjunction with the free shared SSL certificate offered by my host. To use SSL, you would change a URL like this http://mydomain.com/page.php to https://ssl.myhost.com/mydomain.com/page.php My problem: when my script dynamically generates the login form, it uses the $_SERVER['PHP_SELF'] value in the action field. But this ends up being '/page.php' rather than '/mydomain.com/page.php' so my form gets submitted to https://ssl.myhost.com/page.php instead of https://ssl.myhost.com/mydomain.com/page.php Simple I thought, I'll just use the SERVER or ENV variable that gives me the full url. My problem: it doesn't seem to exist!
View Replies !
PHP 404 Document's REQUEST_URI Does Not Hold Expected Value In $_ENV And $_SERVER
I wanted to migrate some custom 404 error pages from shtml to php for the ease of email notification of lost pages. However when PHP processes the page $_ENV['REQUEST_URI'] and $_SERVER['REQUEST_URI'] both now hold the error page eg "404.php". Does anyone have advice on how to dodge this? Should I just continue to use shtml error pages and do an shtml include on a little php script to do the mail?
View Replies !
Displaying Result 1-8, Then Result 9-17 Etc.
I dispaly the results from the database like this. <? while ($row = mysql_fetch_array($prod_result)) { $small = $row[0]; echo"<td align=center><img src="produkter/hardware/decks/$small"></strong></td>";}?> But if there are more than 8 results, I wnat to dispaly the first 8 on one page, then the next 8 on the next page...How can this be done?
View Replies !
Nesting Result Loops Within Result Loops Possible?
I'm looping through a query, and inside the while result output, I am trying to loop through a second query (created from the 1st query's row results). I have checked that both queries return info. I can see that the 1st while result output works fine, but when I get to the inner while result output, it never returns any rows (nothing in the while loop evaluates). So, IS it possible to nest one query's output loop within another, or am I doing something wrong?
View Replies !
|