Re: [PHP-DB] Shopping cart application question

2010-04-03 Thread chris smith
 The  } else {  confuses PHP.  I am not sure what I should be doing.

You're missing at least one brace.

If the code you supplied is a copy of what you have, you're missing a
} for the end of the while loop and one for the end of the else
condition.

So it's treating } else { as part of the while construct (and while()
doesn't have anything like an else condition).

 if ( $_SESSION['user_reference']  0 ) {

snip

 $i=0;
 while ( $i  $cart_records_found ) {


} // end while


 } else {

 foreach ($_SESSION['order'] AS $key = $value ) {

 }


} // end else condition

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] Code optimization

2009-08-07 Thread chris smith
On Fri, Aug 7, 2009 at 5:10 PM, kranthikranthi...@gmail.com wrote:
 You're assuming that. It could be the queries being run are the costliest.

 It has got nothing to do with the cost of query. bare mysql_connect()
 is very costly.

I'm not arguing with that, I'm saying that the cost of the
mysql_connect could be nothing compared to doing a query on 50,000
rows and doing an order by random(). Of course I'm guessing about the
number of rows - since the OP has given no indication on any of this
it's all speculation until he spends some time figuring this stuff
out.

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] Php, Oracle on Mac, with strange behaviour

2009-03-16 Thread chris smith
On Mon, Mar 16, 2009 at 6:51 PM, Mark Halling-Brown
mhallingbr...@icr.ac.uk wrote:
 Thanks for your replies.
 In my desperation, I declared those environment variables in as many places
 as I could think of. The script (Although I know I shouldnt), php.ini and
 also the apache httpd.conf file:

 SetEnv ORACLE_HOME /opt/oracle/instanceclient
 SetEnv DYLD_LIBRARY_PATH /opt/oracle/instanceclient
 SetEnv LD_LIBRARY_PATH /opt/oracle/instanceclient
 SetEnv ORACLE_BASE /opt/oracle/instanceclient

 But given that it works on the command line, but not through the browser, I
 think that the environment variables must be set correctly.

Did you restart apache after doing this?

The env variables are set correctly for your user, but not apache's
(which is the problem).

Does the mac have an /etc/environment file? That should cover all users.

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] Need help in solving issues with configuration of php-5.2.8 with mysql-5.3.1

2009-03-05 Thread chris smith
 Do you mean i am using 32bit PHP libraries? If so could you please let me
 know where to download 64bit PHP libraries. I tried over the net but i
 couldn't get it.

No, I meant this:

ld: fatal: file /usr/local/mysql/lib/libmysqlclient.so: wrong ELF class:
ELFCLASS64

ld: fatal: file ext/libxml/.libs/libxml.o: wrong ELF class: ELFCLASS32

You can't (as far as I know) have some libraries that are 64 bit and
others that are 32.

It's either all 64, or all 32.

Your operating system should install one type or the other.

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] Need help in solving issues with configuration of php-5.2.8 with mysql-5.3.1

2009-03-03 Thread chris smith
 1. I ran php configuration as below.

 $./configure --with-apxs2=/usr/local/apache2/bin/apxs
 --with-mysql=/apps/mysql/mysql

 It went fine.

Are you sure?

 2. While running make, i got following relink error.

 ld: fatal: file /usr/local/mysql/lib/libmysqlclient.so: wrong ELF class:
 ELFCLASS64

Look at the path of the file it picked up - it found one in a
completely different location.

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] Re: session variable in select query showing picture from database

2009-02-12 Thread chris smith
On Fri, Feb 13, 2009 at 6:01 PM, Mika Jaaksi mika.jaa...@gmail.com wrote:
 With these:

 $band_id = $_SESSION['session_var'];
 echo band_id:  . $band_id;

 $query=SELECT * FROM pic_upload WHERE band_id=$band_id;
 echo query:  . $query;

 I get these:

 band_id: 11
 query: SELECT * FROM pic_upload WHERE band_id=11

 SQL injections: Are these what I should use?

 $db = new mysqli(localhost, user, pass, database);
 $stmt = $db - prepare(SELECT priv FROM testUsers WHERE username=? AND
 password=?);
 $stmt - bind_param(ss, $user, $pass);
 $stmt - execute();

Yes.

 $title = $_POST['title']; // user input from site

 $dirtystuff = array(\, \\, /, *, ', =, -, #, ;, , ,
 +, %); // define the cleaner

 // clean user input (if it finds any of the values above, it will replace it
 with whatever is in the quotes - in this example, it replaces the value with
 nothing)

No. There's so many ways to get around that (use htmlentity values for example).

If you're not using bind params use mysql_real_escape_string().

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] re:FOREIGN KEY{ERROR:1005/150}

2009-02-11 Thread chris smith
On Wed, Feb 11, 2009 at 7:36 PM, mrfroasty mrfroa...@gmail.com wrote:
 Hello,
 I have been browsing on mysql manual
 http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html
 with not much of success.I am trying to put 2 foreign keys(from
 different external table) on my table, but if I put the 2nd one it
 fails.here is my table

 CREATE TABLE pack_accomodation (
id int(16) NOT NULL auto_increment,
pack_id int(16) NOT NULL ,
hotel_id int(16) NOT NULL ,
PRIMARY KEY (id),
INDEX (pack_id),
FOREIGN KEY (pack_id) REFERENCES pack(items_no)
ON DELETE CASCADE
ON UPDATE CASCADE,
INDEX (hotel_id),
FOREIGN KEY (hotel_id) REFERENCES hotel(items_no)
 )ENGINE=INNODB;


 I can get rid of the 2nd foreign key with programming, but I think it
 should be possible to have them both...I just I cant figure out why it
 fails with this error:
 ERROR 1005 (HY000): Can't create table './tabasam/pack_accomodation.frm'
 (errno: 150) For description of the error
 http://dev.mysql.com/doc/refman/5.0/en/innodb-error-codes.html

Did you read the comments on that page? The top 2 give clues about
what else to check.

Is the 'hotel' table innodb as well?
What type is items_no in the hotel table? Is it int(16) ?

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] re:FOREIGN KEY{ERROR:1005/150}

2009-02-11 Thread chris smith
This worked for me:

CREATE TABLE hotel (
items_no int(16) NOT NULL auto_increment,
INDEX (items_no),
PRIMARY KEY (items_no)
)ENGINE=INNODB;

CREATE TABLE pack (
items_no int(16) NOT NULL auto_increment,
INDEX (items_no),
PRIMARY KEY (items_no)
)ENGINE=INNODB;

CREATE TABLE pack_accomodation (
   id int(16) NOT NULL auto_increment,
   pack_id int(16) NOT NULL ,
   hotel_id int(16) NOT NULL ,
   PRIMARY KEY (id),
   INDEX (pack_id),
   FOREIGN KEY (pack_id) REFERENCES pack(items_no)
   ON DELETE CASCADE
   ON UPDATE CASCADE,
   INDEX (hotel_id),
   FOREIGN KEY (hotel_id) REFERENCES hotel(items_no)
)ENGINE=INNODB;

But my tables are all empty. Maybe you have duplicate id's in one of
the tables? No idea what else to suggest apart from joining the mysql
list (http://lists.mysql.com/) to see if they have a suggestion.

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] IF Clause in Left Join

2008-12-29 Thread chris smith
 I really need some help.  I'm trying to use an IF statement in a multi-table
 left join.  I'm joining four tables (customers, contents, courses 
 locations).

IF can only be used in the select part or the where part, it can't be
used in the join part of a query.

 In the contents table I have two fields, product_id and value_id that relate
 to different values in different tables depending upon the value in the
 product_type field.  If product_type='course' then the product_id and
 value_id relate to the courses and locations table, but if
 product_type='other' then the product_id and value_id relate to the product
 and prices table.

 I have two options:

  1.  Match only the courses and locations where product_type='course' and
 NULL values if relating to the product and prices table.
  2.  Or change the query (and fields) if the product_type='other' to use the
 product and prices table.

You can union the results.

select ... where product_type='course'
union
select ... where product_type='other'

 I'm using Mysql 4.3.

Didn't know there was such a version ;)

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] Re: New Table Creation with PHP Variables

2008-12-29 Thread chris smith
On Mon, Dec 29, 2008 at 10:17 AM, Keith Spiller larent...@hosthive.com wrote:
 Another option that would work if I can figure out the correct syntax is to
 just NULL certain values if a given condition exists.  If
 product_type='course' then just use the o.product_id value for field4.  If
 product_type != 'course' then use NULL for field4.

 CREATE TABLE $table[name]
 SELECT field1, field2, field3,
 IF(o.product_type='course', o.product_id, NULL) AS field4,
 field5, field6, field7
 FROM table1 as a, table2 as o;

 Is this right?  Thank you for your help.

The idea is right, the format of the query isn't.

I use the case statement for this but it's up to you - work out the
right format for IF from the mysql manual.

(case when o.product_type='course' then o.product_id else null end
case) as field4

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] Copying Data From One Table To Another Table

2008-11-14 Thread chris smith
   $result3=mssql_query($query3) or die (The query has failed);

snip

 http://dev.mysql.com/doc/refman/5.0/en/insert-select.html

Ah - the OP isn't using mysql, it's ms-sql.


-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] Parent process lost MySQLi connection after child process gone.

2007-12-22 Thread chris smith
I'm not one of the people who create the code behind php. You will
need to discuss your idea with them.

http://www.php.net/mailing-lists.php

Join the internals list and discuss it there.

On Dec 22, 2007 7:06 AM, Dmitry Shukaylo [EMAIL PROTECTED] wrote:
 Hm..
 In that case be so kind to inform me that place where you try to send
 me. I have not found any exact information on offical php website on
 where it is necessary to ask similar questions...

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] Not solved - mysql data truncation does not cause an error to be thrown

2007-11-09 Thread chris smith
On Nov 9, 2007 8:34 PM, Andrew Blake [EMAIL PROTECTED] wrote:
 Hello

 It seems that the normal mysql_query doesn't error when an sql command
 forces the server to truncate the data. The mysql server executes the
 sql and provides a warning but it still executes the sql so allowing php
 to ignore the fact that there is a warning. You can run another sql
 command SHOW COUNT(*) WARNINGS after your insert command to check if
 there is a warning and roll back the changes - similar to the java mysql
 interface. I haven't used mysqli and perhaps this is addressed in that ?

I doubt it.

 Using sqlyog (3rd party mysql gui) to run the sql also provides no
 warning message but running it on the command line provides the 1 row
 affected, 1 warning message With data validation and check this data
 too large situation should never happen but surely php should pay
 attention to the warnings too ?

It's not a php problem. Mysql should throw proper errors instead of a 'warning'.

http://dev.mysql.com/doc/refman/4.1/en/blob.html
If you assign a value to a BLOB or TEXT column that exceeds the data
type's maximum length, the value is truncated to fit and a warning is
generated.

Same for char/varchar  binary fields
(http://dev.mysql.com/doc/refman/4.1/en/binary-varbinary.html and
http://dev.mysql.com/doc/refman/4.1/en/char.html).

You will get the same problem in other languages I'm sure (try it in
python, perl, ruby).

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] Re: MySQL Identifying worst-performing codes

2007-11-08 Thread chris smith
On Nov 9, 2007 1:18 AM, Colin Guthrie [EMAIL PROTECTED] wrote:
 Lasitha Alawatta wrote:
  There is  a tool call idera (SQL diagnostic manager). Basically it is
  a performance monitoring and diagnostics tool.
 
  It has a feature;
  Identifying of worst-performing codes –
 
  Identifies performance bottlenecks such as the worst-performing stored
  procedures, long-running queries, most frequently run queries, SQL
  Statements and SQL batches
 
  http://www.idera.com/Products/SQLdm/Features.aspx
 
 
  I'm looking for a same like tool for MySQL. Is anyone have any  ideas.


 I know this is OT for this list but.

 In addition to the slow query logging I mentioned before (which you
 seemed to appreciate :)), I've just stumbled across this:
 http://rackerhacker.com/mysqltuner/

http://jeremy.zawodny.com/mysql/mytop/ might come in handy too.

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] Adding a PDO driver to the standard release

2007-10-12 Thread chris smith
On 10/12/07, Claude Masseron [EMAIL PROTECTED] wrote:
 Hi,

 Not sure if I'm asking in the right place. One of our engineers
 wrote a PDO driver for the IBM U2 databases. Info can be found at:

 http://www.ibm.com/developerworks/db2/library/techarticle/dm-0612xia/
 http://www.ibm.com/developerworks/db2/library/techarticle/dm-0701xia/

 and there was a article at PHP developer about this:

 http://www.phpdeveloper.org/news/7049

 Just wondering what steps would be required to get this into the
 standard PHP release, so that when one installs the PDO capabilities that
 this PDO driver comes shipped.

Join the -internals list and put your suggestion forward.

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] showing warnings

2007-09-11 Thread chris smith
On 9/11/07, Niel Archer [EMAIL PROTECTED] wrote:
 
  mysql explain SELECT Tune_Name,Tune_Type FROM Mobile_Tunes;
  +--+--+---+--+-+--+--+---+
  | table| type | possible_keys | key  | key_len | ref  | rows |
   Extra |
  +--+--+---+--+-+--+--+---+
  | Mobile_Tunes | ALL  | NULL  | NULL |NULL | NULL |4 |
 |
  +--+--+---+--+-+--+--+---+
  1 row in set (0.00 sec)
mysql

 This shows you have NO indexes on the table.  Assuming that 'Tune_Name'
 contains unique entries for each row, I'd suggest you do the following
 as a minimum:

 ALTER TABLE Mobile_Tunes ADD PRIMARY KEY (Tune_Name);

How's that going to help if he's getting all records from the table?

Also there's no way a database is going to use an index if there are
only 4 rows in the table.

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] CURL and process not finishing

2007-01-05 Thread chris smith

On 1/5/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

I am using CURL to check pages outside my site on the internet for some
text, then I email someone on my database who supposedly looks after the
site.  The script creates a process that does not terminate.  It is running
on a scheduled cronjob so eventually my site has over the maximum of 20
processes running and it goes offline.

It may be that some of the pages I check are hard to get a response from, as
CURL tries to return the target URL.  I have removed any emailing that it
does and still get the problem.  Is there any way to check that a process is
not terminating after a reasonable time?


http://www.php.net/manual/en/function.set-time-limit.php

Get the php script to terminate after a certain amount of time.

You could also use this curl variable: CURLOPT_CONNECTTIMEOUT

in case it's a connection issue... see http://www.php.net/curl

I'd probably also try setting CURLOPT_VERBOSE to see if that reveals
the actual problem rather than guessing.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] Paginatating PHP

2006-12-21 Thread chris smith

On 12/21/06, Ondrej Kohout [EMAIL PROTECTED] wrote:

It's better to use SQL_CALC_FOUND_ROWS and information function
FOUND_ROWS().


Has nothing to do with the problem.

its simply showing the else condition which does not have NEXT
or PREVIOUS hyperlinked.

Try OKi98's suggestion, it will most likely fix the problem for you.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: Re: Fwd: Re: [PHP-DB] search error

2006-11-24 Thread chris smith

--
$query1 = SELECT distinct link_id, url, title, description,  $fulltxt, size
FROM .$mysql_table_prefix.links WHERE link_id in ($inlist);
  $result = mysql_query($query1);
  echo mysql_error();


and what does $fulltxt contain when you get the error?

I suspect you have a problem with the quotes in that string.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] LIMIT

2006-07-01 Thread chris smith

On 7/1/06, Dwight Altman [EMAIL PROTECTED] wrote:

Thanks, but that's an additional query.

I was wondering if there may be a PHP function that can operate on the
$result or perhaps $link of the single query that uses a LIMIT clause and
have the information [count(*) had there not been a LIMIT clause
count_no_limit(*) maybe? even though there was a LIMIT clause].  Something
like mysql_info.


Can the database do it like that? If the answer is no then there's no
way php can do it.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] Cant connect to postgresql 7.4 on FreeBSD

2006-06-10 Thread chris smith

On 6/9/06, Arie Nugraha [EMAIL PROTECTED] wrote:

Hi list,

yesterday i compile postgresql 7.4 in my FreeBSD 5.4 box.
I manage to run the server smoothly without any problem.
But then i try to connect with my php script with pg_connect function, and
it returns an error like this :

*cant make link. to many connection open*


You have too many connections to your database.

Either increase the number of connections your database accepts or
work out where all the connections are coming from and try to cut that
down.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] SSL implementation

2006-06-03 Thread chris smith

On 6/3/06, Blanton, Bob [EMAIL PROTECTED] wrote:

Hi,
  I'm new to web programming and Apache  PHP so this may seem like a
dumb question.  Is there a preferred way to implement SSL in a website
or web application?  Is it handled using PHP or Apache?  Or both?  I see
there is the Apache Open SSL server and the mod_ssl.  Seems there are
many options to choose from.


The web server handles the request, so the web server (apache in this
case) needs to support ssl. The web application has to handle it
running in secure mode - so hardcoding http:// type urls won't work.

There are two options available:
mod_ssl - http://www.modssl.org/
and apache-ssl - http://www.apache-ssl.org/

(They both utilize openssl).

Pro's / cons? No idea - you'll need to do some research and probably
ask on the apache mailing lists.
--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] PDF BLOB to Email

2006-05-11 Thread chris smith

On 5/11/06, Adrian Bruce [EMAIL PROTECTED] wrote:

Hi

I have pdf's stored as a blob in a MySQL database, how can i set a
script (PHP obviously!) to email these blobs as pdf files.  The only way
i can think of at the moment is to write them to disk and then attach
them to the mail before sending it.  This doesn't seem that efficient
but perhaps it is the only way??


You'll need to get the pdf in memory then use chunk_split
(http://au.php.net/chunk_split) to split it up..

Even though phpmailer reads them from the filesystem, it should give
you an idea on how to attach docs: http://phpmailer.sourceforge.net

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] auto_increment

2006-05-01 Thread chris smith

On 5/1/06, Ron Piggott (PHP) [EMAIL PROTECTED] wrote:

I am using mySQL


.. a google search for mysql reset auto_increment reveals the answer!

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] Sheduled task for Php-MySql script

2006-04-25 Thread chris smith
 I have some php scripts that i have to run automatically at 5.00am (on 
 Windows platform). I am using MySql.
 I've tried using Scheduled Task and Cron, and i converted the extension files 
 to .bat format. But always error on functions 
 mysql_connect,mysql_query,and other DBS functions. I don't know how to 
 Scheduled Task or Cron recognize those functions.

It has nothing to do with it running through cron. Sounds like php
doesn't support mysql functions. Check a phpinfo page.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] MD5, MySQL, and salts

2006-04-18 Thread chris smith
On 4/18/06, Giff Hammar [EMAIL PROTECTED] wrote:
 For an example, look at how UNIX/Linux stores regular login passwords. In
 short, the salt is the first two characters in the password. When comparing
 passwords, you take the salt and the user supplied password, encrypt, then
 compare the two encrypted strings. If they match, the recently supplied
 password matches the original. AFAIK, that is the only way to verify
 passwords encrypted with a one-way algorithm.

I badly worded my response, but yes you're right.

Anyway I found the article I was thinking of:

http://phpsec.org/articles/2005/password-hashing.html

(which ironically suggests the opposite of what I said - use a random salt :P).

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] MD5, MySQL, and salts

2006-04-17 Thread chris smith
On 4/18/06, Sean Mumford [EMAIL PROTECTED] wrote:
 Hi Guys,
 I'm working on securing user passwords in a MySQL 4 database with a PHP5
 frontend. I remember being told in one of my classes (I'm currently a
 college junior) that the best way would be to hash a salt and the password
 together and then store the hash in the database instead of the plain MD5
 hash. My question is, what is a good method for the server and the database
 to agree on a salt value to use? I know i could use a predefined variable,
 but I was wondering if something dynamic might be better (timestamp, current
 date, something like that). Any ideas? Thanks in advance!

If it's a dynamic salt, how are you going to access it when you have
to compare ?

There was an article either on phpsec.org or shiflett.org which talks
about this.. can't find the link right now :(

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] Insert select Blob field from MySQL

2006-04-15 Thread chris smith
On 4/15/06, Robert [EMAIL PROTECTED] wrote:
 Does anyone have an example of how to insert and select a blob field in a
 MySQL 4.1 database ?

Search google for php mysql blob it will give you tons of results
(link is too long to post).

First 3 results are articles on exactly what you want.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] Question regarding the scope of pg_prepare

2006-04-14 Thread chris smith
On 4/14/06, Will Chapman [EMAIL PROTECTED] wrote:
 I have a few different pg_prepare statements in my PHP script.  I was
 wondering what scope they lie in.  Im assuming they are not saved in the
 PSQL database, so it is just for the script?  They are inside of
 functions... does it only last until the function exists?  I just dont
 want to keep on calling it if I don't have to.  Or do I need to call it
 each time the function is called.

They are not stored in the database. They are only used to build the
queries to send to the database.

Reading the example(s) on the php page (http://www.php.net/pg_prepare)
you can use them anywhere, they are in the global scope as long as you
give them different names.

stmtname
The name to give the prepared statement. Must be unique
per-connection. If  is specified, then an unnamed statement is
created, overwriting any previously defined unnamed statement.

I guess the easiest way is to create a simple script :) Prepare some
statements before and inside a function..

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] mssql_select_db(): Unable to select database:

2006-04-08 Thread chris smith
On 4/9/06, blackwater dev [EMAIL PROTECTED] wrote:
 Hello all,

 I set up freetds on one of my servers and everything worked fine.  I just
 set it up on another server (this one with the latest php) and now the same
 code seems to connect but can't select the db mssql_select_db(): Unable to
 select database:.  How can I figure out what's wrong?  The mssql db is
 hosted remotely so both servers should be able to hit it fine and are using
 the exact same source code.  The differences are they are running different
 versions of php and possibly freetds.

What error do you get?

Hmm looks like there's no mssql_error()...

turn up error reporting:
error_reporting(E_ALL);

and put display errors on:
ini_set('display_errors', true);

see if that gives you any ideas.
--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] Messenger Question!

2006-04-05 Thread chris smith
On 4/5/06, Julien Bonastre [EMAIL PROTECTED] wrote:
 http://www.tech-recipes.com/internet_tips1157.html


 Should help you out I hope


 Wasn't awfully difficult to source either

 Method:

 Step one: Enter google.com.au in internet browsing client of choice
 Step two: use msn messenger add contact html hyperlink code? as search
 query

 Was first result, could have even gone: I'm Feeling Lucky on that one
 ;-)


Missed that part...

That won't tell you what a person has installed on their computer, but
I guess you could put both msn  yahoo links on your site and the
person can click the right one...

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] PDO Exception Handling Question

2006-04-02 Thread chris smith
On 4/2/06, Rodney Topor [EMAIL PROTECTED] wrote:
 I've just started using PDO with PHP 5.1 and MySQL 5.0.  Everything
 seems to work fine, except for one issue with the following example
 from the PHP manual.

 ?php
 try {
 $dbh = new PDO('mysql:host=localhost;dbname=test', $user, $pass);
 foreach ($dbh-query('SELECT * from FOO') as $row) {
   print_r($row);
 }
 $dbh = null;
 } catch (PDOException $e) {
 print Error!:  . $e-getMessage() . br/;
 die();
 }
 ?

 If an error occurs in creating the new PDO instance, or in issuing the
 PDO query, then a PDOException should be raised.  But nothing is ever
 printed.  I've tried running this script, forcing an exception, both
 from the command line and from the server.  But nothing is ever
 printed.  What do I have to do to see the printed string in the
 catch-block?

Do you mean it doesn't print anything or it doesn't get into the catch block?

ie it prints Error!:br/ or it doesn't get into that section at all?

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] PHP + OCI en Debian

2006-03-23 Thread chris smith
On 3/24/06, SJL [EMAIL PROTECTED] wrote:
 It´s true. I find the sources of oci8.so.

 But in my first try to compile it, It failed because the it have calls
 to php.h and info.h, so I try to move the sources files to the path
 where I have this files (taking care with the relative path in the
 source code), but it fail again with more than 100 compile errors...

 Somebody in this list have the oci8.so file ? (if it was compiled
 with Debian Distro in a 32 bits system is better, if not I would try
 it).

Make sure you have the php-dev or php-devel package installed. Those
files should be in that one.

Us compiling that file for you is no good, it might be for a different
file, different architecture and various other differences (ie it
probably won't work).

 On 3/22/06, Chris [EMAIL PROTECTED] wrote:
  SJL wrote:
   Someone install any time the Oracle Client to use the OCI interface to
   connect a Oracle DB?
  
   I'm working in Debian. I installed the Client of Oracle from a package
   from the official page... but I don´t know how to configure php.ini to
   make the OCI API works..
 
  Now that you've installed Oracle Instant Client you need to get php to
  recognise it's there (so it can create the oci8.so file).
 
  I'm not sure if there is a package to do this or if you'll have to
  compile php from source with the extra option:
 
  --with-oci8
 
  I suspect you'll have to compile php from source, you won't be able to
  use a package to do this, but I could be wrong.
 
  --
  Postgresql  php tutorials
  http://www.designmagick.com/
 

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




--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] Mysql/PHP5 connection error

2006-03-14 Thread chris smith
On 3/14/06, Eustace [EMAIL PROTECTED] wrote:
 Hello,

 I hope somebody can assist. I am using dreamweaver 8, Mysql, PHP5 for a
 simple we application. After using the dreamweaver wizard to make a
 connection, then created a recordset. Trouble starts when I use
 require_once(connections/ConnSAFDEM) to link to the database connection
 file. I get the error below. If I hand code the connection and recordsets
 things work fine as long as I am not using the require, require_once,
 include functions. I installed PHP recently on IIS (manual installation). I
 am wondering if I am mssing something which is stopping those functions to
 work?


 Warning: require_once(Connections/connSAFDEM.php) [
 http://localhost/safdem_web/Admin/function.require-once
 function.require-once]: failed to open stream: No such file or directory in
 c:\Inetpub\wwwroot\safdem_web\Admin\add_vacancy.php on line 1

Did you read the error message?

No such file or directory

That means the file Connections/connSAFDEM.php doesn't exist.

It could be:
- wrong path
- wrong case
- file really doesn't exist.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] Mysql/PHP5 connection error

2006-03-14 Thread chris smith
On 3/14/06, Eustace [EMAIL PROTECTED] wrote:
 Thanks. That's the mind boggling part, the file does exist, correct case,
 correct path! Dreamweaver does ship the files automatically to the testing
 server..and I checked to make sure!

Is this the full path to the file?

c:\Inetpub\wwwroot\safdem_web\Admin\Connections\connSAFDEM.php

because that's what the server is looking for.

 -Original Message-
 From: chris smith [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, March 14, 2006 12:04 PM
 To: [EMAIL PROTECTED]
 Cc: php-db@lists.php.net
 Subject: Re: [PHP-DB] Mysql/PHP5 connection error

 On 3/14/06, Eustace [EMAIL PROTECTED] wrote:
  Hello,
 
  I hope somebody can assist. I am using dreamweaver 8, Mysql, PHP5 for
  a simple we application. After using the dreamweaver wizard to make a
  connection, then created a recordset. Trouble starts when I use
  require_once(connections/ConnSAFDEM) to link to the database
  connection file. I get the error below. If I hand code the connection
  and recordsets things work fine as long as I am not using the require,
  require_once, include functions. I installed PHP recently on IIS
  (manual installation). I am wondering if I am mssing something which
  is stopping those functions to work?
 
 
  Warning: require_once(Connections/connSAFDEM.php) [
  http://localhost/safdem_web/Admin/function.require-once
  function.require-once]: failed to open stream: No such file or
  directory in c:\Inetpub\wwwroot\safdem_web\Admin\add_vacancy.php on
  line 1

 Did you read the error message?

 No such file or directory

 That means the file Connections/connSAFDEM.php doesn't exist.

 It could be:
 - wrong path
 - wrong case
 - file really doesn't exist.

 --
 Postgresql  php tutorials
 http://www.designmagick.com/



 --
 No virus found in this incoming message.
 Checked by AVG Free Edition.
 Version: 7.1.375 / Virus Database: 268.2.1/279 - Release Date: 3/10/2006

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




--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] FW: Excel to CSV

2006-03-10 Thread chris smith
 Have you any script/example how to Save As Excel file to CSV using PHP?

You don't need to repost your question if you don't get an immediate response.

Going file, save as is client side. PHP can't interact with excel
like that. Create a VB macro or something to do it.

--
Postgresql  php tutorials
http://www.designmagick.com/

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