Re: [PHP-DB] Slow access Apache + PHP + MySQL

2005-03-29 Thread Jennifer Goodie
 -- Original message --
From: Andre Matos [EMAIL PROTECTED]

 Now, we are using MySQL version 4.1.9 with Apache 2.0.52 and PHP 4.3.10, all
 compiled and running on a Linux Fedora X86_64.

What MPM is Apache using?  The threaded ones are not recommended.

I start to look to the database. I monitored the MySQL using MySQL
 Administrator, but I couldn't identify any problem. It looks ok, but not
 completely sure if really is.
Run the queries on the new maching with the mysql cli and see how long they 
take to run.  Run an explain on them to make sure your indexes were built.

 The system administrator told me that could be the PHP session, but again,
 he also was not complete sure about this.
I have no idea what this even means. 

 Does anyone had this kind of problem or has any suggestion or direction to
 help me to identify and solve this issue?
Is PHP configured the same as it was on the old machine?  Have you changed INI 
options.

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



Re: [PHP-DB] Using an array(-ish) in SQL queries

2004-11-02 Thread Jennifer Goodie
 -- Original message --
From: -{ Rene Brehmer }- [EMAIL PROTECTED]
 Task at hand: deleting or selecting (same difference) several numbers of 
 records using only 1 query.
 
 My first version simply looped through all the ticked off IDs and ran a 
 single query for each delete routine. I've still not suceeded in getting 
 the delete queries to work on multiple tables at once, despite the column 
 names being the same. But besides this:

Multi-table deletes are new to mySQL 4.0, so if you are running a 3.x release they 
won't work. 
http://dev.mysql.com/doc/mysql/en/DELETE.html 

 
 My current version generates, for multi-select cases, queries like this:
 
 DELETE FROM the_table WHERE `ID`='1' OR ID`='2' OR `ID`='3' OR `ID`='4' OR 
 `ID`='5' OR `ID`='6'
 
 or similar with the SELECT statement.
[snip lots of stuff]
 DELETE FROM the_table WHERE `ID` ISIN(1,2,3,4,5,6)

use IN  http://dev.mysql.com/doc/mysql/en/Comparison_Operators.html#IDX1268

If you know all the values in the array are escaped and safe you can just use 
implode() to make the list for IN

$string = implode(',',$array);
$sql = SELECT FROM $table WHERE col_name IN('$string');
Notice I added single quotes around the string, that is because they will be missing 
since implode only sticks the string between array elements.

However, you'd need a join that makes sense for a multi-table delete.  I don't know if 
it will work with a union, I have never tried, maybe somone else will chime in.

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



Re: [PHP-DB] parse error in php backend sqlite

2004-10-20 Thread Jennifer Goodie
- Original message from Aravalli Sai : -- 
 but when i run this code on browser it is giving an 
 error ... Parse error: parse error in 
 /home/saravall/.HTML/inv.php on line 63 
 

It would be helpful if you said what the parse error is and which line is 63.
 
 if(isset($_POST['submit'])) { 
 
 if (!empty($_post['tagno'])  !empty 

Why are you switching between $_POST and $_post?  The superglobal array is $_POST.

 i would appreciate if you can help me in correcting 
 this error.. 
 thanks in advance.. 
 sai 

Your curly braces, {}, don't match up.  You aren't closing them all.  Indenting your 
code will help you see this and fix the problem.

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



Re: [PHP-DB] rand()

2004-09-29 Thread Jennifer Goodie
-- Original message from blackwater dev : -- 
 select * from clients order by RAND() 
 
 THe query runs fine on my local server but when I run it on my hosts 
 server, it works ok if there is only one record in the db but then 
 there is more than one...I get this error: 
 
 #1 - Can't create/write to file '/var/tmp/#sqlbe_1d99_0.MYI' (Errcode: 2) 
 
 What's going on? 

perror 2 returns Error code   2:  No such file or directory

Does /var/tmp exist on the server?

If you run explain on your query in both cases (with one record and with more than one 
record) you will see that when there is more than one record it is probably using 
temporary tables and file sort, but is not when there's only one record.

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



Re: [PHP-DB] pass by reference

2003-10-09 Thread Jennifer Goodie
 How do you pass by reference? I tried
 $var = myFunction($var1, $var2);
 but it gave me a warning saying that pass by reference is depreciated


Call time pass by refrence is depreciated you should read the manual to see
how it should be done.
http://www.php.net/manual/en/language.references.pass.php

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



Re: [PHP-DB] Getting ODBC openlink 37000 in odbc_do($conn,$sql) butodbc_tables($conn) works? Help!

2003-10-02 Thread Jennifer Goodie
 But when I try
 
 $sql=select * form tblJobStatus;
 $results = odbc_do($conn,$sql) or die(p captured .odbc_errormsg());
 
 I get 
 
 Warning :  odbc_do(): SQL error: [OpenLink][ODBC][Driver]Syntax error or
 access, SQL state 37000 in SQLExecDirect in
 /Library/WebServer/Documents/tests/odbc.php on line 6

That is because you have a syntax error.  Try SELECT FROM not SELECT FORM.

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



RE: [PHP-DB] mysql field not resolving comaparison condition for zip code locator

2003-09-23 Thread Jennifer Goodie

 I am having trouble implementing a zip code locator program. All of the
 functions work correctly but the $sql variable.
 The problem occurs by using the latitude argument as a
 comparison. The first
 latitude argument works but when the second
 latitude argument is added the query returns no data. Here is an
 example of
 the $sql variable being used.

 $sql=SELECT City FROM ZIPCodes WHERE
Latitude = 122.02671343318
   AND Latitude = 121.96888656682
AND Longitude = 37.617091284671
AND Longitude = 37.508048715329;


I think Latitude only goes to 90, so they are all under 122 and none are
above 121.  Also, you aren't going to get something that is greater than
37.6 but less than 37.5

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



RE: [PHP-DB] Passing variables between html forms and updating sql table

2003-09-17 Thread Jennifer Goodie
 I need a secure way of updating mysql on the website, phpadmin is not
 secure enough
[snip]
   $MySQLLink = mysql_pconnect (davecp4, root, )
or die(Could not attach to database. Please try later or contact
 [EMAIL PROTECTED]);


Please tell me you just took the password out of that for posting purposes
and root isn't really set up without a password.  If root really doesn't
need a password, I'd say phpMyadmin is the least of your security concerns.

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



RE: [PHP-DB] MYSQL Table Dump

2003-09-10 Thread Jennifer Goodie
 Is there any way *from the command line* to get a dump of a mysql
 table and
 have it saved to a local file, instead of standard output

from running mysqldump --help

 -r, --result-file=... Direct output to a given file. This option should be
used in MSDOS, because it prevents new line '\n'
from being converted to '\n\r' (newline + carriage
return).

So... mysqldump -ulogin -p -rfile.sql database [tables]

Or on a 'nix box just use  to pipe it to a file.
mysqldump -ulogin -p database [tables]  file.sql

Assuming 'login' is your username and you want to be prompted for a
password.

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



RE: [PHP-DB] Simple Referrer

2003-08-27 Thread Jennifer Goodie
 Hi. This seems like it should be simple. I've had no problem doing this
 in other languages, but can find no reference to this function in the
 PHP manual.

 How can I get PHP to return the referring URL?


Depends on your PHP version and webserver install.  In most cases
$_SERVER['HTTP_REFERER'] works.
http://www.php.net/manual/en/reserved.variables.php#reserved.variables.serve
r

This isn't really database related.

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



RE: [PHP-DB] Ifs, ands, or buts

2003-08-27 Thread Jennifer Goodie
 Lets say I wanted to check a bunch of fields to make sure they weren't
 empty. I can check one field by saying:

 if ($field1) {
 echo Field 1 is not empty;
 }

I'd use empty() since certain values would cause your if to evalute to false
http://www.php.net/manual/en/function.empty.php
if(!empty($field1){

 Can't I just say:

 if ($field1 and $field2 and $field3 and $field4) {
 echo All four fields are field in;
 }

Have you tried it?
Once again, I'd use empty()
if(!empty($field1)  !empty($field2) !empty($field3) !empty($field4)){
I like '', rather than 'and', but that's just me.

 if ($field1 or $field2 or $field3 or $field4) {
 echo At least one of the four fields is filled in;
 }
See above but replace '' with '||' or 'or'

 Maybe its not the word and and or but maybe its  or ||
 respectively? That's what I've seen in other languages that let you do
 this. I'm sure there must be a way to do this with PHP, too.

http://www.php.net/manual/en/language.operators.logical.php

Tha manual is your friend, it can answer a lot of your questions.  Once
again, I don't see what this has to do with databases.

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



RE: [PHP-DB] MySQL query failing on apostrophe in data

2003-08-27 Thread Jennifer Goodie
 How do I avoid the problem in the subject hereto?  SELECT query uses
 variable in the WHERE clause.  Fails on the following query:

 SELECT Tbl.fld FROM Tbl WHERE Tbl.fld2='11301201 0603A HKA 3902 #3708_JD's
 AE Exp' AND ...

Escape it.
 SELECT Tbl.fld FROM Tbl WHERE Tbl.fld2='11301201 0603A HKA 3902 #3708_JD\'s
AE Exp' AND ...

Use mysql_escape_string() or addslashes()
http://www.php.net/manual/en/function.mysql-escape-string.php
http://www.php.net/manual/en/function.addslashes.php

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



RE: [PHP-DB] How to insert date into date field

2003-08-26 Thread Jennifer Goodie
 I have a date that is formatted in the following way
 day(00-31)/Mon(Jan-Dec)/year(2003):hour(00-23):minute(00-59):sec(00-59)

 I want to load this into mysql table (date column)

 In oracle I can just use the to_date function but all I find about MYSQL
 seems to want the date in a specific format beforehand.

If you are using PHP to insert it you can just format it before sticking it
in.  It gets a little more complicated if you are loading it in via LOAD
DATA INFILE or something like that.  What exactly are you attempting to do?

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



RE: [PHP-DB] file upload security issue

2003-08-14 Thread Jennifer Goodie
 I try to learn file uploading in PHP.  I've successfully uploaded a file
 onto my server.  I use move_uploaded_file(tmp_dir/tmp_filename,
 destination_dir/filename) to move the temp file.   The thing is that I
 have to do a chmod 777 destination_dir in order to move the file.  Is
 this bad for security?

Yes, it is.

chown the directory to the user or group that mysql runs under, then it only
needs to be owner or group writable


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



RE: [PHP-DB] Date format problem

2003-08-14 Thread Jennifer Goodie
 
 I have a field in my mysql db wich is a timestamp with the format
 
 mmddhhmmss
 
 and I would like to display it like:
 
 dd/mm/
 
http://www.mysql.com/doc/en/Date_and_time_functions.html#IDX1333

SELECT DATE_FORMAT(timestamp_col_name, '%d/%m/%Y') FROM table_name

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



RE: [PHP-DB] dual-processors and php

2003-08-05 Thread Jennifer Goodie
 My php scripts that work well on single-processor machines will not work
 when I put them on a dual-processor server running RedHat 8.0. Is this a
 matter of settings in php or in the mysql database that provides the
 data? I can connect to the database through the php.include scripts, but
 then I get the message no database in use from mysql_error() when it
 comes to making queries. I've tried these scripts on two different dual-
 processor machines and get the same result. I've also tried various
 combinations of the host name (localhost, 127.0.0.1, real IP
 address).
 Before upgrading to RedHat 8.0 on these machines, the scripts did work,
 however.

Did you change any of the database settings?  Are you getting an error after
your call to mysql_select_db()?


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



RE: [PHP-DB] Getting a date in number form

2003-07-15 Thread Jennifer Goodie
 I need to get the month in a number format; July =7.  Right now
 it is returning the string: July.

 This is what I am doing.

 $today = getdate();
 $month = $today['month'];
 $mday = $today['mday'];
 $year = $today['year'];

 What can I do to get the number instead of the word?

http://www.php.net/manual/en/function.getdate.php says to use mon as the
array index rather than month


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



RE: [PHP-DB] generating sequence without AUTO_INCREMENT

2003-06-26 Thread Jennifer Goodie
You could you do MAX(issue_number)+1 where YEAR(date) = Year(NOW()) to get
next issue number for the current year, but if you had 2 people entering
issues at the same time, it wouldn't work so well.  Just trying to give you
a starting point because it seems like you haven't really gotten an answer
yet.

 -Original Message-
 From: anders thoresson [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, June 25, 2003 11:43 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] generating sequence without AUTO_INCREMENT


 Hi,
  I'm working on a web based article planning system for a news
 paper, based
 on PHP and MySQL. One vital table in the setup will contain release date
 and number for each issue. It's a simple table with just three columns:
  id, which is the primary key and AUTO_INCREMENT
  date, which is the release date for each issue
  issue_number
  I need help with a solution to automatically create the
 issue_number. The
 conditions is as follow:
  1. The paper is published every Monday to Friday, except for national
 holidays, so issue_number isn't the same as the day number
  2. The first issue each year should be number 1, and then the
 rest should
 follow in sequence
  The first condition is taken care of manually, where one of the editors
 will input a start date and an end date between which the
 newspaper will be
 released Mondays to Fridays. That way I'll handle the national holidays,
 for each year the editors have to enter a couple of date sequences to
 fence out the holidays.
  But keeping track of each and every issue_number manually isn't
 practical.
 I've looked at the MySQL manual, but all I find is LAST_INSERT_ID(). But
 from what I've understood, that function is only useful when it's
 the same
 value that is being updated, and this isn't the case in my problem.
  So I guess I'll have to write my own function. The solution I think of
 right now is adding new issues in two steps: First adding the
 date for the
 new issue to the table, then checking the issue_number for the
 date before,
 and then adding the issue_number next in turn to the new issue,
 or, if the
 year differs start over from 1 again.
  Is there a smarter way of doing this?


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



RE: [PHP-DB] problem witd freetds

2003-06-17 Thread Jennifer Goodie
 Parse error: parse error in /usr/local/www/data.default/test.php ]

The parser is complaining about this line
 $numero= mssql_connect(130.102.1.88 sa ,   ); 

Try putting a comma between your arguments
$numero= mssql_connect(130.102.1.88, sa,   ); 

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



RE: [PHP-DB] MD5 hash problem

2003-05-31 Thread Jennifer Goodie
 For every password that I store in the database I have found it is the
 same string of characters no matter what the original $password is.

That is because you have single quotes around your variable so it is not
being expanded, so everytime it is the MD5 of the same thing, the string
$password.

   $pass = MD5('$password');

Change it to MD5($password); or MD5($password);


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



RE: [PHP-DB] connection pooling

2003-05-29 Thread Jennifer Goodie
Did you read the manual page?
http://us4.php.net/manual/en/function.mysql-pconnect.php

[quote]First, when connecting, the function would first try to find a
(persistent) link that's already open with the same host, username and
password. If one is found, an identifier for it will be returned instead of
opening a new connection. [/quote]

In practice it might not act like that though, it depends on your server set
up.

 -Original Message-
 From: Mengü Gülmen [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, May 28, 2003 2:21 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] connection pooling


 Hi there,
 I've been looking all over the net for connection pooling information
 about php and mysql but I didn't come across anything.

 Do you know anything like the connection pooling system of asp?
 In php, there is the pconnect, persistent connection which, as far as
 I know does nothing but open a connection and execute all the commands
 via that connection.

 What I want is, something that does this: If there is no existing
 connection or the existing connection is in use, open another
 persistent connection. if there is an open connection and it's idle,
 use that one

 If there is nothing that can do this, I'll start to try to write it on
 my own. And of course, any help would be appreciated :)


 --
 Finest,
 Mengü,
 mailto:[EMAIL PROTECTED]


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



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



RE: [PHP-DB] Permission Denied; Upload

2003-04-04 Thread Jennifer Goodie
Good job posting your username, password and server IP.  I just logged into
your database.  Change your password immediately.

 -Original Message-
 From: John [mailto:[EMAIL PROTECTED]
 Sent: Friday, April 04, 2003 10:12 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Permission Denied; Upload


 Thanking in advance,

 Hi all- very new to php, and at the risk of being spoon fed
 here, I beg for your patience in advance.  I am trying to have an
 entry page for user input/ pic upload into MySQL/win2k
 (www.sammiesmodels.com/entry.php ).

 I get this error during test of the above page:  Warning: Unable
 to open '' for reading: Permission denied in
 C:\SammiWWW\entry.php on line 27 Couldn't copy the file!

 The upload folder, Temp sits in the root www dir, and the user
 has all permissions granted (or do i?) in the DB.  Below is the
 syntax to the Entry page:

 ***
 html
 head
 titlePortfolio Entry /title
 meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
 /head

 body bgcolor=#FFEBEB
 ?php
 if ($submit) {

   $db=mysql_connect(66.220.69.20,admin,snoddy);
   mysql_select_db(sammies models,$db);
   $sql=INSERT INTO models (first, last, age, email, location,
 eye, hair, experience, aspirations, mtype, picname1, picname2,
 picname3, picname4, picname5, picname6, picname7, picname8)
   VALUES
 ('$first','$last','$age','$email','$location','$eye','$hair','$exp
 erience','$aspirations','$mtype','$picname1','$picname2','$picname
 3','$picname4','$picname5','$picname6','$picname7','$picname8');
   mysql_query($sql) or die(mysql_error());

 // if $_FILES['img1'] isn't empty, try to copy the file
 if ($_FILES['picname1'] != ) {

  // copy the file to a directory or
  //die and print an error message

  // NOTE! if you're on a Windows machine,
  // use Windows pathnames, like so:
  // copy($_FILES[picname1][$first],
 C:\\sammiwww\\directory\\path\\.$_POST[img1_name]);

  copy($_FILES['picname1']['$first . temp'],
 C:\\sammiwww\\upload\\.$_FILES['picname1']['$first'])
   or die(Couldn't copy the file!);

 } else {

  // if $_FILES['picname1'] was empty, die and let us know why
  die(No input file specified);

 }

 ?


 echo First: $firstbr\n;
 echo Last: $lastbr\n;
 echo Age: $agebr\n;
 echo Email: $emailbr\n;
 echo Location: $locationbr\n;
  echo Eye color: $eyebr\n;
  echo Hair color: $hairbr\n;
  echo Experience: $experiencebr\n;
  echo Aspirations: $aspirationsbr\n;
  echo Media Type: $mtypebr\n;
  echo Photo 1: $picname1br\n;
  echo img src=c:/sammiwww/pic/$picname1br\n;
  echo Photo 2: $picname2br\n;
  echo img src=c:/sammiwww/pic/$picname2br\n;
 echo Photo 3: $picname3br\n;
  echo img src=c:/sammiwww/pic/$picname3br\n;
 echo Photo 4: $picname4br\n;
  echo img src=c:/sammiwww/pic/$picname4br\n;
 echo Photo 5: $picname5br\n;
  echo img src=c:/sammiwww/pic/$picname5br\n;
  echo Photo 6: $picname6br\n;
  echo img src=c:/sammiwww/pic/$picname6br\n;
  echo Photo 7: $picname7br\n;
  echo img src=c:/sammiwww/pic/$picname7br\n;
  echo Photo 8: $picname8br\n;
 echo img src=c:/sammiwww/pic/$picname8br\n;
   echo  bcenterThank you for registering,nbsp; $first
 /b/centerp;
  ?
  pcenter/p
 center
 a href=http://www.sammiesmodels.com; target=_selfReturn to
 Sammies Models
 Home/a
 ? }
// display form
 else {
   ?
 /center
 center
 font face=Georgia, Times New Roman, Times,
 serifstrongSubmit Your Portfolio
 Here:/strong/font
 /center
 form enctype=multipart/form-data name=entry method=POST
 action=?php echo $PHP_SELF?
 nbsp;
 table width=95% border=0 cellspacing=0 cellpadding=0
 tr
 td width=14%strongFirst Name:/strong/td
 td width=43%input name=first type=text size=30
 maxlength=45/td
 td width=43%font size=2 face=Arial, Helvetica,
 sans-serifnbsp;/font/td
 /tr
 tr
 tdstrongLast Name: /strong/td
 tdinput name=last type=text size=30 maxlength=45/td
 tdfont size=2 face=Arial, Helvetica,
 sans-serifstrong*Last name shall
 not be used on the website, but/strong/font/td
 /tr
 tr
 tdstrongAge:/strong/td
 tdinput name=age type=text size=30 maxlength=3/td
 tdfont size=2 face=Arial, Helvetica,
 sans-serifstrongfor internal use
 only./strong/font/td
 /tr
 tr
 tdstrongEmail:/strong/td
 tdinput name=email type=text  size=30 maxlength=45/td
 tdfont size=2 face=Arial, Helvetica, sans-serifnbsp;/font/td
 /tr
 tr
 tdstrongLocation:/strong/td
 tdinput name=location type=text id=location size=30
 maxlength=60/td
 tdfont size=2 face=Arial, Helvetica,
 sans-serifstrong*Location- please
 do not be specific, but only/strong/font/td
 /tr
 tr
 tdstrongEye Color/strong/td
 tdinput name=eye type=text id=eye size=30 maxlength=45/td
 tdfont size=2 face=Arial, Helvetica,
 sans-serifstrongstate or region./strong/font/td
 /tr
 tr
 tdstrongHair Color:/strong/td
 tdinput name=hair type=text id=hair size=30
 maxlength=45/td
 tdfont size=2 face=Arial, Helvetica, sans-serifnbsp;/font/td
 /tr
 tr
 td valign=topstrongExperience:/strong/td
 tdtextarea 

RE: [PHP-DB] Re: Permission Denied; Upload

2003-04-04 Thread Jennifer Goodie
You should not make the directory world writeable, that is a security risk.
You should chown it to the user the webserver runs as and make sure it is
owner writeable.  As a side note, a directory that is 666 is not traversable
as it is missing the execution bit and you need to execute to get into it.

 -Original Message-
 From: Gustavo Del Castillo Meza [mailto:[EMAIL PROTECTED]
 Sent: Friday, April 04, 2003 12:10 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Re: Permission Denied; Upload


 You need to give the user permission to write in the destination
 directory,
 you can do this by using:
  chmod 666 directoryname





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



RE: [PHP-DB] Can't Insert more than 1 record

2003-04-03 Thread Jennifer Goodie
Not without looking at your queries and code.  Posting those might make it
easier for people to answer your question.  I could make a lot of guesses
though.  First guess is your query is incorrect.

 -Original Message-
 From: Keven Jones [mailto:[EMAIL PROTECTED]
 Sent: Thursday, April 03, 2003 2:18 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Can't Insert more than 1 record


 Hello All,

 I am having a problem inserting records
 into my Database.  I am passing fields
 from a FORM to my php program that adds
 1 record to my DB. It will create the
 first attempt just fine, however any
 attempt after the 1st fails. I have
 to delete the existing row in order
 to add a new record.

 Anyone know what I am doing incorrectl?

 KJ


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



RE: [PHP-DB] using a variable as values in an array

2003-03-31 Thread Jennifer Goodie
Instead of building a string in your loop do the assignment in the loop
I have no idea what is being pulled from where, so I can't really give a
good example

-Original Message-
From: Charles Kline [mailto:[EMAIL PROTECTED]
Sent: Monday, March 31, 2003 1:25 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] using a variable as values in an array


I am trying to build an array from the results of a query on a mySQL
table.

I am using a loop to create this string in a variable $mystring:

'30'=true, '20'=true

I then need to use it like this:

$defaultValues['ib_article']   = array($mystring);

It isn't working. I am sure there is a better method, can anyone point
me in the right direction?

thanks
charles


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


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



RE: [PHP-DB] using a variable as values in an array

2003-03-31 Thread Jennifer Goodie
$mystring;
foreach ($sth_opt as $thekey = $thevalue){
   $mystring .= '.$thevalue.'=true, ;
}
$defaultValues['ib_article']   = array($mystring);

Try this ...

foreach ($sth_opt as $thekey = $thevalue){
$defaultValues['ib_article'][$thevalue] = 'true';
}

I'm not sure if the indices line up exactly with what you had in mind, but
I'm confident you can play with it to get what you want.


-Original Message-
From: Charles Kline [mailto:[EMAIL PROTECTED]
Sent: Monday, March 31, 2003 1:49 PM
To: Jennifer Goodie
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] using a variable as values in an array


Here is more details. Thanks for the reply.

I am using HTML_QuickForm (pear) to create my forms. In order to set
the default state of some of the elements (checkboxes in this case) I
need to pass an array as the value to QuickForm.

This array needs to be in the format of this:

array('30'=true, '29'=true) where the 30 and 29 are the values that
are coming back from my query. This could return up to 50 records.

This is what I was trying, but it isn't woring:

$mystring;
foreach ($sth_opt as $thekey = $thevalue){
$mystring .= '.$thevalue.'=true, ;
}


On Monday, March 31, 2003, at 04:32 PM, Jennifer Goodie wrote:

 Instead of building a string in your loop do the assignment in the loop
 I have no idea what is being pulled from where, so I can't really give
 a
 good example

 -Original Message-
 From: Charles Kline [mailto:[EMAIL PROTECTED]
 Sent: Monday, March 31, 2003 1:25 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] using a variable as values in an array


 I am trying to build an array from the results of a query on a mySQL
 table.

 I am using a loop to create this string in a variable $mystring:

 '30'=true, '20'=true

 I then need to use it like this:

 $defaultValues['ib_article']   = array($mystring);

 It isn't working. I am sure there is a better method, can anyone point
 me in the right direction?

 thanks
 charles


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


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



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


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



RE: [PHP-DB] PHP mail() question?

2003-03-31 Thread Jennifer Goodie
mail() will not run queries, you need to look at the php manual for the set
of functions for the database type you plan on using and execute the
database stuff in your script and pass the formatted results in the
appropriate argument of the mail function.

ie
$con = mysql_connect($host, $user,$pw);
$query = SELECT Email from EmailDatabse.TableToUse Where criteria =
'clause';
$result = mysql_query($query);
while ($row = mysql_fetch_array($result)){
$bcc .= $row[Email].,;
}
$bcc = substr($bcc 0, -1); //getting rid of last comma

$headers .= bcc: $bcc\r\n;

This is just a quick example, you'll need to add error checking and make
sure the argument order is correct on the functions, I don't have time to,
but I thought I'd at least put an effort into sending you on your way to
getting a functioning script.



-Original Message-
From: JeRRy [mailto:[EMAIL PROTECTED]
Sent: Monday, March 31, 2003 3:05 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] PHP mail() question?


Hi,

I am trying to get PHP mail() to do the following:

1) Grab email addresses from a database and put in the
BCC of the email. (hidding their email address)

2) Grab first names from a database and put in the
body of the email.

Below is a script I am using, does not do any queries
to any database because I am not sure how to do it in
the function.  I have tried but have failed so thought
I'd ask here.  Can anyone help?  Here is the code I am
using...

?php

$myname = Me Myself;
$myemail = [EMAIL PROTECTED];

$contactname = Mister Contact;
$contactemail = [EMAIL PROTECTED];

$message = hello from .$contactname.;
$subject = A email;

$headers .= MIME-Version: 1.0\r\n;
$headers .= Content-type: text/html;
charset=iso-8859-1\r\n;
$headers .= From: .$myname. .$myemail.\r\n;
$headers .= To: .$contactname.
.$contactemail.\r\n;
$headers .= Reply-To: .$myname.
$myreplyemail\r\n;
$headers .= X-Priority: 1\r\n;
$headers .= X-MSMail-Priority: High\r\n;
$headers .= X-Mailer: Just My Server;

mail($contactemail, $subject, $message, $headers);

?

Maybe I need a different function? If so could someone
show me a example of how it can be achieved please?

Thanks!

Jerry

P.S. I am using mysql database.

http://mobile.yahoo.com.au - Yahoo! Mobile
- Check  compose your email via SMS on your Telstra or Vodafone mobile.

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


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



RE: [PHP-DB] mail()

2003-03-31 Thread Jennifer Goodie
This is not so much a database question.  The answer is yes, it can be.  You
can read the documentation to find out how.
 http://www.php.net/manual/en/function.mail.php

A quick example is:
?php
$body = '';
foreach ($_POST as $key= $val){
$body .= $key = $val\n;
}
mail ($address, Form submission, $body);
?

That is really ugly an inelegant.  I would suggest building off of it by
adding error checking and formatting the mail body.

-Original Message-
From: Mike Delorme [mailto:[EMAIL PROTECTED]
Sent: Monday, March 31, 2003 3:23 PM
To: MySQL PHP Database Help
Subject: [PHP-DB] mail()


Can this fucktion be use to mail the submited content of a form? If so how?



Thanks for your time,
Mike Delorme


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



RE: [PHP-DB] Sharing variable values among PHP files

2003-03-31 Thread Jennifer Goodie
You could set a cookie containing the value on the first page and access it
on the others.

 -Original Message-
 From: Alexa Kirk [mailto:[EMAIL PROTECTED]
 Sent: Monday, March 31, 2003 6:35 PM
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: [PHP-DB] Sharing variable values among PHP files


 Does anyone know how to take a variable containing POST data from a form
 and use this value in another PHP file? I need to take a username from
 one PHP file and use it in a couple of other PHP files later when adding
 to a database.

 Thank you,
 Alexa Kirk



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



RE: [PHP-DB] Putting a string into a variable.

2003-03-28 Thread Jennifer Goodie
The part where $i is never equal to 1 might be the problem.  You might want
to try incrementing your sentinel when using loops.

-Original Message-
From: Info_Best-IT [mailto:[EMAIL PROTECTED]
Sent: Friday, March 28, 2003 11:13 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Putting a string into a variable.


I am having problems putting an html string into a variable to create an
array of
strings.

something like this:


$stringarray[] = array();
$i = 0;

while ( $i  6 ){
$stringarray[$i] = table
cellspacing=\0\trtd.$this-differentarray[0]
[0]./td/tr/table;
}


When I echo $stringarray[1] it comes up empty...  Is there a special trick
to get a
string into an array or even store one as a variable.

thanks,
/Tim

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


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



RE: [PHP-DB] Connection issues with pgsql?

2003-03-28 Thread Jennifer Goodie
Check the documentation on pg_query.
http://www.php.net/manual/en/function.pg-query.php

It expects the link identifier as the first argument and the query as the
second.  Switch your arguments and you might have some luck.

The manual is always a great place to look for answers to things like this.

-Original Message-
From: Nathaniel Price [mailto:[EMAIL PROTECTED]
Sent: Friday, March 28, 2003 11:05 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Connection issues with pgsql?


Hi, I just installed PHP with pgsql support, and it doesn't seem to work
properly, although I don't see why it shouldn't.

I'm running the following script:
?php
error_reporting (E_ALL);
$myconn = pg_connect(dbname=thornvalley);
$res = pg_query('select * from test;', $myconn);
print_r(pg_fetch_row($res));
?

and this is what I get back:
Warning: pg_query(): supplied argument is not a valid PostgreSQL link
resource in /var/www/html/dbtest.php on line 4

Warning: pg_fetch_row(): supplied argument is not a valid PostgreSQL result
resource in /var/www/html/dbtest.php on line 5

without any other clues as to what might be happening. I have tried using
other connection strings as well:
dbname=thornvalley user=apache password=[passwd]
dbname=thornvalley user=apache password=[passwd] host=localhost port=5432

with the same result.

I'm not sure what's going on; just so that you know, I'm using the RPM-based
install of Apache 2.0.44, PHP 4.3.1 and PostgreSQL 7.3.2 that comes with
Mandrake Linux 9.1. All of the necessary support packages (AFAIK) have been
installed and are visible with phpinfo() (i.e. there's a pgsql section), and
I have defined an apache user in the PostgreSQL database... so, any clues as
to what might be going on?


Nathaniel Price http://www.thornvalley.com
Who is General Failure and why is he reading my hard drive?


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


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