[PHP] Why this doesn't work ?

2005-10-24 Thread Scott Noyes
 $query = SELECT COUNT (login) FROM formacao WHERE login = '$login';
 $result = mysql_query($query);

Make this line instead
$result = mysql_query($query) or die(mysql_error() .  with the query $query;
and you'll likely see the error.

--
Scott Noyes
[EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] __FILE__ and __LINE__ of calling scripts?

2005-09-27 Thread Scott Noyes
 I want to find out if it is possible to get the file name and the line
 number of a calling script (__FILE__, __LINE_) from a calling class
 automatically.

debug_backtrace contains that info.

http://www.php.net/debug_backtrace

--
Scott Noyes
[EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Is PHP the language for me???

2005-09-23 Thread Scott Noyes
 I have directories in place and am using flash to auto fill the directory 
 names on to an index page, however i cant use this to access the files 
 themselves. So I am after a language i can use to read all the file names in 
 the directory and display them with a bit of 'niceness' onto a webpage so as 
 they can be used as links to the files.

PHP is capable of doing that.  I'd start with the dir() function, and
maybe a bit of printf.
http://www.php.net/dir
http://www.php.net/printf

--
Scott Noyes
[EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Retrieving variable name?

2005-09-22 Thread Scott Noyes
 Sure.  Use debug_backtrace to figure out what line and what file the
 caller is in, then read that file, find that line, find the function
 call within that line, and read what ever is between the parentheses.

Something like this:

?php
function myTest($input) {
$backtrace = debug_backtrace();
$file = file($backtrace[0]['file']);
$linenum = $backtrace[0]['line'];
$function = $backtrace[0]['function'];
$line = $file[$linenum-1];
preg_match(/{$function}\((.*)\);/, $line, $matches);
echo This function called with '{$matches[1]}';
}

$a = 5;
myTest($a);

?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Retrieving variable name?

2005-09-21 Thread Scott Noyes
 is it possible to retrieve the name of a variable passed into a
 function from within the function?

Sure.  Use debug_backtrace to figure out what line and what file the
caller is in, then read that file, find that line, find the function
call within that line, and read what ever is between the parentheses.

Can't think of why you'd want to do this, though...

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] html forms in php

2005-09-16 Thread Scott Noyes
 Are you sure? and then a yes and no buttons to confirm the deletion or
 to cancel the command.
 
 Any thougts??

While some of the others here have answered your technical question,
I'd like to state my opinion on usability.

I HATE Are you sure? prompts.  If I wasn't sure, I wouldn't have
clicked it in the first place.

If you want to make your users happy, trust them when they say
Delete, but make it easy to undo.  Instead of deleting the records,
just set the Delete flag and timestamp.  Then when the odd user
makes a mistake, just unset that flag.  After a period of time, you
can really delete the records that were marked a few days ago.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Perhaps a stupid question on phpinfo

2005-09-16 Thread Scott Noyes
 $mypath = C:/phptestdir/;
 $file = phpinfo.htm;
 $html_file = fopen($mypath$file, w);
 fwrite ($html_file, printf(phpinfo()));
 fclose ($html_file);
 
 How would I accomplish this?

ob_start();
phpinfo();
$content = ob_get_clean();
fwrite($html_file, $content);

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: trying to figure out the best/efficient way to tell whois logged into a site..

2005-09-14 Thread Scott Noyes
 Suppose you have a form that posts set hidden values.  A malicious user
 could modify the URI to change those values.

A malicious user could just as easily modify the http header that sets
the POST, or the cookie that sets the COOKIE, or whatever.  In other
words, if it comes from the user, it could have been tampered with.

 Which raises the question, in the scenario above, you may have an identical
 'post' value and 'get' value submitted to the same page.  Which takes
 precidence in $_REQUEST?

That is configurable in php.ini (I think).  By default, COOKIE
overwrites POST overwrites GET.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Inserting records question

2005-09-08 Thread Scott Noyes
 mysql_connect(localhost,$username,$password);
 @mysql_select_db($database) or die(Unable to Connect to 
 DB);
 $tc_query = INSERT INTO $tablel VALUES(NULL, $lname, $fname, 
 $machine_name,
 $email_addr, $problem, NULL);
 $result = mysql_query($tc_query);

It's always nice to check if the query even ran, using or
die(mysql_error()).  You might also want to print out the query
itself to see if there are missing values.  Perhaps you're relying on
register globals, which is turned off?

$result = mysql_query($tc_query) or die(mysql_error() .  in the query
$tc_query;

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] ZCE Reccommendations

2005-08-30 Thread Scott Noyes
 I'm taking my ZCE exam soon and would like general advice on what to
 study up on. I've been using php since 97 so I'm pretty confident with
 day-today stuff, but I'm pretty new to OOP and and looking for any study
 pointers I can get.

Remember that the ZCE still uses PHP 4.  Classes and objects changed
between versions 4 and 5.  If you've done some development in 5 and
gotten used to it, study carefully the differences between the two.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Bug??

2005-08-30 Thread Scott Noyes
 for($i=1;$i13;$i++) {
 echo $i .  :: ;
 echo date('F', mktime(0, 0, 0, $i)) .  :: ;
 echo mktime(0, 0, 0, $i) . \n;
 }
 
 
 1 :: January :: 1107061200
 2 :: March :: 1109739600
 3 :: March :: 1112158800

Today is the 30th (in some parts of the world, anyway).  mktime fills
in the current time is no argument is provided.  So for Feb, the
equivalent is
mktime(0, 0, 0, 2, 30, 2005, true);
And the 30th day of Feb, 2005 is March 2nd.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] formatting problems:

2005-08-16 Thread Scott Noyes
It's not clear to me how strict you want to be regarding the
formatting.  Are you trying to keep scenes together on each line, or
just dump everything and let it wrap where it needs to?  Perhaps you
could handcode a sample and post a link.  I'd also guess that you
could make good use of CSS, specifically the float: left and
clear=all attributes.


 My database has a table called movies which has data like this:
 
 flick_name ,flick_cover, part_url
 
 flick_name is the name of the movie, the movie is cut into several pieces
 for faster downloads
 part_url is the full path to each of the pieces
 
 eg:
 home movie 1 ,a.gif, http://movieserver.com/scene1_1.wmv
 home movie 1 ,a.gif, http://movieserver.com/scene1_2.wmv
 home movie 1 ,a.gif, http://movieserver.com/scene1_3.wmv
 home movie 1 ,a.gif, http://movieserver.com/scene2_1.wmv
 home movie 1 ,a.gif, http://movieserver.com/scene2_2.wmv
 home movie 1 ,a.gif, http://movieserver.com/scene2_3.wmv
 etc
 
 I am trying to get it into this format:
 http://www.ezee.se/format.jpg

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Trying to figure out contents stored in db field

2005-08-14 Thread Scott Noyes
Unserialize it, and then use var_dump() to see what the object contains:
var_dump(unserialize($location_data));

On 8/14/05, Gregory Machin [EMAIL PROTECTED] wrote:
 Hi
 The cms exponent story some data in a serialized array ..
 then column name id location_data and contains the following..
 
 O:8:stdClass:3:{s:3:mod;s:10:textmodule;s:3:src;s:20:@random419404caefcef;s:3:int;s:0:;}
 
 i fugure there is an object stored in this serialized array. how do i
 figure out the properties of the object, I cant find the file that
 holds classe that it uese ..
 
 Any ideas ?
 
 Many Thanks
 
 
 --
 Gregory Machin
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]
 www.linuxpro.co.za
 Web Hosting Solutions
 Scalable Linux Solutions
 www.iberry.info (support and admin)
 www.goeducation (support and admin)
 +27 72 524 8096
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] possible bug (string equality to zero)?

2005-08-11 Thread Scott Noyes
 [snip]
 Is it a bug that ($var == 0) is always true for any string $var?
 [/snip]
 
 You are comparing a string to an integer.

Right.  This is clearly documented at http://www.php.net/operators.comparison

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php