Re: [PHP] Howto search in SQL for a specific character?

2005-11-30 Thread Ciprian Constantinescu
The ' character has to be escaped. Try using \'
Gustav Wiberg [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi

 I'm sorry but this didn't work either? If I replaced the ' with for
example
 an a it worked

 /G

 - Original Message - 
 From: Stephen Johnson [EMAIL PROTECTED]
 To: Gustav Wiberg [EMAIL PROTECTED]; PHP General
 php-general@lists.php.net
 Sent: Tuesday, November 29, 2005 10:00 PM
 Subject: Re: [PHP] Howto search in SQL for a specific character?


  Try this :
 
  $sql = SELECT nameOfPedigree FROM tbpedigrees WHERE  nameOfPedigree
like
  '%;
 
  The % is a wildcard and will give you the results you want.
 
 
  ?php
  /*
 
  Stephen Johnson c | eh
  The Lone Coder
 
  http://www.ouradoptionblog.com
  Join our journey of adoption
 
  http://www.thelonecoder.com
  [EMAIL PROTECTED]
 
  continuing the struggle against bad code
 
  */
  ?
 
 
  From: Gustav Wiberg [EMAIL PROTECTED]
  Organization: Gustav Wiberg
  Reply-To: Gustav Wiberg [EMAIL PROTECTED]
  Date: Tue, 29 Nov 2005 21:55:27 +0100
  To: PHP General php-general@lists.php.net
  Subject: [PHP] Howto search in SQL for a specific character?
 
  Hi there!
 
  in PHP i Write..
 
 
  $v1 = chr(39); //39 is apostrofe
 
 
  $sql = SELECT nameOfPedigree FROM tbpedigrees WHERE
  SUBSTR(nameOfPedigree,0,1) = $v1;
 
  Why doesn't this work?
 
  I want the sql to select all nameOfPedigree - fields where the first
  character is apostrofe (')
 
  /G
  http://www.varupiraten.se/
 
  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 


smime.p7s
Description: S/MIME cryptographic signature


[PHP] Re: How do i display a neat table of returned mysql data?

2005-11-30 Thread Ciprian Constantinescu
First of all this is not automatic. You can do this with a foreach loop. If
you want nice presentations, you might as well try http://smarty.php.net


Dave Carrera [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi List,

 I have some mysql table data that i would like to display back to the
 web user in a neat and tidy way using php.

 Data:

 col1   col2   col3
 test   1.99   F
 test   1.99   F
 test   1.99   F
 test   0.99   F
 test   1.99   F
 bang 2.99   F
 bang 3.99   F
 bang 4.49   F
 bang 2.99   F
 bang 2.99   F

 Table display i am hoping to display:
 First the unique name of col1 as a header

 tabletrtdtest/tdtdbang/td/tr/table

 Second a row each for each col2 and col3 where header above = col1 so
 the finished table looks like this

 test   bang
 1.99   F2.99   F
 1.99   F3.99   F
 1.99   F4.49   F
 0.99   F2.99   F
 1.99   F2.99   F

 I will really appreiciate and help you may give with this question.

 Thank you in advance

 Dave C


smime.p7s
Description: S/MIME cryptographic signature


Re: [PHP] GD2 Question

2005-11-30 Thread Ciprian Constantinescu
Not efficient, because the actual size on the disk depends on the
filesystem. I don't think you can find out before writing it to the disk

Jochem Maas [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Karuna wrote:
  Hi. Is possible to calculate the filesize of image that will result from
  using imagejpeg without actually writing to disk?
 
  Thanks :)
 

 something like (although its not very efficient, I think):

 ob_start();
 image_jpeg($im); // $im is an GD resource
 $data = ob_get_contents();
 ob_end_clean;

 $byteCount = strlen($data);


smime.p7s
Description: S/MIME cryptographic signature


[PHP] [pgsql] connectivity problem

2004-07-18 Thread Ciprian Constantinescu
I have the following code

[CODE]
?php
$dbconn3 = pg_connect(host=somehost port=5432 dbname=adatabase
user=postgres);
?
[/CODE]

And when i run the script I get  Warning: pg_connect()
[function.pg-connect]: Unable to connect to PostgreSQL server: FATAL:
missing or erroneous pg_hba.conf file

I have searched for pg_hba.conf, but I don't have it. Where should it be and
what should it contain?

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



Re: [PHP] [pgsql] connectivity problem

2004-07-18 Thread Ciprian Constantinescu
The file has to be only on the remote server (the one running the database)
or on my server also?

Jurgen Stroo [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Well, then something went wrong with your postgres installation.
 This file should be somewhere in /etc (/etc/postgresql/pg_hba.conf for
 example). If this is your own system try to search for it, like this
 for example:

 find /etc -name pg_hba.conf

 If it is missing, you can create it yourself, but personally I think you
 should check WHY you don't have it, may be something more is missing.

 But to connect to a postgres database I think you need to read some more
 about postgres at least, so you know how it works and you can decide
 which way you want to connect to postgres (if you want to use the safe
ident authentication, for example)

 I can paste some default entries into this mail for you (version 7.4.3):

 # TYPE  DATABASEUSERIP-ADDRESSIP-MASK   METHOD
 # Database administrative login by UNIX sockets
 local   all postgresident
sameuser
 #
 # All other connections by UNIX sockets
 local   all all ident
sameuser
 #
 # All IPv4 connections from localhost
 hostall all 127.0.0.1 255.255.255.255   ident
sameuser
 #
 # All IPv6 localhost connections
 hostall all ::1
 ::::::
 :ident sameuser
 hostall all :::127.0.0.1/128ident
 sameus
 er
 #
 # reject all other connection attempts
 hostall all 0.0.0.0   0.0.0.0   reject


 You can have a free read about postgresql at commandprompt.com, there is
 a O'Reilly book to be found there, freely available through the Public
 license.

 Good luck!
 Ugh! Blurg.

 --
-
 When a man sits with a pretty girl for an hour, it seems like a minute.
 But let him sit on a hot stove for a minute and it's longer than any hour.
 That's relativity. [A. Einstein, 1938]

 http://jurgenstroo.com

 This one time, at band camp, Ciprian Constantinescu said:

  I have the following code
 
  [CODE]
  ?php
  $dbconn3 = pg_connect(host=somehost port=5432 dbname=adatabase
  user=postgres);
  ?
  [/CODE]
 
  And when i run the script I get  Warning: pg_connect()
  [function.pg-connect]: Unable to connect to PostgreSQL server: FATAL:
  missing or erroneous pg_hba.conf file
 
  I have searched for pg_hba.conf, but I don't have it. Where should it be
and
  what should it contain?
 
  --
  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



[PHP] Re: PHP and MySQL Installation on Apache for Windows

2004-07-16 Thread Ciprian Constantinescu
PHP doesn't detect anything. You need to have your mysql server running and
you try with mysql_connect() or mysql_pconnect() to see if you can connect
to the server

Sean Vasey [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Does anyone know how to get PHP to detect MySQL after it has been
installed and is running on an Apache 1.3.1 server for Windows? Any help
would be greatly appreciated.


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



[PHP] Re: Encrypting passwords from page to page -mcrypt question

2004-07-16 Thread Ciprian Constantinescu
Why don't you try POST instead of GET? This way the password will not be
visible in the URL.

Scott Taylor [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

 I would like to go from page to page, submitting the password through a
 GET query string.  Of course I wouldn't want to do this unencrypted.  So
 is mcrypt the best option?

 When submitting the data, would I also need to sumit the IV as well as
 the encrypted data?  Or am I completely off base with this one?  Should
 I also base64_encode() this data when passing it?

 Scott Taylor

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



[PHP] Re: [Q] PHP 101 -- How to check for session existence?

2004-07-15 Thread Ciprian Constantinescu
I think it would be better to use Apache facility of authentication through
Mysq
l
Michael T. Peterson [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 To protect certain web pages on my site, I am using the following code
 inserted at the very beginning (top) of the page:

 ?php
 include_once( 'init.php');
 if( isset( $HTTP_SESSION_VARS['session_id'] ) == FALSE ||
isset( $HTTP_SESSION_VARS['username'] ) == FALSE ){
header( 'Location: '.MEMBER_LOGIN_PAGE );
 }
 ?
 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
 html
 ... Dreamweaver template code  here...
 /html

 Is this a recommended way of doing this?

 Next, to initialize the session, a login page posts the username -
password
 information to a PHP script, check_login.php. The login info is checked
 against a database and, if all is kosher, a new session is created and the
 user is dispatched to the site's home page. Here's the relevant code:

 ?php
 include_once( 'init.php');
 ...
 $username = trim($HTTP_POST_VARS['username']);
 $password = trim($HTTP_POST_VARS['password']);

 ... if username and password check out, initialize a session...

 $HTTP_SESSION_VARS['username'] = $username;
 $HTTP_SESSION_VARS['session_id'] = crypt( $password );

 header( 'Location: '.SITE_HOME_PAGE );
 ...
 ?

 Does this make sense? Am I missing something? Any review, advice, etc.,
 would be much appreciated.

 Cheers,

 Michael

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



[PHP] Re: [mysql]Problem with PHP5

2004-07-15 Thread Ciprian Constantinescu
I have included the extension. Now I get Unable to load dynamic library
'C:\php\ext\php_mysql.dll' - The specified procedure could not be found

I have in Windows\System32 the file libmysql.dll. I have also put it in the
php\ext directory without any result.

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



[PHP] [mysql]Problem with PHP5

2004-07-14 Thread Ciprian Constantinescu
I have installed PHP5 and i get the following error from a script that was
working on PHP4
 Fatal error: Call to undefined function mysql_pconnect() in
D:\htdocs\cdalex\Connections\listacon.php on line 9 

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



Re: [PHP] php .vs cgi app..

2004-07-14 Thread Ciprian Constantinescu
As I know, if you run PHP as a module for Apache is faster than running
as CGI. Also Python scripts can be run as a module(faster) or as CGI. The
main disadvantage for Python as a module is that you don't get all the
facilities of CGI.

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