Re: [PHP-DB] printable pdf

2009-02-04 Thread Micah Stevens
It's not actively maintained, but it's easy to use and works great:

http://www.ros.co.nz/pdf/

I like it better due to it's API than the other stuff I've tried,
although it's lacking in some functionality.

On 02/03/2009 09:04 PM, Ron wrote:
 Hi All,

 I'm creating a billing system wherein a user can view invoices. and if
 the user wants to print it a click on a button will generate a pdf
 file of their invoice. pdf or any other printable format will do.

 TIA
 Regards
 Ron


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



Re: [PHP-DB] mysql_select_db

2008-10-21 Thread Micah Stevens

Try it on the command line from the webserver:

mysql -h hostname -u Stan -p Password

See if that connect works.

-Micah

On 10/21/2008 04:26 AM, Stan wrote:

Nope ... that wasn't it.

The mysql_connect() works.

It's the mysql_select_db() that's failing.



  


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



Re: [PHP-DB] mysql_select_db

2008-10-21 Thread Micah Stevens
Okay, on the command line, then connect, and then select your database, 
what's the error message it gives?


-Micah

On 10/21/2008 11:06 AM, Stan wrote:

So ... if I enter mysql -h mysqlServer -u stan -p and then enter the 
password, I get connected without a problem ... I get the mysql client prompt.

And the mysql_connect() statement in my code does not die.

But the mysql_select_db() statement in my code does die.

Micah Stevens [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]
  

Try it on the command line from the webserver:

mysql -h hostname -u Stan -p Password

See if that connect works.

-Micah

On 10/21/2008 04:26 AM, Stan wrote:


Nope ... that wasn't it.

The mysql_connect() works.

It's the mysql_select_db() that's failing.




  


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



Re: [PHP-DB] decimal point

2007-12-19 Thread Micah Stevens


Without trying it, I would assume php (since it's typeless) would just 
cast the string back into a number? I wouldn't do it for another reason- 
possible loss of accuracy.


-Micah

On 12/16/2007 10:08 AM, Stephen Johnson wrote:

You will lose your decimal places during normal calculations...

But you can display them back to the user using number_format.

http://php.net/number_format

Bear in mind that you should always pass the formatted number into a
different variable as you will NOT be able to perform any further
calculations on the formatted variable since it now considered a string.

Hope this helps
--
Stephen Johnson c | eh
The Lone Coder

http://www.thelonecoder.com
continuing the struggle against bad code

http://www.thumbnailresume.com
--




  

From: Ron Piggott [EMAIL PROTECTED]
Organization: Acts Ministries Christian Evangelism
Reply-To: [EMAIL PROTECTED]
Date: Sun, 16 Dec 2007 12:55:01 -0500
To: Micah Stevens [EMAIL PROTECTED]
Cc: php-db@lists.php.net
Subject: Re: [PHP-DB] decimal point

Ok.  I have this resolved.

One more question about this --- is there any way I may keep the 2
decimal places when I use math to manipulate the variable ---


$rate_plan_rate = ($rate_plan_rate / 100) * (100 - $discount);

$ 28.8

I would like the result to be $28.80

Thanks for your help Micah.

Ron

On Sat, 2007-12-15 at 19:58 -0800, Micah Stevens wrote:


If I make a test table with a field that is DECIMAL(4,2), I can:


INSERT INTO `testaa` ( `a` )
VALUES ( 


'8.00'
)

Then I can
SELECT * FROM `testaa`

I get '8.00' from the 'a' field.

It looks like you're using an abstraction library? Perhaps that's the
problem?

-Micah 




On 12/15/2007 07:13 PM, Ron Piggott wrote:
  

INSERT INTO rate_plans VALUES ( '12', 'One Week', '1', '2', '2',
'8.00' )

When I use 


$advertisement_rate = mysql_result($rate_plan_result,0,rate);

$advertisement_rate has a value of 800 instead of 8.00 --- how can I get
my 2 decimal places back?

Ron

On Sat, 2007-12-15 at 18:18 -0800, Micah Stevens wrote:
  


What's your insert statement?

On 12/15/2007 05:11 PM, Ron Piggott wrote:

  

How do I get the decimal point back when I am retrieving from a column
that is set up as:

rate decimal(4,2)

Example: Right now it is giving me 800 instead of 8.00

Ron

  
  

  


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




  


Re: [PHP-DB] decimal point

2007-12-15 Thread Micah Stevens

What's your insert statement?

On 12/15/2007 05:11 PM, Ron Piggott wrote:

How do I get the decimal point back when I am retrieving from a column
that is set up as:

rate decimal(4,2)

Example: Right now it is giving me 800 instead of 8.00

Ron

  


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



Re: [PHP-DB] decimal point

2007-12-15 Thread Micah Stevens

If I make a test table with a field that is DECIMAL(4,2), I can:

INSERT INTO `testaa` ( `a` )
VALUES (
'8.00'
)

Then I can
SELECT * FROM `testaa`

I get '8.00' from the 'a' field.

It looks like you're using an abstraction library? Perhaps that's the 
problem?


-Micah



On 12/15/2007 07:13 PM, Ron Piggott wrote:

INSERT INTO rate_plans VALUES ( '12', 'One Week', '1', '2', '2',
'8.00' )

When I use 


$advertisement_rate = mysql_result($rate_plan_result,0,rate);

$advertisement_rate has a value of 800 instead of 8.00 --- how can I get
my 2 decimal places back?

Ron

On Sat, 2007-12-15 at 18:18 -0800, Micah Stevens wrote:
  

What's your insert statement?

On 12/15/2007 05:11 PM, Ron Piggott wrote:


How do I get the decimal point back when I am retrieving from a column
that is set up as:

rate decimal(4,2)

Example: Right now it is giving me 800 instead of 8.00

Ron

  
  


  


Re: [PHP-DB] What could be the right approach to get this data

2007-09-26 Thread Micah Stevens
Sessions use cookie unless you force the URL session ID. Once you do 
that, your options are pretty limited. You must pass some sort of 
identifier from page load to page load to track a session. This can 
either be via cookie (a preferred method) or through GET or POST 
variables. There is no other good way that I'm aware of.


Actually, you might be able to engineer a small persistant data store 
based on a Flash object. I've seen this done before - I think there are 
some javascript libraries that use this technique.


Why complicate things when you can just use cookies? I still don't 
understand people's aversion to using them. They serve a very useful 
purpose and the downsides are trivial.


-Micah

On 09/25/2007 01:51 AM, Chris Carter wrote:

Hi,

I have users loging in and posting jobs. Now once the data is posted to the
database, the next time the user logs-in he will be presented with two
pages.

1) Post more jobs
2) Visit this page and delete jobs that you posted.

If he choses to go to the page 2 and delete the jobs. The table that shows
up with his posted jobs actually is derived by capturing the email id he
used to enter while logging in. This email ID is maintained throughout the
session.

The session captures his login email id  checks for his data and shows up.

The question is: Is session the only and/or best way to achieve this
functionality. (Don't want cookies).
Is there some efficient session mechanism available to achieve this?

Thanks,

Chris
  


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



Re: [PHP-DB] Include function across servers

2007-04-03 Thread Micah Stevens
No. That would be to access the code. Include grabs an entire file. 
Perhaps you should look into Ajax techniques.


-Micah

On 04/02/2007 04:06 PM, ioannes wrote:
I have a particular business application so just returning html is OK, 
the output is the useful bit in this case.  I understand from the 
discussion that I can still run my code on my server in response to a 
remote server requesting the result of a function in that file and 
that result gets back to that server.  So you can use include() to 
access the result of a function on another server, sounds like.




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



Re: [PHP-DB] Include function across servers

2007-04-02 Thread Micah Stevens

I'm not totally clear on what you're asking, so here's two options:

If you use the include() function, you're pulling the code from the 
external server and running on the local server. If you're running an 
HTTP call, say via an Ajax routine for example, the code runs on the 
external server.


The difference is if you're grabbing the source from the external server 
and running it on the local php interpreter, or if you're using the 
external php setup.


This seems to be what you're asking, the answer in this case is, either 
one could happen, it depends on your implementation. If you provide 
details on the exact implementation then I can give a more exact answer.


HTH,
-Micah

On 04/02/2007 06:53 AM, ioannes wrote:
I ask this as I do not have two web sites on different servers to test 
at  the moment.
Does it work to use an include function in the php code on one site 
that calls a function on the other site?  If you include a file on a 
remote server that runs a function, where does the function run - on 
the server where the function is originally written or on the calling 
server?  I am thinking that if I write code, it is one way to make the 
functionality available without actually disposing of the source code 
itself.


So the included functions might be variable values.  Eg you could pass 
back a whole calendar to the calling server, which then just prints on 
the calling web site just by printing the returned variable.  (I know 
that in terms of getting data to mark up the calendar the database 
would need to be fully referenced: user, password, server, and the 
calling (shared) host for instance will ask for the remote IP address 
to add to a white list.)


John



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



Re: [PHP-DB] dst

2007-03-17 Thread Micah Stevens

Did you restart MySQL?

On 03/16/2007 02:22 PM, Ron Croonenberg wrote:

Hi quick question (off topic a bit)

MySQL seems to be not running on DST while the machine it is on is.
any ideas ?

if I use a mysql_query(select now(), connection);  it looks like it is
an hour earlier then the system time.

Ron

  


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



Re: [PHP-DB] Re: do not display dublicated entries

2007-03-14 Thread Micah Stevens
I thought about this some more, and my last reply wouldn't work if you 
wanted data besides the IP and date. A better answer is to use a 
self-join like this:


select t1.* from tracker t1
left join tracker t2 on t2.date  t1.date
and t2.ip = t1.ip
where t2.date is null

That should get you what you want.

-Micah

On 03/13/2007 11:41 PM, septic wrote:

Thanks for the responce..

I have tried everything except of the one that forms the date in one field 
and use the DISTINCT for ip and date.


The problem with the distinct is that even if I use 'order by' the entries I 
get for all IPs are not the latest ones that exist in the database.


.

septic [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
  

Hello all,

I have created a simple webtracer for my website and I save some info on 
mysql database.


table = tracker

FIELDS
ip
day
month
year
session_id
browser of visitor
page that was visited


What I would like to do next,  is simple to create an output of that 
database with the last time that every different IP has visited my 
website.


the best output I have at the moment is:

$query = SELECT ip,day,month,year FROM tracker WHERE page = 'index' 
ORDER BY `tracker`.`year` DESC , `tracker`.`month` DESC , `tracker`.`day` 
DESC LIMIT 0,20   ;


The problem is that I want to Keep for each different IP the fisrt entry 
that is found on this output I get.


therefore I would say that the output would represent the last visit of 
each different user on my website.


do you know of a php or sql trick to avoid entries that containt the same 
IP entries ?


Thanks in advance for the help.
Nikos. 



  


Re: [PHP-DB] Caching query results in html pages

2007-03-13 Thread Micah Stevens
This may work, although I just made it up. I can see already that you'd 
have some problems with multiple scripts running at once. If a script 
opens the cache, then a second script saves new cache information before 
the first script saves it's data, the first script would overwrite the 
second script's update.


Maybe instead of a read at the beginning of script execution, a read at 
the beginning of each query would be better?


Save cache results to a file:

?
// script start
$querycache = unserialize(file_get_contents(query.cache));

/*
$querycache format:

array('sql' = array(), 'result'=array(), 'time'=array());

For each sql statement 'sql' you have a result array.
*/
// run all your queries through a function:
function query($sql) {
   $cached = array_search($sql, $querycache['sql'])
   // check to see if the result is old
   if (time() - $querycache['time'][$cached]  $max_time) {
 unset($querycache['time'][$cached]);
 unset($querycache['sql'][$cached]);
 unset($querycache['result'][$cached]);
 $cached = false;
   }
   if ($cached) {
 return $querycache['result'][$cached];
   } else {
 $result = mysql_query($sql);
 $querycache['sql'][] = $sql;
 $index = array_search($querycache['sql']);
 $querycache['time'][$index] = time();
 while ($r = assoc($result)) {
$querycache['result'][$index][] = $r;
 }
 // save cache for other scripts
 file_put_contents('query.cache', serialize($querycache));
 return $querycache['result'][$index];
   }
}

... It's actually kind of a complicated process now that I'm thinking 
about it.


-Micah





On 03/13/2007 06:20 AM, Vincent wrote:

Hi all,

I'm trying to improve the performance for visitors, and I want to know
if there is some way to store the mySQL results of  .php scripts in
webpages.

So, in example, when requesting
http://www.mydomain.com/script.php?id=110 , it can be redirected to
his cached version http://www.mydomain.com/id110.html.


Any code or information would be appreciated,


Regards,

  


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



Re: [PHP-DB] Search

2007-03-12 Thread Micah Stevens
There's so many correct answers to your question that I don't really 
want to broach the subject. There's enough to that question that could 
fill several volumes.


Take a look at the FULLTEXT search functionality of MySQL just for a 
taste of what goes into such things. This is likely not your answer, but 
the description of the functionality can introduce you to some of the 
concepts.


-Micah

On 03/12/2007 08:45 PM, MIGUEL ANTONIO GUIRAO AGUILERA wrote:

Hi my friends,

I have a web site where visitor should be able to look for specific documents: 
articles, sermons, etc I want to provide the capability to search by keywords, 
but I have never worked with this kind of search.

Any ideas of what I should store in my tables?
How to create my query?? Should I have a keywords field in he table??

Best Regards,


MIGUEL GUIRAO AGUILERA
Logistica R8 - Telcel
Tel: (999) 960.7994


Este mensaje es exclusivamente para el uso de la persona o entidad a quien esta 
dirigido; contiene informacion estrictamente confidencial y legalmente 
protegida, cuya divulgacion es sancionada por la ley. Si el lector de este 
mensaje no es a quien esta dirigido, ni se trata del empleado o agente 
responsable de esta informacion, se le notifica por medio del presente, que su 
reproduccion y distribucion, esta estrictamente prohibida. Si Usted recibio 
este comunicado por error, favor de notificarlo inmediatamente al remitente y 
destruir el mensaje. Todas las opiniones contenidas en este mail son propias 
del autor del mensaje y no necesariamente coinciden con las de Radiomovil 
Dipsa, S.A. de C.V. o alguna de sus empresas controladas, controladoras, 
afiliadas y subsidiarias. Este mensaje intencionalmente no contiene acentos.

This message is for the sole use of the person or entity to whom it is being 
sent.  Therefore, it contains strictly confidential and legally protected 
material whose disclosure is subject to penalty by law.  If the person reading 
this message is not the one to whom it is being sent and/or is not an employee 
or the responsible agent for this information, this person is herein notified 
that any unauthorized dissemination, distribution or copying of the materials 
included in this facsimile is strictly prohibited.  If you received this 
document by mistake please notify  immediately to the subscriber and destroy 
the message. Any opinions contained in this e-mail are those of the author of 
the message and do not necessarily coincide with those of Radiomovil Dipsa, 
S.A. de C.V. or any of its control, controlled, affiliates and subsidiaries 
companies. No part of this message or attachments may be used or reproduced in 
any manner whatsoever.

  


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



Re: [PHP-DB] auto_increment command

2007-03-11 Thread Micah Stevens

Actually you can. As Bastien pointed out:

ALTER TABLE tbl AUTO_INCREMENT = 1;

This may screw with your indexes though, if you have a primary indexed, 
or unique indexed row, and you set this to 1, mysql MAY try and 
insert conflicting values. I've never done this so I have no idea how 
this is handled by the server, but I suspect you'll just get an error.


-Micah

On 03/11/2007 06:55 PM, bedul wrote:

u can't
- Original Message -
From: Ron Piggott [EMAIL PROTECTED]
To: PHP DB php-db@lists.php.net
Sent: Monday, March 12, 2007 7:52 AM
Subject: [PHP-DB] auto_increment command


  

I am not sure if that last e-mail went through or not.  I am wondering
how to re-set the auto_increment field back to 1 in one of my tables.
Ron



there no such thing reset auto_increment
if you need the reset.. there were way to do that.
rename the table.. then take query to build it
create new table and tralalla.. u have reset it.

fyi. if inside the table already have a data were id was 100.. the next id
must be 101..
btw.. if you want to make your table more clean (i said about.. how random
the num).. there is a way.
what reason u wanna do that??

  


Re: [PHP-DB] Storing 4KB jpeg images on hospital web server

2007-03-08 Thread Micah Stevens

On 03/08/2007 01:35 AM, Chetan Graham wrote:

Back to the Hospital website.  Now the Web Boss wants to put the images in
the DB.  I do feel the webserver folders would simply and well.
However, we do what the boss says.
  

I'm with Bastien on this one, I've stored images in a database in the 
past, and although I have to admit that it makes a certain amount of 
sense in the fact it keeps all your data in one place, practically it's 
a pain in the butt. It's faster, more efficient and better in almost 
every respect to let the filesystem do what it does best and store the 
files, and the database deal with data you need to organize and sort.


-Micah

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



Re: [PHP-DB] PHP_AUTH_USER .htaccess

2007-03-06 Thread Micah Stevens
This function doesn't work if you're using the CGI version of PHP. Check 
for that - it may be responsible.


-Micah

On 03/06/2007 12:02 AM, Mike van Hoof wrote:

Hello,

I've got a really strange problem, and hope this is the right list to 
post to.


I got a website with a login, which uses a .htaccess file for 
autentication. That part works like a charm. But when i want to read 
the loggin details with PHP, the variable $_SERVER['|PHP_AUTH_USER'] 
isn't set (in the directory where i logged into)


when i go a directory back, and view a phpinfo() there i see 
|$_SERVER['|PHP_AUTH_USER']|| is set, so i do a phpinfo() in the 
directory with the .htaccess and it is gone.


Had anyone ever had experience with this, because i can't find a 
solution.


- Mike|



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



Re: [PHP-DB] array field type

2007-03-06 Thread Micah Stevens


Wrong! Take a look at the SET datatype 
http://dev.mysql.com/doc/refman/4.1/en/set.html. This allows you to have an 
array of values in a single field, and the user can select any number of 
them.


  
Sort of, but not really: This is a really specialized keyword, and 
depends on binary mapping of enum-ish sets. As a results you have a 
maximum of 64 possible values, and only 1 dimension. Large or 
multdimensional arrays wouldn't work with this.


-Micah

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



Re: [PHP-DB] array field type

2007-03-04 Thread Micah Stevens
Not a single field, but there's several methods of storing trees of 
information, which is what an array is. Here's one:


Nested Array storage table:

ArrayID (int, autonumber)
keyname (text)
parent   (int)
data (bigtext or whatever would be appropriate for the data you're storing)

For an array like this:

array('one'=1, 'two'=array('three'=3, 'four'=4))

the table would store these rows:

1, 'one', 0, 1
2, 'two', 0, 2
3, 'three', 2, 3
4, 'four', 2, 4

You can use a recursive function to restore the array, unless you 
require the granular functionality this type of process would give you 
such as sorting and filtering and statistics gathering.


-Micah

However, I think in the long run, you'd be better off serializing the data.

-Micah


On 03/04/2007 02:15 PM, Sancar Saran wrote:

On Sunday 04 March 2007 23:04, Sancar Saran wrote:
  

Hi,

I want to know is there any db server around there for store php arrays
natively.

Regards

Sancar


Thanks for responses, it seems I have to give more info about situation.

In my current project, we had tons of arrays. They are very deep and 
unpredictable nested arrays.


Currently we are using serialize/unserialize and it seems it comes with own 
cpu cost. Xdebug shows some serializing cost blips. Sure it was not SO BIG 
deal (for now of course).


My db expertise covers a bit mysql and mysql does not have any array type 
field (enum just so simple). 

I just want to know is there any way to keep array data type natively in a sql 
field.


Regards.

Sancar

  


Re: [PHP-DB] Mysql autentication problem

2007-03-03 Thread Micah Stevens
In mysql 4.1, they changed the hash format of the passwords. If you 
stored the password from a 3.x client, and area accessing with a 4.x or 
5.x client, or the other way around, you might have similar problems.


Your command line client is likely the same version as the server, so 
I'm guessing that your php might be older.


However, this situation is usually accompanied by a specific error 
message referencing the client version. Do you have that?


-Micah

On 03/02/2007 11:35 PM, bedul wrote:

now you mention it.
i hope the same problem will solve.
 
i use in windows (own pc)..not in real-life server.. thx for your 
repair on my missuderstanding


- Original Message -
*From:* Micah Stevens mailto:[EMAIL PROTECTED]
*To:* bedul mailto:[EMAIL PROTECTED]
*Cc:* php-db@lists.php.net mailto:php-db@lists.php.net
*Sent:* Saturday, March 03, 2007 1:48 PM
*Subject:* Re: [PHP-DB] Mysql autentication problem

Reloading the grant tables should happen almost immediately unless
you have an extremely large set of users, very little memory, or a
very slow computer.



On 03/02/2007 06:17 PM, bedul wrote:

- Original Message -
From: Micah Stevens [EMAIL PROTECTED]
To: Roberto F Tavares Neto [EMAIL PROTECTED]
Cc: php-db@lists.php.net
Sent: Saturday, March 03, 2007 3:17 AM
Subject: Re: [PHP-DB] Mysql autentication problem


  

Strange. If you look at the users table, is there a password hash in the
password field?




i think this must be reload?? not just flush?? it happen to me..
or perhaps need some times to realy reload??
  

Roberto F Tavares Neto wrote:


Micah:

I did create the database. Then, I use the:

GRANT ALL PRIVILEGES ON db.* TO [EMAIL PROTECTED] IDENTIFIED BY 'password'

to do the 2 and 3 steps.

FLUSH PRIVILEGES

to do the step 4.

But the step 5 really does not work... only on the shell or when I
remove the password from the user...

Roberto

Micah Stevens escreveu:
  

Did you give the user permissions to use the database in question?

Here's my sequence of actions:

.
1) Create DB if it doesn't exist
2) Create the user w/password
3) Give the user permission to use the database.
4) Flush privileges to update the server.
5) login and enjoy.

-Micah

Roberto F Tavares Neto wrote:


Hello,

I'm trying to do a very simple thing: create a database and a user
to use it.

So, initially, I use the web interface phpmyadmin. Logged as root, I
created the database, and the user with some password.

But, I could not login using phpmyadmin. Either any php-based system
could connect to the BD.

So, I make sure that I got the [EMAIL PROTECTED] and [EMAIL PROTECTED]
created, with permissions and same password. Nothing.

But I *can* log on mysql shell.

One more info: when the user is set without password, it works fine
on PHP.


Does anyone can give me a clue of what is happening?

Thanks!

Roberto

  
  








  

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



  




Re: [PHP-DB] recursion in php and mysql

2007-03-02 Thread Micah Stevens
It will complain if your query isn't returning any results. Check for 
that too.


-Micah

On 03/01/2007 09:36 PM, Ron Croonenberg wrote:

Hi Micah,

thanks I have a bunch of things working now.

mysql_fetch_array() is complaining.

I use it like this:

function recursive() {
global $connection;

$result = mysql_query(SELECT * FROM $table WHERE bthb4='$bthb4', $connection);
$row = mysql_fetch_array($result);
}

the error I got was:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result 
resource in recursion.php on line 93

I tried: $row = mysql_fetch_array($result, $connection);

But I have the impression that $result  now isn't correct anymore ?

the mysql_fetch_array() is the only function (so far) that complains ?

thanks for your earlier very quick response,

Ron


  

Micah Stevens [EMAIL PROTECTED] 03/02/07 12:04 AM 

Yep, just put the connect function outside your recursive loop. You can 
then access the connection that is returned by the connect function by 
making it global, or passing it by reference by the recursive function.


In other words:

$connection = mysql_connect();
mysql_select_db($database, $connection);

recursive_function($value);

function recursive_function($value)
{
global $connection;

$data = mysql_query($sql, $connection);

recursive_function($data);

}

... or something.. you get the picture.

-Micah



On 03/01/2007 08:52 PM, Ron Croonenberg wrote:
  

Hello all,

I wrote an app in php and it uses recursion.

Problem I have is that when I connect to a database using
mysql_connect($dbhost, $username, $password); and select a table with
mysql_select_db($database) I cannot access the table anymore from some
function.

Now I can connect and select a database in that php function  but that
means that process happens A LOT and connecting and selecting everytime
probably slows down the app quite a bit

Is there a way to connect to a database and select a table globally
so that I have access to it in ever php function I write ?

thanks,

Ron

  



  


Re: [PHP-DB] Mysql autentication problem

2007-03-02 Thread Micah Stevens

Did you give the user permissions to use the database in question?

Here's my sequence of actions:

.
1) Create DB if it doesn't exist
2) Create the user w/password
3) Give the user permission to use the database.
4) Flush privileges to update the server.
5) login and enjoy.

-Micah

Roberto F Tavares Neto wrote:

Hello,

I'm trying to do a very simple thing: create a database and a user to 
use it.


So, initially, I use the web interface phpmyadmin. Logged as root, I 
created the database, and the user with some password.


But, I could not login using phpmyadmin. Either any php-based system 
could connect to the BD.


So, I make sure that I got the [EMAIL PROTECTED] and [EMAIL PROTECTED] created, 
with permissions and same password. Nothing.


But I *can* log on mysql shell.

One more info: when the user is set without password, it works fine on 
PHP.



Does anyone can give me a clue of what is happening?

Thanks!

Roberto



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

Re: [PHP-DB] recursion in php and mysql

2007-03-02 Thread Micah Stevens

Classes are overrated. :)

Bastien Koert wrote:
you could make the connection variable global, but the best bet here 
is to use a class and create a db object that your functions could call


Bastien



From: Ron Croonenberg [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] recursion in php and mysql
Date: Thu, 01 Mar 2007 23:52:54 -0500

Hello all,

I wrote an app in php and it uses recursion.

Problem I have is that when I connect to a database using
mysql_connect($dbhost, $username, $password); and select a table with
mysql_select_db($database) I cannot access the table anymore from some
function.

Now I can connect and select a database in that php function  but that
means that process happens A LOT and connecting and selecting everytime
probably slows down the app quite a bit

Is there a way to connect to a database and select a table globally
so that I have access to it in ever php function I write ?

thanks,

Ron

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



_
Find out the restaurants participating in Winterlicious 
http://local.live.com/default.aspx?v=2cp=43.658648~-79.383962style=rlvl=15tilt=-90dir=0alt=-1000scene=3702663cid=7ABE80D1746919B4!1329 
From January 26 to February 8, 2007




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

Re: [PHP-DB] auto upload

2007-03-02 Thread Micah Stevens
I think I remember seeing scheduled FTP transfer capability with a 
couple of backup programs that exist. I uninstalled the one I used, and 
I don't remember the name, but it worked well enough.  Might be worth a 
google if you don't want to mess with non-gui stuff. (although, console 
work is like exercise.. it doesn't sound that appealing, but once you 
start doing it, you will crave more..)




Bastien Koert wrote:
You could use php+gtk to write it that way, but a simple batch file is 
the best bet since you could then use task scheduler to run this batch 
file at scheduled times.


Just google dos batch files

bastien



From: bedul [EMAIL PROTECTED]
To: Bastien Koert [EMAIL PROTECTED]
CC: php-db@lists.php.net
Subject: Re: [PHP-DB] auto upload
Date: Fri, 2 Mar 2007 17:13:51 +0700


- Original Message -
From: Bastien Koert [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; php-windows@lists.php.net;
php-db@lists.php.net
Sent: Thursday, March 01, 2007 9:05 PM
Subject: RE: [PHP-DB] auto upload


 What about just writing a batch script that opens the ftp services and
sends
 the file?

 Bastien
hmm.. that was a good idea..
is that using php?? or i should use desktop programing?? i better use 
php

since this php milis right..



_
http://local.live.com/default.aspx?v=2cp=43.658648~-79.383962style=rlvl=15tilt=-90dir=0alt=-1000scene=3702663cid=7ABE80D1746919B4!1329 





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

Re: [PHP-DB] Mysql autentication problem

2007-03-02 Thread Micah Stevens
Strange. If you look at the users table, is there a password hash in the 
password field?


Roberto F Tavares Neto wrote:

Micah:

I did create the database. Then, I use the:

GRANT ALL PRIVILEGES ON db.* TO [EMAIL PROTECTED] IDENTIFIED BY 'password'

to do the 2 and 3 steps.

FLUSH PRIVILEGES

to do the step 4.

But the step 5 really does not work... only on the shell or when I 
remove the password from the user...


Roberto

Micah Stevens escreveu:

Did you give the user permissions to use the database in question?

Here's my sequence of actions:

.
1) Create DB if it doesn't exist
2) Create the user w/password
3) Give the user permission to use the database.
4) Flush privileges to update the server.
5) login and enjoy.

-Micah

Roberto F Tavares Neto wrote:

Hello,

I'm trying to do a very simple thing: create a database and a user 
to use it.


So, initially, I use the web interface phpmyadmin. Logged as root, I 
created the database, and the user with some password.


But, I could not login using phpmyadmin. Either any php-based system 
could connect to the BD.


So, I make sure that I got the [EMAIL PROTECTED] and [EMAIL PROTECTED] 
created, with permissions and same password. Nothing.


But I *can* log on mysql shell.

One more info: when the user is set without password, it works fine 
on PHP.



Does anyone can give me a clue of what is happening?

Thanks!

Roberto








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

Re: [PHP-DB] Mysql autentication problem

2007-03-02 Thread Micah Stevens
Reloading the grant tables should happen almost immediately unless you 
have an extremely large set of users, very little memory, or a very slow 
computer.




On 03/02/2007 06:17 PM, bedul wrote:

- Original Message -
From: Micah Stevens [EMAIL PROTECTED]
To: Roberto F Tavares Neto [EMAIL PROTECTED]
Cc: php-db@lists.php.net
Sent: Saturday, March 03, 2007 3:17 AM
Subject: Re: [PHP-DB] Mysql autentication problem


  

Strange. If you look at the users table, is there a password hash in the
password field?




i think this must be reload?? not just flush?? it happen to me..
or perhaps need some times to realy reload??
  

Roberto F Tavares Neto wrote:


Micah:

I did create the database. Then, I use the:

GRANT ALL PRIVILEGES ON db.* TO [EMAIL PROTECTED] IDENTIFIED BY 'password'

to do the 2 and 3 steps.

FLUSH PRIVILEGES

to do the step 4.

But the step 5 really does not work... only on the shell or when I
remove the password from the user...

Roberto

Micah Stevens escreveu:
  

Did you give the user permissions to use the database in question?

Here's my sequence of actions:

.
1) Create DB if it doesn't exist
2) Create the user w/password
3) Give the user permission to use the database.
4) Flush privileges to update the server.
5) login and enjoy.

-Micah

Roberto F Tavares Neto wrote:


Hello,

I'm trying to do a very simple thing: create a database and a user
to use it.

So, initially, I use the web interface phpmyadmin. Logged as root, I
created the database, and the user with some password.

But, I could not login using phpmyadmin. Either any php-based system
could connect to the BD.

So, I make sure that I got the [EMAIL PROTECTED] and [EMAIL PROTECTED]
created, with permissions and same password. Nothing.

But I *can* log on mysql shell.

One more info: when the user is set without password, it works fine
on PHP.


Does anyone can give me a clue of what is happening?

Thanks!

Roberto

  
  








  

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



  


Re: [PHP-DB] recursion in php and mysql

2007-03-01 Thread Micah Stevens
Yep, just put the connect function outside your recursive loop. You can 
then access the connection that is returned by the connect function by 
making it global, or passing it by reference by the recursive function.


In other words:

$connection = mysql_connect();
mysql_select_db($database, $connection);

recursive_function($value);

function recursive_function($value)
{
global $connection;

$data = mysql_query($sql, $connection);

recursive_function($data);

}

... or something.. you get the picture.

-Micah



On 03/01/2007 08:52 PM, Ron Croonenberg wrote:

Hello all,

I wrote an app in php and it uses recursion.

Problem I have is that when I connect to a database using
mysql_connect($dbhost, $username, $password); and select a table with
mysql_select_db($database) I cannot access the table anymore from some
function.

Now I can connect and select a database in that php function  but that
means that process happens A LOT and connecting and selecting everytime
probably slows down the app quite a bit

Is there a way to connect to a database and select a table globally
so that I have access to it in ever php function I write ?

thanks,

Ron

  


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



Re: [PHP-DB] A good PHP Ajax tutorial

2007-02-26 Thread Micah Stevens
I've used Xajax library with PHP and it's very nice and easy to use. 
It's high-level, so if you want to learn the nuts and bolts, it's not a 
good place to start, but if you just want to make something work, it's 
great.


http://www.xajaxproject.org/

On 02/25/2007 08:37 PM, Peter Beckman wrote:

On Sun, 25 Feb 2007, Denis L. Menezes wrote:


Can someone please suggest a good pHP/Ajax tutorial?


 Use mootools, http://mootools.net/

 Best JS library around, does all sorts of neat AJAXy animations as 
well as

 handling the backend cross-browser.

--- 

Peter Beckman  
Internet Guy
[EMAIL PROTECTED] 
http://www.purplecow.com/
--- 





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



Re: [PHP-DB] upgrade MySQL 4.1 to 5.0

2007-02-26 Thread Micah Stevens

Read the docs:

http://dev.mysql.com/doc/refman/5.0/en/upgrade.html



On 02/26/2007 01:31 PM, [EMAIL PROTECTED] wrote:

Dear All,

I want to upgrade database MySQL 4.1 to 5.0.
What's will effects my PHP 5.0.4 script if I do that?


Thanks  Regards, 
 
NUR ANITA ADMAN
IT System Analyst 
PT. Trakindo Utama KKCRC

Jl. Kuala Tembaga Lot E-3 Light Industrial Park (LIP)
Kuala Kencana - Timika
99920 - Papua

  


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



Re: [PHP-DB] SQL Query - Using variable from another SQL Query

2007-02-12 Thread Micah Stevens
This is a join - Read up on them, they're very useful and don't require 
the overhead of a sub-query.



SELECT egw_cal.* FROM egw_cal_dates
LEFT JOIN egw_cal using (cal_id)
 where egw_cal_dates.cal_start  $tstamp
 AND egw_cal.cal_category = '501'



-Micah


On 02/12/2007 08:14 AM, Matthew Ferry wrote:

Hello Everyone

Got a simple / stupid question.
Worked on this all night. I'm over looking something very basic here.

The query event_time brings back the calendar id for each event that is 
pending in the future.
ie 12, 13, 14, 26  (There could be 100 of them out there)

The second query events needs to meet both reqirements.  
 1 - cal_category='501' 
 2 - cal_id= a number from the event_time query


I think i need to do a loop inside of a loop

Thanks...

Matt 



Here is my code: 


?php

$todays_year = date(Y);

$todays_month = date(m);

$todays_day = date(d);

$tstamp = mktime(0, 0, 0, $todays_month, $todays_day, $todays_year);

$event_time = mysql_query(SELECT cal_id FROM egw_cal_dates where cal_start  
$tstamp, $db);

$events = mysql_query(SELECT * FROM egw_cal WHERE cal_category='501' and 
cal_id='$event_time'\n, $db);



if ($event = mysql_fetch_array($events)) {

echo center\n;

echo HR\n;

do {

echo BFont 
Size='10'$event[cal_title]nbsp;nbsp;nbsp;nbsp;-nbsp;nbsp;nbsp;$event[cal_location]/B/Font\n;

echo BR\n;

echo $event[cal_description];

echo BR\n;

echo HR\n;

} while ($event = mysql_fetch_array($events));

} else {

echo No Public Events Are Currently Scheduled...;

}

?


  


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



Re: [PHP-DB] Search witin text.

2007-02-10 Thread Micah Stevens
Send your query out on the list. That would give us something to work 
on. This should be very easy..


select * from tablename where column like '%$search%'

or something of that nature. What are you doing?

-Micah

On 02/10/2007 08:49 PM, Chris Carter wrote:

Hi,

I have to send results to the users based on their search. Have got a
combined serach option in which data is searched from two different fields
and based on the match the result is sent or an error message (quite
simple). Now I need to change this, the one column of data is from a VARCHAR
field and have to seach for a perticular text from another column that is
TEXT. So there could be data like Apparel | Footwear | Toys | Watches. If
the data matches the Toys the result is sent. The issue I have is quite
simple, its not working. Is there anything special that needs to be done
with the TEXT column?

Please advice, many thanks.

Chris
  


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



Re: [PHP-DB] indexing error - key length not specified

2007-02-09 Thread Micah Stevens

You can't use that column type as an index because it's variable length.

Make it a varchar or something that's definite to index it.

-Micah

On 02/09/2007 03:56 PM, John Pillion wrote:

I am trying to set an index on a field in my table, but am getting the
following error:

 


BLOB column 'ReadBy' used in key specification without a key length

 


The fieldtype is blob, though I get the same error whether blob or text, or
the medium and long versions of each.  My first though, based on the error,
was I needed to set a length to the field - but it won't accept/store any
length I give it (because it's a variable length?)

 


I'm using mysql on from 1and1 (hosting provider), though I don't know what
version they're running

 


.. any thoughts?

 

 


As an alternative, how much less efficient would it be to do a .LIKE
'%mystring%' versus a MATCH..?

 

 



  


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



Re: [PHP-DB] indexing error - key length not specified

2007-02-09 Thread Micah Stevens
Perhaps I should of spoke more exactly. In MySQL 5.0 you can index 
these, but the maximum index length is limted by the storage engine. So 
you have to be specific as to how you index these columns.


The deal is that with large column fields making an index of several 
thousand characters (for example) doesn't help you that much, the index 
gets as big as the field (comparatively) and the performance gains from 
having an index is marginal, as I understand it. (an expert is free to 
jump in at this point)


So one might want to analyze why you're indexing this field at all. 
Perhaps something specialized like a fulltext index is more appropriate.


Take a look at this page in the docs: 
http://dev.mysql.com/doc/refman/5.0/en/indexes.html


It explains it somewhat. You can as it mentions specify the index size 
which the db should take, but you'll be indexing a subset of the actual 
data with the col_name() style of statement.


In my opinion, you might want to take a look at why you want to index 
such a large column, I don't see a reason myself unless it's something 
like a fulltext index.


I hope that helps,
-Micah

On 02/09/2007 04:59 PM, John wrote:

Micah,


  

You can't use that column type as an index because it's variable length.



Makes sense.


  

Make it a varchar or something that's definite to index it.



It is possible the value stored can reach up to about 2k characters, which
is too long for a varchar type.  Any recommendations as to what type to use
that wouldn't be variable length, but be able to store strings/values of
that size?

Thanks!

John

-Original Message-
From: Micah Stevens [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 09, 2007 6:29 PM

To: John Pillion
Cc: php-db@lists.php.net
Subject: Re: [PHP-DB] indexing error - key length not specified

You can't use that column type as an index because it's variable length.

Make it a varchar or something that's definite to index it.

-Micah

On 02/09/2007 03:56 PM, John Pillion wrote:
  

I am trying to set an index on a field in my table, but am getting the
following error:

 


BLOB column 'ReadBy' used in key specification without a key length

 


The fieldtype is blob, though I get the same error whether blob or text,


or
  

the medium and long versions of each.  My first though, based on the


error,
  

was I needed to set a length to the field - but it won't accept/store any
length I give it (because it's a variable length?)

 


I'm using mysql on from 1and1 (hosting provider), though I don't know what
version they're running

 


.. any thoughts?

 

 


As an alternative, how much less efficient would it be to do a .LIKE
'%mystring%' versus a MATCH..?

 

 



  



  


Re: [PHP-DB] MYSQL REGEXP question

2007-01-10 Thread Micah Stevens


No, it shouldn't because there are only two B's, one is followed by a 
'v' (one of your exceptions) and the other is at the end of the line, right?


-Micah

Mike van Hoof wrote:

That is it almost :)

SELECT 'oer bv b' REGEXP 'b[^v]$|b[^v]\s?';

gives me 0 as a result, while it shoud give me 1, because there is a b 
in there which is not bv.


Mike

Medusa, Media Usage Advice B.V.
Science Park Eindhoven 5216
5692 EG SON
tel: 040-24 57 024  fax: 040-29 63 567
url: www.medusa.nl
mail: [EMAIL PROTECTED]

Uw bedrijf voor Multimedia op Maat



Micah Stevens schreef:


Your code states:

Match: one of the following letters: -,b,|,^,b negative look ahead 
one of these: -,v,$,|,v


Which isn't what you're looking for. Remember the negating '^' only 
works at the start of a [] list. And '$' only means line-end if it's 
outside [], inside it stands for the '$' character.


I think this would work better:


b[^v]$|b[^v]\s?

HTH,
-Micah

[EMAIL PROTECTED] wrote:

Hello,

i am try to make a regular expression work, but keep getting an 
error message

does anyone know how i can make it work?
The query is:

SELECT 'boer bv' REGEXP '[ b|^b](?![v$|v ])';

So it has to match each starting 'b' and all the b's pf following 
words. But now followed by a v(line end) or a v followed by a space.


so it should match:

'b test'
'test b'
'test b bv'
'bv b test'

and NOT

'test bv'
'bv test'

Any idea's?!

Thanks, mike

  
 



AdmID:FB05127CFE0569CA76887DED108E0F2F



**

IMPORTANT NOTICE

This communication is for the exclusive use of the intended 
recipient(s)

named above. If you receive this communication in error, you should
notify the sender by e-mail or by telephone (+44) 191 224 4461, delete
it and destroy any copies of it.

This communication may contain confidential information and material
protected by copyright, design right or other intellectual property
rights which are and shall remain the property of Piranha Studios
Limited. Any form of distribution, copying or other unauthorised use 
of this communication or the information in it is strictly 
prohibited. Piranha Studios Limited asserts its rights in this 
communication and the information in it and reserves the right to 
take action against anyone who misuses it or the information in it.


Piranha Studios Limited cannot accept any liability sustained as a 
result of software viruses and would recommend that you carry out your

own virus checks before opening any attachment.

 


GWAVAsig
  






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

Re: [PHP-DB] MYSQL REGEXP question

2007-01-09 Thread Micah Stevens


Your code states:

Match: one of the following letters: -,b,|,^,b negative look ahead one 
of these: -,v,$,|,v


Which isn't what you're looking for. Remember the negating '^' only 
works at the start of a [] list. And '$' only means line-end if it's 
outside [], inside it stands for the '$' character.


I think this would work better:


b[^v]$|b[^v]\s?

HTH,
-Micah

[EMAIL PROTECTED] wrote:

Hello,

i am try to make a regular expression work, but keep getting an error 
message

does anyone know how i can make it work?
The query is:

SELECT 'boer bv' REGEXP '[ b|^b](?![v$|v ])';

So it has to match each starting 'b' and all the b's pf following words. 
But now followed by a v(line end) or a v followed by a space.


so it should match:

'b test'
'test b'
'test b bv'
'bv b test'

and NOT

'test bv'
'bv test'

Any idea's?!

Thanks, mike

  



AdmID:FB05127CFE0569CA76887DED108E0F2F



**

IMPORTANT NOTICE

This communication is for the exclusive use of the intended recipient(s)
named above. If you receive this communication in error, you should
notify the sender by e-mail or by telephone (+44) 191 224 4461, delete
it and destroy any copies of it.

This communication may contain confidential information and material
protected by copyright, design right or other intellectual property
rights which are and shall remain the property of Piranha Studios
Limited. Any form of distribution, copying or other unauthorised use 
of this communication or the information in it is strictly prohibited. 
Piranha Studios Limited asserts its rights in this communication and 
the information in it and reserves the right to take action against 
anyone who misuses it or the information in it.


Piranha Studios Limited cannot accept any liability sustained as a 
result of software viruses and would recommend that you carry out your

own virus checks before opening any attachment.


GWAVAsig
  




Re: [PHP-DB] Distinct Partial Matches: RegExp

2006-08-30 Thread Micah Stevens


Select DISTINCT area from table like '$searchterms%';

In SQL, you can use the 'LIKE' keyword along with the '%' and '_' 
wildcards.. '_' is one character, '%' is any number of chars.


-Micah


Kevin Murphy wrote:
This might be really easy, but I'm just not sure how to write this 
query and my searching on google isn't finding me things, probably 
because I am searching for the wrong terms.


I have a bunch of records where the area column is like:

animal-dog-5
animal-dog-3
animal-cat-1
animal-cat-22
animal-bird-5

What I want to do is run a distinct query on just the part previous to 
the number.


animal-dog
animal-cat
animal-bird

So in other words, something like this, but I am not sure if this is 
the right way to go:


$query = SELECT DISTINCT area FROM table WHERE REGEXP 
'anynumberofletters dash anynumberofletters dash '



Of course, I could be barking up the wrong tree with the REGEXP thing. 
Anyone care to point me in the right direction?



--Kevin Murphy
Webmaster: Information and Marketing Services
Western Nevada Community College
www.wncc.edu
775-445-3326




--Kevin Murphy
Webmaster: Information and Marketing Services
Western Nevada Community College
www.wncc.edu
775-445-3326





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



Re: [PHP-DB] Distinct Partial Matches: RegExp

2006-08-30 Thread Micah Stevens


Oh! I misunderstood..

This is tougher, you're selecting the entire set, so you won't have 
anything after 'WHERE', but you're defining how the returned items are 
formatted, this goes before table selection:


Select DISTINCT SUBSTRING_INDEX(`area`, '-', 2) from table;

I didn't test this, but it should work. Look up SUBSTRING_INDEX in the 
docs..


-Micah

Kevin Murphy wrote:
Well, its not really a search that would be way easier. :-) What 
I'm looking for is a query that will give me the complete list of 
items that are distinct, minus the last number after the last hyphen.


animal-dog
animal-cat
animal-bird

--Kevin Murphy
Webmaster: Information and Marketing Services
Western Nevada Community College
www.wncc.edu
775-445-3326


On Aug 30, 2006, at 4:34 PM, Micah Stevens wrote:



Select DISTINCT area from table like '$searchterms%';

In SQL, you can use the 'LIKE' keyword along with the '%' and '_' 
wildcards.. '_' is one character, '%' is any number of chars.


-Micah


Kevin Murphy wrote:
This might be really easy, but I'm just not sure how to write this 
query and my searching on google isn't finding me things, probably 
because I am searching for the wrong terms.


I have a bunch of records where the area column is like:

animal-dog-5
animal-dog-3
animal-cat-1
animal-cat-22
animal-bird-5

What I want to do is run a distinct query on just the part previous 
to the number.


animal-dog
animal-cat
animal-bird

So in other words, something like this, but I am not sure if this is 
the right way to go:


$query = SELECT DISTINCT area FROM table WHERE REGEXP 
'anynumberofletters dash anynumberofletters dash '



Of course, I could be barking up the wrong tree with the REGEXP 
thing. Anyone care to point me in the right direction?



--Kevin Murphy
Webmaster: Information and Marketing Services
Western Nevada Community College
www.wncc.edu
775-445-3326




--Kevin Murphy
Webmaster: Information and Marketing Services
Western Nevada Community College
www.wncc.edu
775-445-3326










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



Re: [PHP-DB] Distinct Partial Matches: RegExp

2006-08-30 Thread Micah Stevens


You can do regular expression matching in MySQL and I think a few other 
servers too, but that's not the same as regular expression replacement 
like you can do with PHP.. It just returns a boolean true/false 
depending on whether or not the match works.


-Micah

J R wrote:

i'm a bit confused. if i'm getting you right heres my 2 cents:

first you do sql query using DISTINCT

when the result are returned to you, you can then run thru the result 
array

using preg_replace. heres an example:

$aVar= array(
   'animal-dog-5',
   'animal-dog-3',
   'animal-cat-1',
   'animal-cat-22',
   'animal-bird-5',
   );

$aResult= array();
foreach ($aVar as $value) {
   $tmp= preg_replace('/-\d*$/', '', $value);
   $aResult[$tmp]= $tmp;
   // if you want to conserve a bit of resources asign NULL;
   // $aResult[$tmp]= NULL;
}
var_dump($aResult);


hth,

john

p.s.
i'm not sure if it is possible to use regular expression in a sql 
query. can

anyone comment on this? thanks.

On 8/31/06, Kevin Murphy [EMAIL PROTECTED] wrote:


Well, its not really a search that would be way easier. :-) What
I'm looking for is a query that will give me the complete list of
items that are distinct, minus the last number after the last hyphen.

animal-dog
animal-cat
animal-bird

--
Kevin Murphy
Webmaster: Information and Marketing Services
Western Nevada Community College
www.wncc.edu
775-445-3326


On Aug 30, 2006, at 4:34 PM, Micah Stevens wrote:


 Select DISTINCT area from table like '$searchterms%';

 In SQL, you can use the 'LIKE' keyword along with the '%' and '_'
 wildcards.. '_' is one character, '%' is any number of chars.

 -Micah


 Kevin Murphy wrote:
 This might be really easy, but I'm just not sure how to write this
 query and my searching on google isn't finding me things, probably
 because I am searching for the wrong terms.

 I have a bunch of records where the area column is like:

 animal-dog-5
 animal-dog-3
 animal-cat-1
 animal-cat-22
 animal-bird-5

 What I want to do is run a distinct query on just the part
 previous to the number.

 animal-dog
 animal-cat
 animal-bird

 So in other words, something like this, but I am not sure if this
 is the right way to go:

 $query = SELECT DISTINCT area FROM table WHERE REGEXP
 'anynumberofletters dash anynumberofletters dash '


 Of course, I could be barking up the wrong tree with the REGEXP
 thing. Anyone care to point me in the right direction?


 --Kevin Murphy
 Webmaster: Information and Marketing Services
 Western Nevada Community College
 www.wncc.edu
 775-445-3326




 --Kevin Murphy
 Webmaster: Information and Marketing Services
 Western Nevada Community College
 www.wncc.edu
 775-445-3326












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



Re: [PHP-DB] Submitting form from a href

2006-07-14 Thread Micah Stevens


A little javascript would do it.. like so:

a href=Javascript: getElementById('letterpressed').value = 'A'; 
getElementById('thisform').submit; void 0;A/a

!-- Repeat for each letter --

form action=target.php id=thisform
input type=hidden id=letterpressed name=letterpressed value=
input type=checkbox name=campuses Check for all campuses
/form


Then you have a $_POST that contains both.

-Micah

Skip Evans wrote:

Hey all,

This is not database related, but I get the impression this list 
entertains general PHP questions? If I'm mistaken, flame away.


I need submit a form when a hyper link is pressed, and have been 
trying all manner of onlicks, etc, but have been unable to hit the 
right combination.


Here's the scenario:

I have the alphabet in hyper links with a check box below:


form...
A B C D E F G H I J K.

[] check for all campuses
/form

What needs to happen is that when they click a letter, which is a a 
href=... now, it submits the check box value as well, to be read 
through $_POST on the receiving end.


And of course I need to know what letter was click, this I was trying 
to get through a $_REQUEST var, but was not able to do so.


Any tips would be monstrously appreciated.


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



Re: [PHP-DB] Generating forms and form elements

2006-06-20 Thread Micah Stevens


Hi Mark,

No problem!

There as always are many ways to accomplish this, and this sounds like 
this will be largely an exercise in Javascript, but on the PHP/SQL side 
you'll just need to design a table where rows correspond to information 
that pertains to the whole form (username or ID, title, stuff like that) 
and then a second table that corresponds to form fields for the form, 
and are linked via an ID field. I do a similar thing for some shopping 
cart software that allows the administrator to build custom forms to 
collect information for particular items for sale. It works pretty well. 
Is there something in particular you're struggling with or does this help?


The hard part I think will be associating the javascript drag/drop 
events with information storage in the database. This to me would work 
well with a small javascript routine that will upon dropping call 
XMLRequest to a server side script that will update the table 
immediatly. Then you don't have to mess with some grotesque hidden form 
madness to keep track of what the user wants.


-Micah


Mark Fellowes wrote:



Micah, Thanks for the reply. I didn't see it earlier. Also my 
apologies for the vagueness but right now things are somewhat vauge.


Let me try and explain better:


To start I'll paint a visual to explain it better. Ultimately I know 
this will require additional tables (will get to that in a moment)



When the page loads, there is going to be a palette area where form 
fields of various types will be sitting. They will not be in a form. 
The form will sit in another part of the page in it's own div. So to 
start the table all that should be generated into that palette area 
will be the form elements (selects, checkboxes, radio buttons, etc). 
I'm thinking php will be used to pull the markup out of the table and 
into the palette.



Users can drag and drop form elements into the form. They can edit the 
elements in there (i.e. length of field, label name, required field, 
etc). At that point the chosen elements (the ones now in the form) 
should be pumped back into another table where a name column will save 
the form intact with all it's elements.



Hope this gives a better idea of what Im trying to acheive.

Mark


-Original Message-

From: [EMAIL PROTECTED]

Sent: Tuesday, June 20, 2006 4:01 PM -07:00

To: Mark Fellowes [EMAIL PROTECTED]

Subject: [PHP-DB] Generating forms and form elements

Hi Mark,


That's pretty vague, there's probably 1000 ways to do this. Are you just

intending to store the HTML in a text field, or generate the form fields

based on data so that the user can edit the data? Are you storing just

data in the database, or the form structure? Also if it's structure, do

you intend on storing formatting information, or just the form fields

themselves.


If you sit down and draw up a detailed non-code plan, the solution would

likely present itself.


-Micah

!DSPAM:4498548e259778165356420! 




Re: [PHP-DB] Generating forms and form elements

2006-06-20 Thread Micah Stevens

Stut wrote:

Micah Stevens wrote:

Stut wrote:

Bastien Koert wrote:
Not commenting on the appropriateness or security of the eval 
function. Merely offering a possible path. It is up to the OP to 
decide if that solution is the correct one.


I would accept that if you'd mentioned, or at least hinted at the 
issues that need to be addressed when using eval. You didn't so I 
thought it needed to be pointed out. I think we, as a community, 
have a responsibility to point out the potential security and 
stability pitfalls of the possible solutions we provide. But that's 
just me.


Last time I handed someone a rope, I didn't tell them to not hang 
themselves. :)


Then you assumed they knew what a rope was and that it's generally a 
bad idea to use it to suspend themselves in the air by their neck. 
Likewise you assumed the OP knew that eval was dangerous.


-Stut

Exactly.

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



Re: [PHP-DB] Linux Commands

2006-06-05 Thread Micah Stevens
Just trying to answer Manoj's question, and making a comment about the 
OT nature of his question. I don't really care, this list is pretty 
infrequent anyhow, but it is PHP-DB, not PHP-OS. :)


-Micah

Colin Ross wrote:

With that said, are you asking about how to execute system comands
with sql? (reaching...) or is this just OT...

On 6/3/06, Micah Stevens [EMAIL PROTECTED] wrote:

http://us3.php.net/exec

I thought this was a database list?

-Micah

Manoj Singh wrote:
 Hello All,

 Is it possible to run the Linux Commands through php functions or 
code?


 If anyone knows, please help me out.

 Regards
 Manoj


 

--
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] Linux Commands

2006-06-03 Thread Micah Stevens

http://us3.php.net/exec

I thought this was a database list?

-Micah

Manoj Singh wrote:

Hello All,

Is it possible to run the Linux Commands through php functions or code?

If anyone knows, please help me out.

Regards
Manoj


!DSPAM:44813dab14511796716657!



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



Re: [PHP-DB] Dynamic DataBinding in Form

2006-04-30 Thread Micah Stevens
Not quite sure what you're asking, but I think you mean, you want to 
automatically fill customer with the concat'd values of FName and LName..


You can do this with PHP, but only once the form is submitted (remember, 
PHP is server side) if you want to do it in the browser in front of the 
user, you'll need some Javascript.. which is a bit off topic for this list.


The general idea though would be to set an onChange handler for the 
FName and LName fields, and when it's triggered just update the other value:


document.getElementById('CUSTOMER').value = 
document.getElementById('FName').value + ' ' + 
document.getElementById('LName').value;


or something like that.

-Micah
JONATHAN GRAVOIS wrote:

I have an INSERT form with several fields two of which are FName and LName.
There is also a field named CUSTOMER which is the concatenation of those two
fields separated by a space. Is there a way to fill in customer as the user
types in the other two fields. I used to do this in Coldfusion; can I do it
with PHP?

Thanks,
Jon

  



!DSPAM:4454ea70151712219219257!

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



Re: [PHP-DB] flash/php problem

2006-03-11 Thread Micah Stevens
On Friday 10 March 2006 6:24 pm, Anthony Lee wrote:
  Actually, I don't see why either method would work:

 The SWF is in a static HTML page. It requests an mp3, and loads it without
 having to refresh. So it needs an mp3 returned, not another SWF.

 Updating the DB from the SWF call sounds cool, but serverside wise
 requires the
 .htaccess updated to instruct .swf requests from that dir to be read as
 PHP. The PHP script would need to update the DB then open the mp3 and write
 the correct headers before returning it.

In my example the PHP is not streaming the mp3 to the flash file, it's merely 
passing on a URL. I think  you're really misunderstanding what I was 
attempting to say. So you don't need to open any mp3 in the php file, nor 
return any mp3 information. 

Although, now that you bring it up, that would be one way to do it, but I 
wouldn't because that would introduce a much larger system load. 

Just call the php, and then the php calls the SWF. Simple as that. 

-Micah 


  What's the AMFPHP deal?

 Flash Remoting. Action Message Format. Like SOAP but better :D

 Tony

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



Re: [PHP-DB] Excel to CSV

2006-03-11 Thread Micah Stevens

I've never used it, but: 

http://sourceforge.net/projects/phpexcelreader/

-Micah 


On Saturday 11 March 2006 5:53 am, [EMAIL PROTECTED] wrote:
 The other response is half correct..   I havn't seen anything to read data
 from Excel with PHP (although it's technically possible, just kind of
 complicated) so the easiest solution is to use Excel and just have it load
 the file and save it in CSV format.

 The part that's not entirely correct is the PHP can't talk to Excel part.
  It's cumbersome, but PHP can use a COM connection to control Excel (or
 Word or MapPoint or Access or Outlook..etc).  This means you'd have to have
 Excel loaded on the server that was running PHP, which may not be an
 option.

 For an example of PHP + COM with Excel, check out:

 http://www.php.net/manual/en/class.com.php

 Look down the page for the entry posted by flintjt at hotmail dot com

 If COM doesn't work for you and you don't mind getting your hands dirty, I
 believe you can get the Excel file format spec.. maybe through the
 OpenOffice sources.. and figure out how to read XLS files that way.

 The Excel Object Model might help you with the proper
 properties/methods/etc:
 http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_wrcore/
html/wrgrfexcelworkbookobject.asp

 Good luck.

 -TG

 = = = Original message = = =

 Dear All,

 Have you any script/example how to Save As Excel file to CSV using PHP?

 Thanks  Regards,

 Anita

 ___
 Sent by ePrompter, the premier email notification software.
 Free download at http://www.ePrompter.com.

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



Re: [PHP-DB] unescape a string

2006-03-11 Thread Micah Stevens



On Saturday 11 March 2006 6:11 am, Ludvig Ericson wrote:
 http://uk2.php.net/stripslashes


This would partially unescape it, but mysql_escape_string does more than just 
add slashes to a string. 

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



Re: [PHP-DB] Passwords

2006-03-10 Thread Micah Stevens
On Friday 10 March 2006 7:09 am, Michael Crute wrote:
 On 3/10/06, Dusty Bin [EMAIL PROTECTED] wrote:
  One thing to remember, is that the password function is MySQL's way of
  storing passwords for MySQL use, and that may change from one release of
  MySQL to another.  This happened very recently.  If you want to store
  application passwords, it is better to use a hash, and be independent of
  MySQL changes.  I use sha1 as I believe it *may* be stronger than MD5(I
  am not a cryptographer), so I store my password as:
 $passwordToBeStored = sha1($password);
  and check the password as:
 If(sha1($password) == $storedPassword) {
 ...
 }
  HTH... Dusty

 Just a note, I would never compare passwords like that, you should put
 sha1($password) in your SQL string as a condition and check to see if
 any rows where returned.

 -Mike

It doesn't matter if you have an SSL link to the database. :) 

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



Re: [PHP-DB] flash/php problem

2006-03-09 Thread Micah Stevens

Actually, I don't see why either method would work:

1) Call php, which updates, then calls swf. 

or

2) Call swf, which calls php to make update.

No difference, both ways the job gets done.. What's the AMFPHP deal? I'll have 
to take a look at that.. 

-Micah

On Wednesday 08 March 2006 11:23 pm, Anthony Lee wrote:
  query(update hitcounter set plays = plays+1 where file =
  {$_GET['file']}); header(Location: play.swf?file={$_GET['file']});

 Sorry I didn't read this thread thoroughly enough. This looks like a good
 solution to me.

 You just need to have the swf make the request and return the mp3 to
 the swf not
 a reference to another swf.

 query(update hitcounter set plays = plays+1 where file =
 {$_GET['file']}); if (!error) header(Location: {$_GET['file']}.mp3);

 Tony

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



Re: [PHP-DB] flash/php problem

2006-03-09 Thread Micah Stevens

Or rather, 'wouldn't work'.. my negatives are always screwey before 8.. 

On Thursday 09 March 2006 7:07 am, Micah Stevens wrote:
 Actually, I don't see why either method would work:

 1) Call php, which updates, then calls swf.

 or

 2) Call swf, which calls php to make update.

 No difference, both ways the job gets done.. What's the AMFPHP deal? I'll
 have to take a look at that..

 -Micah

 On Wednesday 08 March 2006 11:23 pm, Anthony Lee wrote:
   query(update hitcounter set plays = plays+1 where file =
   {$_GET['file']}); header(Location: play.swf?file={$_GET['file']});
 
  Sorry I didn't read this thread thoroughly enough. This looks like a good
  solution to me.
 
  You just need to have the swf make the request and return the mp3 to
  the swf not
  a reference to another swf.
 
  query(update hitcounter set plays = plays+1 where file =
  {$_GET['file']}); if (!error) header(Location: {$_GET['file']}.mp3);
 
  Tony

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



Re: [PHP-DB] flash/php problem

2006-03-08 Thread Micah Stevens

Just an update to the DB on each swf load is what it seems he wants. 

On Wednesday 08 March 2006 7:13 pm, Anthony Lee wrote:
 This question isn't really a PHP-DB thang is it?

 Anyway, it sounds like you have a lot of swfs on the page. One for each
 song, is
 that right? In that case your best bet would be something like what you
 already
 have:

 embed src='play.swf?ID=74...'

 i.e. push the variable into flash from the page that contains it. If you
 only have a small amount of info the swf needs you can just keep on with
 the theme

 ID=74URL=yourmama.comTITLE=YoMama etc.

 If you want to pull a lot more information from the DB after the page
 has loaded
 then you should take a look at PHPObject or AMFPHP. Hint, AMFPHP is a lot
 more robust and faster.

 And don't forget that you need to write the vars to a Param tag too.

 Tony

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



Re: [PHP-DB] X Tiger 10.4.5 + phpBB2 + MySQL 5 + Can't Connect Issue!

2006-03-06 Thread Micah Stevens

Is there really a .sock file where you're telling php there is? MySQL can put 
the socket file anywhere you want depending on it's 
configuration. /etc/my.cnf should specify this. 

-Micah 


On Monday 06 March 2006 9:08 am, m i l e s wrote:
 Hi,

 Im getting the following: Warning: mysql_connect(): Can't connect to
 local MySQL server through socket...etc.

 NOTES:

 1.) MySQL 5 is running fine.
 2.) Im able to connect to it via Navicat.
 3.) I run Lasso on the same host, I know that I can pull and post
 data to and from MySQL. So its NOT mysql. Its PHP.

 I ran across a few postings from Apple and others that had SIMILAR
 problems, however those solutions are for MySQL 4 not MySQL 5. Seems
 to be bit of confusion about how to solve this problem. I tried what
 apple suggested...and that FAILED:

 http://docs.info.apple.com/article.html?artnum=301457

 So now Im asking you good people, who actually BUILT the damn...ahem
 wrote the software. Im at whits end and I need to get this up and
 running.

 All I did was update from 10.4.4 to 10.4.5 and now PHP will not talk
 to MySQL at all. Ok...so what's the solution folks ? Anyone ?
 Buehler ? Buehler 

 Thanks ahead of time

 M i l e s.

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



Re: [PHP-DB] Help needed creating a social network

2006-03-06 Thread Micah Stevens

CREATE TABLE `users` (userID int(11) not null auto_increment, primary 
key(userID), name tinytext not null, email tinytext not null);

CREATE TABLE `links` (userID int(11), key (userID), friendID int(11), 
key(friendID));

?php
$friends = mysql_query(select users.name, users.userID from users left join 
links on links.friendID = users.userID where links.userID = 
{$_GET['userID']});

echo h1You have friends!!/h1;
while ($f = mysql_fetch_assoc($friends)) {
echo a 
href='socialnetwork.php?userID={$f['userID']}'{$f['name']}/abr\n;
}

publish();
profit($greatly);
do (!$use) {
coldfusion('Cause it sucks');
}
?

(har har) 







On Monday 06 March 2006 9:47 pm, Daevid Vincent wrote:
 Anyone have some pointers at a HowTo on creating a social network?

 Basically I need to show people in your immediate network, and also friends
 of your friends, etc... Like the whole 'six degrees of separation' thing.
 Ala: myspace, friendster, etc. ad nauseum.

 I prefer mySQL and PHP, but I could port from most any code. I guess I'm
 mostly interested in the theory of this an how do I set up the tables
 properly and what is the magic incantation (JOIN) to get this chain of
 people.

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



Re: [PHP-DB] Where did my Hard Returns go?

2006-03-01 Thread Micah Stevens

list() is a language construct. 

On Wednesday 01 March 2006 9:18 am, Philip Pryce wrote:
 You can't assign a value to a function!
 that is actually incorrect, the list(); function assigns a value to a
 functions vars.

 --
 ~Philip Pryce

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



Re: [PHP-DB] Duplicate rows

2006-03-01 Thread Micah Stevens

SELECT DISTINCT * FROM `tablename`


On Wednesday 01 March 2006 7:24 am, Miguel Guirao wrote:
 My dear beloved friends,

 I have a catalog of products that a product provider gave, sadly for me, in
 this CSV file there are many duplicated rows.
 I edited the file in my Linux system with the uniq -u command, and it
 worked somewhat fine, it eliminated some duplicated rows, originally the
 file had 24K rows, and now it has been reduced to 15k rows.

 Anyhow, there are still duplicated rows, and since this is a catalog, it
 should not have duplicated rows!!!
 Now the catalog has been has been loaded into the DB.

 How can I continue eliminating duplicated rows?
 As far as I remember the is a sentence in SQL to only show ONE row of
 duplicated rows, maybe if I do a select using this sentence and then put
 this new recordset in another table, it will work!!

 Any ideas?

 ---
 Miguel Guirao Aguilera
 Logistica R8 TELCEL
 Tel. (999) 960.7994


 Este mensaje es exclusivamente para el uso de la persona o entidad a quien
 esta dirigido; contiene informacion estrictamente confidencial y legalmente
 protegida, cuya divulgacion es sancionada por la ley. Si el lector de este
 mensaje no es a quien esta dirigido, ni se trata del empleado o agente
 responsable de esta informacion, se le notifica por medio del presente, que
 su reproduccion y distribucion, esta estrictamente prohibida. Si Usted
 recibio este comunicado por error, favor de notificarlo inmediatamente al
 remitente y destruir el mensaje. Todas las opiniones contenidas en este
 mail son propias del autor del mensaje y no necesariamente coinciden con
 las de Radiomovil Dipsa, S.A. de C.V. o alguna de sus empresas controladas,
 controladoras, afiliadas y subsidiarias. Este mensaje intencionalmente no
 contiene acentos.

 This message is for the sole use of the person or entity to whom it is
 being sent.  Therefore, it contains strictly confidential and legally
 protected material whose disclosure is subject to penalty by law.  If the
 person reading this message is not the one to whom it is being sent and/or
 is not an employee or the responsible agent for this information, this
 person is herein notified that any unauthorized dissemination, distribution
 or copying of the materials included in this facsimile is strictly
 prohibited.  If you received this document by mistake please notify 
 immediately to the subscriber and destroy the message. Any opinions
 contained in this e-mail are those of the author of the message and do not
 necessarily coincide with those of Radiomovil Dipsa, S.A. de C.V. or any of
 its control, controlled, affiliates and subsidiaries companies. No part of
 this message or attachments may be used or reproduced in any manner
 whatsoever.

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



Re: [PHP-DB] Duplicate rows

2006-03-01 Thread Micah Stevens

Ahh, good point, yes, keep in mind you may have some index rows.. 

On Wednesday 01 March 2006 10:18 am, [EMAIL PROTECTED] wrote:
 Haha.. oh yeah.. DISTINCT works too..  in this case you'd get a list of all
 totally 100% unique records.

 If you had an auto_increment column though, you'd want to exclude it from
 the list.

 -TG

 = = = Original message = = =

 SELECT DISTINCT * FROM `tablename`

 On Wednesday 01 March 2006 7:24 am, Miguel Guirao wrote:
  My dear beloved friends,
 
  I have a catalog of products that a product provider gave, sadly for me,
  in this CSV file there are many duplicated rows.
  I edited the file in my Linux system with the uniq -u command, and it
  worked somewhat fine, it eliminated some duplicated rows, originally the
  file had 24K rows, and now it has been reduced to 15k rows.
 
  Anyhow, there are still duplicated rows, and since this is a catalog, it
  should not have duplicated rows!!!
  Now the catalog has been has been loaded into the DB.
 
  How can I continue eliminating duplicated rows?
  As far as I remember the is a sentence in SQL to only show ONE row of
  duplicated rows, maybe if I do a select using this sentence and then put
  this new recordset in another table, it will work!!
 
  Any ideas?
 
  ---
  Miguel Guirao Aguilera
  Logistica R8 TELCEL
  Tel. (999) 960.7994
 
 
  Este mensaje es exclusivamente para el uso de la persona o entidad a
  quien esta dirigido; contiene informacion estrictamente confidencial y
  legalmente protegida, cuya divulgacion es sancionada por la ley. Si el
  lector de este mensaje no es a quien esta dirigido, ni se trata del
  empleado o agente responsable de esta informacion, se le notifica por
  medio del presente, que su reproduccion y distribucion, esta
  estrictamente prohibida. Si Usted recibio este comunicado por error,
  favor de notificarlo inmediatamente al remitente y destruir el mensaje.
  Todas las opiniones contenidas en este mail son propias del autor del
  mensaje y no necesariamente coinciden con las de Radiomovil Dipsa, S.A.
  de C.V. o alguna de sus empresas controladas, controladoras, afiliadas y
  subsidiarias. Este mensaje intencionalmente no contiene acentos.
 
  This message is for the sole use of the person or entity to whom it is
  being sent.  Therefore, it contains strictly confidential and legally
  protected material whose disclosure is subject to penalty by law.  If the
  person reading this message is not the one to whom it is being sent
  and/or is not an employee or the responsible agent for this information,
  this person is herein notified that any unauthorized dissemination,
  distribution or copying of the materials included in this facsimile is
  strictly prohibited.  If you received this document by mistake please
  notify immediately to the subscriber and destroy the message. Any
  opinions contained in this e-mail are those of the author of the message
  and do not necessarily coincide with those of Radiomovil Dipsa, S.A. de
  C.V. or any of its control, controlled, affiliates and subsidiaries
  companies. No part of this message or attachments may be used or
  reproduced in any manner whatsoever.

 ___
 Sent by ePrompter, the premier email notification software.
 Free download at http://www.ePrompter.com.

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



Re: [PHP-DB] Duplicate rows

2006-03-01 Thread Micah Stevens
err columns.. sorry.. 

On Wednesday 01 March 2006 10:45 am, Micah Stevens wrote:
 Ahh, good point, yes, keep in mind you may have some index rows..

 On Wednesday 01 March 2006 10:18 am, [EMAIL PROTECTED] wrote:
  Haha.. oh yeah.. DISTINCT works too..  in this case you'd get a list of
  all totally 100% unique records.
 
  If you had an auto_increment column though, you'd want to exclude it from
  the list.
 
  -TG
 
  = = = Original message = = =
 
  SELECT DISTINCT * FROM `tablename`
 
  On Wednesday 01 March 2006 7:24 am, Miguel Guirao wrote:
   My dear beloved friends,
  
   I have a catalog of products that a product provider gave, sadly for
   me, in this CSV file there are many duplicated rows.
   I edited the file in my Linux system with the uniq -u command, and it
   worked somewhat fine, it eliminated some duplicated rows, originally
   the file had 24K rows, and now it has been reduced to 15k rows.
  
   Anyhow, there are still duplicated rows, and since this is a catalog,
   it should not have duplicated rows!!!
   Now the catalog has been has been loaded into the DB.
  
   How can I continue eliminating duplicated rows?
   As far as I remember the is a sentence in SQL to only show ONE row of
   duplicated rows, maybe if I do a select using this sentence and then
   put this new recordset in another table, it will work!!
  
   Any ideas?
  
   ---
   Miguel Guirao Aguilera
   Logistica R8 TELCEL
   Tel. (999) 960.7994
  
  
   Este mensaje es exclusivamente para el uso de la persona o entidad a
   quien esta dirigido; contiene informacion estrictamente confidencial y
   legalmente protegida, cuya divulgacion es sancionada por la ley. Si el
   lector de este mensaje no es a quien esta dirigido, ni se trata del
   empleado o agente responsable de esta informacion, se le notifica por
   medio del presente, que su reproduccion y distribucion, esta
   estrictamente prohibida. Si Usted recibio este comunicado por error,
   favor de notificarlo inmediatamente al remitente y destruir el mensaje.
   Todas las opiniones contenidas en este mail son propias del autor del
   mensaje y no necesariamente coinciden con las de Radiomovil Dipsa, S.A.
   de C.V. o alguna de sus empresas controladas, controladoras, afiliadas
   y subsidiarias. Este mensaje intencionalmente no contiene acentos.
  
   This message is for the sole use of the person or entity to whom it is
   being sent.  Therefore, it contains strictly confidential and legally
   protected material whose disclosure is subject to penalty by law.  If
   the person reading this message is not the one to whom it is being sent
   and/or is not an employee or the responsible agent for this
   information, this person is herein notified that any unauthorized
   dissemination, distribution or copying of the materials included in
   this facsimile is strictly prohibited.  If you received this document
   by mistake please notify immediately to the subscriber and destroy the
   message. Any opinions contained in this e-mail are those of the author
   of the message and do not necessarily coincide with those of Radiomovil
   Dipsa, S.A. de C.V. or any of its control, controlled, affiliates and
   subsidiaries companies. No part of this message or attachments may be
   used or reproduced in any manner whatsoever.
 
  ___
  Sent by ePrompter, the premier email notification software.
  Free download at http://www.ePrompter.com.

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



Re: [PHP-DB] webhosting with php/mysql and disk quota

2006-02-27 Thread Micah Stevens
Yes, however, a few of those require root permissions which gets tricky as you 
DO NOT want to run internet accessable php scripts as root, in which case 
you're hosed. 

What I do it run a perl daemon as root that php then connects to as a client 
and requests actions, and the daemon will only accept connections from 
localhost. The perl daemon actually does all the root actions. 

There's several ways to do this, some more secure than others.. But in a word, 
yes it's possible, but you'll need to give it some thought.

-Micah 


On Monday 27 February 2006 1:01 pm, vassilis wrote:
 Hello all,
 is it possible to do the following thing with php/mysql?

 1. user registers
 2. upon clicking the submit button a php script creates a mysql DB
 with a unique name ( So far so good, till there I have no prob)
 3. the specific user gets SELCT INSERT UPDATE rights for his database only.
 4. Mysql quota is set to 10MB
 5. user directory with write permission only by the specific user gets
 created
 under the www directory.
 6. Syncronization of Disk quota and mysql quota e.g. 9MB pictures in the
 user directory,
 means 1MB left for mysql or the oposite 9MB mysql data, 1mb free in the
 user directory.

 This whole thing must run on its own without someone to create the accounts

 thanks in advance
 Vassilis

 --
 Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

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



Re: [PHP-DB] webhosting with php/mysql and disk quota

2006-02-27 Thread Micah Stevens

Yes, that would be a way to run the script as root, however, you shouldn't run 
a publically accessable script as root, it's a horribly big hole right into 
the heart of your system. 

-Micah 

On Monday 27 February 2006 1:54 pm, Miguel Guirao wrote:
 You could also use the suid bit enable in your permission scripts!!

 Miguel

 -Original Message-
 From: Micah Stevens [mailto:[EMAIL PROTECTED]
 Sent: Lunes, 27 de Febrero de 2006 02:23 p.m.
 To: php-db@lists.php.net
 Subject: Re: [PHP-DB] webhosting with php/mysql and disk quota


 Yes, however, a few of those require root permissions which gets tricky as
 you
 DO NOT want to run internet accessable php scripts as root, in which case
 you're hosed.

 What I do it run a perl daemon as root that php then connects to as a
 client and requests actions, and the daemon will only accept connections
 from localhost. The perl daemon actually does all the root actions.

 There's several ways to do this, some more secure than others.. But in a
 word,
 yes it's possible, but you'll need to give it some thought.

 -Micah

 On Monday 27 February 2006 1:01 pm, vassilis wrote:
  Hello all,
  is it possible to do the following thing with php/mysql?
 
  1. user registers
  2. upon clicking the submit button a php script creates a mysql DB
  with a unique name ( So far so good, till there I have no prob)
  3. the specific user gets SELCT INSERT UPDATE rights for his database

 only.

  4. Mysql quota is set to 10MB
  5. user directory with write permission only by the specific user gets
  created
  under the www directory.
  6. Syncronization of Disk quota and mysql quota e.g. 9MB pictures in the
  user directory,
  means 1MB left for mysql or the oposite 9MB mysql data, 1mb free in

 the

  user directory.
 
  This whole thing must run on its own without someone to create the

 accounts

  thanks in advance
  Vassilis
 
  --
  Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

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


 Este mensaje es exclusivamente para el uso de la persona o entidad a quien
 esta dirigido; contiene informacion estrictamente confidencial y legalmente
 protegida, cuya divulgacion es sancionada por la ley. Si el lector de este
 mensaje no es a quien esta dirigido, ni se trata del empleado o agente
 responsable de esta informacion, se le notifica por medio del presente, que
 su reproduccion y distribucion, esta estrictamente prohibida. Si Usted
 recibio este comunicado por error, favor de notificarlo inmediatamente al
 remitente y destruir el mensaje. Todas las opiniones contenidas en este
 mail son propias del autor del mensaje y no necesariamente coinciden con
 las de Radiomovil Dipsa, S.A. de C.V. o alguna de sus empresas controladas,
 controladoras, afiliadas y subsidiarias. Este mensaje intencionalmente no
 contiene acentos.

 This message is for the sole use of the person or entity to whom it is
 being sent.  Therefore, it contains strictly confidential and legally
 protected material whose disclosure is subject to penalty by law.  If the
 person reading this message is not the one to whom it is being sent and/or
 is not an employee or the responsible agent for this information, this
 person is herein notified that any unauthorized dissemination, distribution
 or copying of the materials included in this facsimile is strictly
 prohibited.  If you received this document by mistake please notify 
 immediately to the subscriber and destroy the message. Any opinions
 contained in this e-mail are those of the author of the message and do not
 necessarily coincide with those of Radiomovil Dipsa, S.A. de C.V. or any of
 its control, controlled, affiliates and subsidiaries companies. No part of
 this message or attachments may be used or reproduced in any manner
 whatsoever.

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



Re: [PHP-DB] Tracking Site Version

2006-02-23 Thread Micah Stevens

Subversion: http://subversion.tigris.org



On Thursday 23 February 2006 12:44 pm, Alex Major wrote:
 Hi there,
 I'm currently working on my website which is now live, and was wondering
 how some of you more experienced web developers record site developments if
 you do.
 I'm thinking of perhaps creating a page on the site where I record the site
 version, and changes made during the update. Just wondering if any of you
 had a similar system, or if you had any suggestions for recording site
 changes etc..

 Many thanks,
 Alex.

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



Re: [PHP-DB] Sessions help needed !!!

2006-02-17 Thread Micah Stevens

Well, not much to go on, but I'd check variable scope, and register-globals. 
The latter being more likely as I can't see how the scope would change if 
you're just copying things over. 

-Micah 

On Friday 17 February 2006 2:18 pm, Chris Payne wrote:
 Hi there everyone,

 OK this script worked perfectly on my own apache webserver and I had to
 move it to the main live server, but for some reason it's not passing
 session values in the same way and i'm positive it's something damn
 obvious.

 On my server I can use:

 echo $credits_system;
 echo $credits_left;
 echo $foldername;

 To display the information to make sure it is being passed, but it returns
 blank on their server (Same versions of everything except I didn't install
 it so it may have something turned off in the config - which i don't have
 control over, sigh).  The thing is, the last one - $foldername I MUST have
 access to as the database uses this as a reference for searches and without
 this working I can't pull the data I need ($foldername is an ID and also
 refers to physical folders/directories on the apache webserver for video
 files).

 Is there some obvious that I can check to see what's going on that I can't
 think about right now?

 Any help or pointers would be really appreciated.

 Chris

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



Re: [PHP-DB] Found the sessions solution :-)

2006-02-17 Thread Micah Stevens

register_globals. :) 

On Friday 17 February 2006 2:35 pm, Chris Payne wrote:
 Hi Guys,

 Thanks for your prompt responses.  I found if I put the below at the top of
 each page that needs to display the session data it works fine:

 foreach($_REQUEST as $key=$value) {
 $$key=$value;
 };

 Chris

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



Re: [PHP-DB] slow loading page (solved)

2006-02-15 Thread Micah Stevens
On Wednesday 15 February 2006 5:24 am, redhat wrote:
 Well, it looks like it might be a DNS issue or at least a routing issue
 after all.  I hit the phpinfo page on the server from home (completely
 different ISP) and it loaded like I thought it should have - very fast -
 even for phpinfo.  I guess I have to start digging around elsewhere for
 the answer to this riddle.  Thanks for the nugget called ngrep - I
 will keep that one handy.
 Doug

Interesting. Might be your client computer too. Although I assume other 
websites load quickly on it? 

ngrep is the bomb. Glad I could share.
-Micah 

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



Re: [PHP-DB] striping \n or \r

2006-02-15 Thread Micah Stevens
Use double quotes with \n and \r. 


On Wednesday 15 February 2006 10:03 am, nikos gatsis wrote:
 Hello list

 Does anybody knows how to strip new lines (\n) or \r from a string?
 I try
 $lead=str_replace('(0x0D)',' ',str_replace('(0x0A)',' ',$lead));

 or
 $lead=str_replace('\n',' ',str_replace('\r',' ',$lead));

 with no results

 Thank you
 Nikos

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



Re: [PHP-DB] slow loading page

2006-02-14 Thread Micah Stevens

On the server, you can use Dig - it's a pretty good DNS tool. On windows you 
can use nslookup I think. 

-Micah 

On Tuesday 14 February 2006 8:07 am, redhat wrote:
 On Tue, 2006-02-14 at 18:06 +1030, David Robley wrote:
  Micah Stevens wrote:
   Not enough information there to make any sort of diagnosis, but here
   are some things to try to narrow down the problem:
  
   1) ssh into the server, and run 'top' to watch the process list. Then
   while watching that, hit reload in the browser to see if the HTTP
   process pegs out while you're waiting for the page. If it does, for
   some reason apache/php is struggling. Otherwise it's likely something
   else.
  
   2) run 'ngrep' on port 80 of the incoming network interface (eth0, or
   whatever it's hooked to), and reload the page again. Are you immediatly
   seeing the request come though or does it take a while? This type of
   thing could be caused not by the webserver, but instead by a badly
   configured router, or something in the network. If it takes a while to
   come through, you need to look at your network configuration.
  
   3) Is this a DNS issue? If you're accessing via a domain name, and not
   a direct IP type URL, a shoddy DNS connection could make things really
   take a long time.
 
  3a) If so, is hostname lookup turned on for apache logging? This may
  result in yet another query to the DNS. I'm not sure however whether that
  lookup might delay delivery of the document, or whether the document is
  served independently og logging actions; I would guess the latter.
 
 
 
 
  Cheers
  --
  David Robley
 
  I'm never anywhere on time, Tom related.

 Ran TOP - the system is still at 99.5% idle while the page is loading.
 I also ran ngrep (new tool to me - very cool) and the requests came
 through very quickly - rules this one out too.  The only one that I
 don't really have a way to test is the DNS issue.  The server is sitting
 in our DMZ and our firewall rules say that our corporate network can
 have total freedom to the lower security items (like the DMZ).  As for
 the DNS - the server is a single server with two virtual domains (name
 based, not IP) and we have a DNS server pointing to it.  Are there any
 ways to test the DNS server configuration?  Any tools that I can try?  I
 feel like this is probably going to be my smoking gun here.
 Doug

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



Re: [PHP-DB] screen resolution!

2006-02-06 Thread Micah Stevens

Yes, there is. It's called HTML.

You might think me daft, but HTML was actually created to allow the page to 
adapt to screen size. The oldest technology on the block is actually the 
thing to use in this situation, otherwise you're just creating extra work for 
yourself. 

A simple example:

table width=800px - This works great, looks great, until you have a 
640x480 screen. Instead, try this:

table width=80%  (this scales according to screen size)

or

table (this scales according to content size + screen size)

It really sounds like this is a problem with your web page design, not php or 
Javascript. 

However, you could indeed do as others suggested and create multiple pages.. 
That really sounds like more work than it's worth though. 

-Micah 

On Monday 06 February 2006 1:38 am, JeRRy wrote:
 Yes I know this but there is no script that can re-write webpages on the
 fly for certain resolutions?

   Instead of re-doing each page for each res.?

   With the technology these days I thought someone would of created
 something like this, so you create a website than you put it through a
 program that re-does the HTML for the resolutions you set and bingo the
 results are spat out and you add it to the site and use a little script to
 redirect depending on their set resolution.

   Jerry

 PHP Superman [EMAIL PROTECTED] wrote:
   Or you can have a page which detects resolution by javascript and
 redirects to another PHP page with the resolution data

   On 2/4/06, Bastien Koert [EMAIL PROTECTED] wrote:
 As the other poster mentioned you need JS to detect the screen widththe
 usual approach is to use js to detect the screen res and the include the
 appropriate CSS file to match the screen res.

 Bastien

 From: JeRRy [EMAIL PROTECTED]
 To: php-db@lists.php.net
 Subject: [PHP-DB] screen resolution!
 Date: Sun, 5 Feb 2006 02:44:19 +1100 (EST)
 
 Hi,
 
I have written a website in PHP using MYSQL.  But I have come accross
  an un-common problem.  Normally when I create a website it's done on a
  desktop PC.  But this time for the first time I did it on laptop meaning
  the screen resolution is different.
 
Is there any sort of script/code I can use to create another section of
 my site in a desired screen resolution without me having to do it all
 manually?
 
I know of many scripts online that I can DETERMINE visitors screen
 resolutions and recommend the correct one but don't know one that will
 adjust the website to suit that visitors screen resolution.  Am aware of
 scripts that redirect to another web page but that requires you to write
 the website again to cater for that.
 
Is there a quicker way/solution?
 
Thanks!
 
J

 --
 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] screen resolution!

2006-02-05 Thread Micah Stevens

Or you could design your page so that it's not resolution dependant. 

-Micah 

On Sunday 05 February 2006 8:28 am, PHP Superman wrote:
 Or you can have a page which detects resolution by javascript and redirects
 to another PHP page with the resolution data

 On 2/4/06, Bastien Koert [EMAIL PROTECTED] wrote:
  As the other poster mentioned you need JS to detect the screen
  widththe
  usual approach is to use js to detect the screen res and the include the
  appropriate CSS file to match the screen res.
 
  Bastien
 
  From: JeRRy [EMAIL PROTECTED]
  To: php-db@lists.php.net
  Subject: [PHP-DB] screen resolution!
  Date: Sun, 5 Feb 2006 02:44:19 +1100 (EST)
  
  Hi,
  
 I have written a website in PHP using MYSQL.  But I have come accross
 
  an
 
  un-common problem.  Normally when I create a website it's done on a
 
  desktop
 
  PC.  But this time for the first time I did it on laptop meaning the
 
  screen
 
  resolution is different.
  
 Is there any sort of script/code I can use to create another section
 
  of
 
  my site in a desired screen resolution without me having to do it all
  manually?
  
 I know of many scripts online that I can DETERMINE visitors screen
  resolutions and recommend the correct one but don't know one that will
  adjust the website to suit that visitors screen resolution.  Am aware of
  scripts that redirect to another web page but that requires you to write
  the website again to cater for that.
  
 Is there a quicker way/solution?
  
 Thanks!
  
 J
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php

 --
 Hi Everyone, I am running PHP 5 on Windosws XP SP2 with MySQL5, Bye Now!

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



Re: [PHP-DB] timestamp value management

2006-01-29 Thread Micah Stevens

So, you want the maximum date of the result set? Just use SQL:

select max(datecolumn) from table where (conditions);

-Micah 


On Monday 30 January 2006 1:03 pm, xkorakidis wrote:
 hi guys!
 I'm trying to manage a table containing a timestamp colum
 - when I insert a record, I don't fill a value in timestamp column, so
 current timestamp is inserted. The inserted value is smth like
 20060129213253
 - when I try to show this value in a php page, I use
 date($varOfTimestampColumn) or getdate(). The final result is the
 highest possible date (smth like January 19 2038 I think)

 How can I manage the timestamp field so as to show the correct value?
 Thanks!

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



Re: [PHP-DB] mysql_pconnect cannot create two permanent connections to the same machine ?

2006-01-17 Thread Micah Stevens
On Tuesday 17 January 2006 7:57 am, Aarno Syvänen wrote:
 Hi List,

 I do not claim that this is bug, but it is not a nice feature either.

 I do have following:

 ?
 /* db.php */
 $db_server=127.0.0.1;
 $db_user = **
 $db_pass = **
 $db_db = bebbicell;

 $db_account_server=127.0.0.1;
 $db_account_user = 
 $db_account_pass = 
 $db_account_db = asterisk;

 //$level= error_reporting ( 0);
 $bid=mysql_pconnect($db_server,$db_user,$db_pass);
 //error_reporting ( $level);
 mysql_select_db($db_db,$bid);

 //$level= error_reporting ( 0);
 $accid=mysql_pconnect($db_account_server,$db_account_user,
 $db_account_pass);
 //error_reporting ( $level);
 mysql_select_db($db_account_db, $accid);
 ?

 Note that databases here are totally unrelated. They are on the same
 machine only
 because i am developing. I want later to move  'asterisk' to a
 separate machine, but
 when i do this, i want just change $db*s, not any other code. Because
 on this, i want
 both $bid and $accid to be valid handles.

 Currently it is not so. Both

 $res = mysql_query($sql,$accid);
 $err = mysql_error($accid);

 will generate error

 Warning: mysql_query(): supplied argument is not a valid MySQL-Link
 resource in /var/www/bebbicell.ch/signup.php

 And yes, there are no functions in signup.php.

 Aarno

If you remove the $bid connection code, (comment it out) does your test code 
with $accid work? 

-Micah 

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



Re: [PHP-DB] Bit(1) datatype from mySQL

2006-01-07 Thread Micah Stevens
Use a tinyint field in mysql, (which is what bool gets translated to I think) 
and you'll get a number back, 0 = false, 1 = true, and you can:

if ($fieldname) {
do true item;
}

if (!$fieldname) {
do false item;
}

This works for me, I've done before quite a bit in the past. 

-Micah 


On Saturday 07 January 2006 6:45 am, Larry Bradley wrote:
 Greetings:

 I'm new to PHP, although I've been a programmer all my life. I had been
 doing a bit of web database work with VB Script and ASP and mySQL, and then
 decided to try PHP. I've run into a couple of things that bother me.

 I have boolean fields (i.e. bit(1)) in the mySQL database. When I retrieve
 data from the mySQL server into an array or an object, it seems as if all
 the data fields are returned as characters. For most data types this does
 not matter, since PHP will handle them properly. This an integer 46 being
 retrieved as a character '46' is OK.

 However, the boolean is a curse, as it comes back as a character containing
 hex 00 or hex 01, and I have to use a test such as:

 if (ord(IsAMember) == 0) ...

 I can't just treat it as a boolean.

 I have got around the problem by using a construct such as:

 select if(IsAMember,1,0) as IsAMember

 in the SQL select, but this is a bit of a pain.

 Any thoughts?

 Thanks

 Larry Bradley
 Orleans (Ottawa), Ontario, CANADA

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



Re: [PHP-DB] newbie PHP/MySQL question

2006-01-02 Thread Micah Stevens

Maybe from a previous query? I mean, did you make sure the table was clear 
before starting the script? 

On Monday 02 January 2006 6:18 pm, toylet wrote:
 A table with a column big5 char(2) not null primary key.

   $target-query(delete from canton);
   for ($ii=0; $ii256; $ii++) {
 for ($jj=0; $jj256; $jj++) {
   echo $ii ... $jj . \n;
   $query=insert into canton ( big5 ) values ( '
   . mysql_real_escape_string(chr($ii).chr($jj))
   . ' );
   $target-query($query);
 }
   }

 The program died with this output:

 0.92
 0.93
 0.94
 0.95
 0.96
 0.97
 Duplicate entry '' for key 1

 The character strings are unique. Why did it find a duplicate at (0,97)?

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



Re: [PHP-DB] isset or ! isset what is my problem?

2006-01-02 Thread Micah Stevens

NULL != Not set. 

isset() tests to see if the variable exists. If your variable has a null value 
it is set, it DOES exist, it just has NULL for a value. You should test for a 
null value if that's what you want:

if ($picture == null)

Or perhaps the empty() function might be what you're looking for. 

-Micah 


On Monday 02 January 2006 7:54 pm, Ralph wrote:
 I'm building a URL based on data extracted from mySQL and I want the
 text space.gif used as my default value should the variable $picture
 by NULL.

 The results of the code below kick back a value for $picture when it
 is set in the database, but ignores the space.gif if the database
 result is empty.

 If I flip the test from ! isset to isset then I get the space.gif for
 each result.


 I've had no luck searching out an answer.

 Thanks in advance.

 --The Code-
 ?php do { ?
 img src=images/?php
 $picture=$row_rst_screenings['Picture'];

 if(! isset($picture)) {
 $picture='space.gif';
 }else{
 $picture=$row_rst_screenings['Picture'];
 }

 echo $picture;

 ?br
 pspan class=style2?php echo $row_rst_screenings['Title']; ?/
 spanbr /
 span class=style3?php echo $row_rst_screenings['Director']; ?/
 span/p
 p class=style4?php echo $row_rst_screenings['Blurb']; ?/p
 p class=style3Showtime: ?php echo $row_rst_screenings
 ['ShowTime']; ? ?php echo $row_rst_screenings['ShowDate']; ?/p
 p class=style3Location: ?php echo $row_rst_screenings
 ['Location']; ?/p

 ?php } while ($row_rst_screenings = mysql_fetch_assoc
 ($rst_screenings)); ?

 ---END-

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



Re: [PHP-DB] php mail and accentuated characters

2005-12-31 Thread Micah Stevens

Check the encoding for the web page itself. Sounds like the page is telling 
the client browser to encode differently than the server is encoding. 

-Micah 

On Saturday 31 December 2005 9:11 am, Jean-Philippe BATTU wrote:
 Hello

 I would like to send email from my php program. So I use the mail()
 function from php engine but I noticed that the  accentuated characters
 were not well transmitted by php or the apache server (I use a linux box
 with FC4 and httpd server).

 In the phpinfo function, I saw the LANG environnement variable was set to
 en_US, so I fixed it to fr_FR in the system file /etc/sysconfig/18n
 and reboot the machine, phpinfo gave me the correct french LANG. The result
 is still the same

 the apache server gave me incorrect languages in server-info, so I
 corrected the DefautLanguage directive and Priority Languages directives in
 the httpd.conf file. Restart apache and server-info gave me correct
 information, but the result is still the same.

 I am in trouble, because the mutt linux program send well the  accentuated
 characters. I studied the difference between two mails, from mute and from
 php, and apparently the order definition after the Date aren't the same.

 I tried to use the phpmailer class, but the problem persists. I use php
 4.3.10

 The workaround I found is to use the mutt command from php by the system
 function, but it is a pity !

 Do you know this problem ?

 thanks for your reply and happy new year to you !

 Cheers




 Jean-Philippe BATTU
 Grenoble
 http://jeanpba.homeip.net

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



Re: [PHP-DB] Encrypting DB content

2005-12-31 Thread Micah Stevens
Yes, Great suggestion. This is the way the UNIX passwd function works, and 
you'll notice no one has hacked that recently as opposed to the windows 
password function.

hehe.. 

-Micah


On Saturday 31 December 2005 8:39 am, Bastien Koert wrote:
 As an addition to this, I would suggest that you 'SALT' the value before
 hashing it. There are already tables out there that contain a reverse
 look-ups of comman hash values (like names, states, dictionary words).  A
 SALT is a random set of characters (use the same one for each value to be
 MD5'd or you'll never be able to match it back) that alters the hash value
 of the base password the users provide. You can prepend and append the hash
 values to the value to be MD5'd to make it more secure.

 Bastien

 From: Micah Stevens [EMAIL PROTECTED]
 To: php-db@lists.php.net
 Subject: Re: [PHP-DB] Encrypting DB content
 Date: Fri, 30 Dec 2005 22:12:38 -0800
 
 
 You can store an MD5, or SHA hash of the password, and then compare.. This
 is
 not an encrypted version of the password, rather a calculated hash of it.
 You
 can't (well, not without a bit of effort) decrypt this back into the
 password.
 
 The idea is when you store the password, you create the hash. Store the
 hash
 in the database. When the user logs in, take their password entry,
  generate a
 hash in the same way, and compare the two values.
 
 SHA2 is the most secure method to use of these two, I'd use that.
 
 The advantage is, the hash could be freely accessable to anyone, and it
 doesn't cause a security issue, where as all a hacker needs is the key to
 an
 encrypted database of passwords to reveal them all.
 
 That's the route I take anyhow.. This will likely start a huge
  conversation about how to secure your system up super tight, but remember
  the most secure
 server is one that isn't turned on. :) A realistic solution is somewhere
 in-between this and no security at all.
 
 -Micah
 
 On Friday 30 December 2005 8:15 pm, Chris Payne wrote:
   Hi there everyone,
  
  
  
   I am about to launch the website for my complex where the homeowners
   can login and check their billing status etc .. what is the best way,
   with
 
 PHP
 
   and MySQL, to store an ENCRYPTED password into the database so that if
   someone got into the DB they couldn't read the password but if they
 
 enter
 
   it into the form on the site it still works?
  
  
  
   I'm not sure on the best way to do this and any help would be really
   appreciated.
  
  
  
   Happy New Year everyone.
  
  
  
   Chris
 
 --
 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] Encrypting DB content

2005-12-30 Thread Micah Stevens

You can store an MD5, or SHA hash of the password, and then compare.. This is 
not an encrypted version of the password, rather a calculated hash of it. You 
can't (well, not without a bit of effort) decrypt this back into the 
password.

The idea is when you store the password, you create the hash. Store the hash 
in the database. When the user logs in, take their password entry, generate a 
hash in the same way, and compare the two values. 

SHA2 is the most secure method to use of these two, I'd use that. 

The advantage is, the hash could be freely accessable to anyone, and it 
doesn't cause a security issue, where as all a hacker needs is the key to an 
encrypted database of passwords to reveal them all. 

That's the route I take anyhow.. This will likely start a huge conversation 
about how to secure your system up super tight, but remember the most secure 
server is one that isn't turned on. :) A realistic solution is somewhere 
in-between this and no security at all. 

-Micah 


On Friday 30 December 2005 8:15 pm, Chris Payne wrote:
 Hi there everyone,



 I am about to launch the website for my complex where the homeowners can
 login and check their billing status etc .. what is the best way, with PHP
 and MySQL, to store an ENCRYPTED password into the database so that if
 someone got into the DB they couldn't read the password but if they enter
 it into the form on the site it still works?



 I'm not sure on the best way to do this and any help would be really
 appreciated.



 Happy New Year everyone.



 Chris

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



Re: [PHP-DB] Encrypting DB content THANK YOU and nlist help

2005-12-30 Thread Micah Stevens

No problem. Try adding the -t switch to nlist to sort by file time. If you 
require the opposite order, add -r (for reverse).. 

nlist -t   (order newest first)
nlist -tr (order oldest first)

HTH,
-Micah 

On Friday 30 December 2005 10:32 pm, Chris Payne wrote:
 Hi there,

 Thank you for your help I really appreciate it :-)

 I have one last question and you may (Or may not) be able to answer :-)  Do
 you know how to sort the FTP nlist command?  I have it listing the FTP
 directory once a video is uploaded and using nlist I can view the ENTIRE
 listing, but I just need to be able to grab the latest filename from the
 directory so that it can be added to a database.

 Any help on that would be fantastic, I've read the PHP manual which is how
 I managed to grab the entire directory listing on the server, but I just
 need the last modified date to display (The last file uploaded).

 Chris


 You can store an MD5, or SHA hash of the password, and then compare.. This
 is
 not an encrypted version of the password, rather a calculated hash of it.
 You
 can't (well, not without a bit of effort) decrypt this back into the
 password.

 The idea is when you store the password, you create the hash. Store the
 hash

 in the database. When the user logs in, take their password entry, generate
 a
 hash in the same way, and compare the two values.

 SHA2 is the most secure method to use of these two, I'd use that.

 The advantage is, the hash could be freely accessable to anyone, and it
 doesn't cause a security issue, where as all a hacker needs is the key to
 an

 encrypted database of passwords to reveal them all.

 That's the route I take anyhow.. This will likely start a huge conversation
 about how to secure your system up super tight, but remember the most
 secure

 server is one that isn't turned on. :) A realistic solution is somewhere
 in-between this and no security at all.

 -Micah

 On Friday 30 December 2005 8:15 pm, Chris Payne wrote:
  Hi there everyone,
 
 
 
  I am about to launch the website for my complex where the homeowners can
  login and check their billing status etc .. what is the best way, with
  PHP and MySQL, to store an ENCRYPTED password into the database so that
  if someone got into the DB they couldn't read the password but if they
  enter it into the form on the site it still works?
 
 
 
  I'm not sure on the best way to do this and any help would be really
  appreciated.
 
 
 
  Happy New Year everyone.
 
 
 
  Chris

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


 --
 No virus found in this incoming message.
 Checked by AVG Free Edition.
 Version: 7.1.371 / Virus Database: 267.14.9/216 - Release Date: 12/29/2005

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



Re: [PHP-DB] using fsockopen to handle redirections

2005-12-23 Thread Micah Stevens

I suppose you could, but it seems a poor way, just use the header tag instead:

if ($redir_needed) {
header('Location: http://www.example.com');
writelog(user redirected);
} 


On Friday 23 December 2005 2:04 am, Yemi Obembe wrote:
 Any way i can use fsockopen to detect url redirections? for example if ds:
 www.ex1.com redirects to www.ex2.com and i'm using:

 $fp = fsockopen(www.ex1.com, 80)
 

 to connect to the site, anyway i can know if there is a redirection to
 another url?

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



Re: [PHP-DB] Minor Change

2005-12-12 Thread Micah Stevens

You're getting an error, after the query, put:

echo mysql_error();

to find out what's happening. 

On Monday 12 December 2005 11:05 am, [EMAIL PROTECTED] wrote:
 I made tiny changes to my php file and sql table and the table won't come
 up.  I updated the table name (and php file name) from 109fh5 to 109fh6.
 In the table, I changed 6 cells, leaving a couple blank.  Then I changed
 only the digit 5 to make it a 6 (109fh6) in the following:

 $get_data_query = select rep, party, state, cd, minority, afr_am, asian,
 am_indian, hispanic, med_hsehold_income, poverty from 109fh6 order by
 $sort_field $sort_order;

 Now I get Warning: mysql_fetch_assoc(): supplied argument is not a valid
 MySQL result resource in etc.

 I've done this many times without a problem (this is the 6th time in this
 sequence).  What could be wrong after such a minor change?

 Ken

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



Re: [PHP-DB] Re: php-db Digest 23 Nov 2005 09:54:55 -0000 Issue 3170

2005-11-24 Thread Micah Stevens

Use the database for what it was designed for, storing data that needs to be 
parsed, and use the filesystem for what it was designed for, storing files. 

Just my opinion, but I think it's a good one. :) 

-Micah 

On Thursday 17 November 2005 1:19 am, Marco Schierhorn wrote:
 Hey,

 we´ve large amount of Images ( nearly 2 GB ).
 And they will increase, cause or Editors will submit several articles a
 day where they´re allowed to upload
 some new pics.
 So, whats the better solution ? To store them in the filesystem ( with
 only the path in the db )
 or to store them as BLOB´s in the DB ( MySQL ).
 When we decide to store them in the DB, we´ve thought about splitting
 larger Images (  64 K ) into several pieces into the db.
 So, we´ve a simulated streaming. I´ve seen it at
 http://php.dreamwerx.net/forums/viewtopic.php?t=6.

 So, any recommendation is very welcome.I would really appreciate any of
 them.

 Cheers

 Marco

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



Re: [PHP-DB] Suggestions please!

2005-11-21 Thread Micah Stevens
Sounds like a decision needs to be made. If statements were born for that. 




On Monday 21 November 2005 3:41 am, JeRRy wrote:
 Hi,

   Okay I have a dj site, I have alogin script and cookies to handle the
 login.

   Next I want to add some permissions for each dj account.  Maybe 3 to
 start with, 3 permissions.

   A value or y or n will be set in each permission, with n being the
 default.

   Now I need to know how to output the permission out with some add php
 code.

   So let me explain:

   Three permissions lets say are perm_1 , perm_2 , and perm_3

   If user bob has a y in perm_2 I want to output the perm_2 permission. 
 Which lets say is to delete a dj account.  So it needs to output some php
 code to work with the database.  Is IF statements relevent/safe for this or
 is there a better method?

   So each user account on default will need to also check the values of the
 permission.  So I need a code that checks for a y value in each permission.
  If none is found than nothing is displayed or a message saying you have no
 special permissions currently.  But if one or more are met than those
 permissions are outputed to the relevant permission code.

   If you need any further information please let me know.  All help mostly
 appreciated in advance.

   J


 -
 Do you Yahoo!?
   The best of Hasselhoff on the web - Hoffice Attachments

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



Re: [PHP-DB] Can't Upload ram file

2005-11-18 Thread Micah Stevens

Perhaps it's not file type that is the problem, but file size? 

-Micah 

On Friday 18 November 2005 6:19 am, Mohamed Yusuf wrote:
 the script I am using can upload images like, jpg, gif or png to the
 server, but it can't upload music file to the server like ram and rm.
 any help?

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



Re: [PHP-DB] Mailer issue with PHP and MySQL

2005-11-18 Thread Micah Stevens

you're not setting the mime types correctly, and your boss probably has some 
spam filter that tosses incorrect email.

I suggest using the PEAR Mail extension, it will automatically set this all up 
for you. It's very easy and nice to use.

-Micah 

On Friday 18 November 2005 10:32 am, Chris Payne wrote:
 Hi Guys,



 I'm using PHP with MySQL data to send a very important email to clients
 when they enter the recipients email address into the system.  On the whole
 it works for ME, to either my yahoo email address or any of my own domains
 email addresses that I have,



 However, when my WIFE gets it it isn't HTML (Even though mine is) with
 outlook OR outlook express and my boss doesn't get it at ALL even at his
 yahoo address, so something is wrong with my script.  Can anyone look at it
 please and let me know if anything is blazingly obvious that I've done
 wrong?



 As I said I can receive emails on any account I personally try, but my boss
 cannot and if it doesn't work for him it's basically not working in his
 eyes as it could be having the same issue with others.



 $MP = sendmail -t;

 $HT = htmlbody;

 $HT = /body/html;



 $fd = popen($MP,w);

 fputs($fd,MIME-Version: 1.0\r\n);

 fputs($fd,Content-type: text/html; charset=iso-8859-1\r\n);

 fputs($fd, To: $word\n);

 fputs($fd, From: $email\n);

 fputs($fd, Subject: $subject\n);

 fputs($fd, X-Mailer: PHP3\n);

 fputs($fd, From: $email\n);

 fputs($fd, Email: $email\n);

 fputs($fd, $messageheader); // actually this is the message itself

 pclose($fd);



 Any help would be REALLY appreciated.



 Chris

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



Re: [PHP-DB] Problem of Upload media file

2005-11-17 Thread Micah Stevens

Keep in mind you're referring to a filesystem path, and a relative one to 
boot, so what you're telling php is, that your upload directory is:

/home/somally/public_html/music/music/media/

Which doesn't sound like what you intend. 

Also don't trust the php line numbers if you have significant whitespace in 
your code, sometimes it can get screwey. Look for your move_uploaded_file 
statement. 

-Micah 


On Thursday 17 November 2005 8:58 am, Mohamed Yusuf wrote:
 I am trying to upload music file to server using php and saving file path
 to the MySql, But I am getting this error message *Warning*:
 move_uploaded_file(music/media/): failed to open stream: No such file or
 directory in */home/somally/public_html/music/upload2.php* on line *36*.
  line 36 is reference of this code *$uploadDir = 'www/music/media/';*
  so what am I missing?, any help?

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



Re: [PHP-DB] Problem of Upload media file

2005-11-17 Thread Micah Stevens


Well, the error doesn't match the code, but the code says to upload the file 
to:

/home/somally/public_html/music/www/media/

Is that correct? 


On Thursday 17 November 2005 9:41 am, Mohamed Yusuf wrote:
 here is the complete code, so you can check it
 

 ?

 $uploadDir = 'www/media/';


 if(isset($_POST['upload']))
 {
 $fileName = $_FILES['userfile']['name'];
 $tmpName = $_FILES['userfile']['tmp_name'];
 $fileSize = $_FILES['userfile']['size'];
 $fileType = $_FILES['userfile']['type'];

 // the files will be saved in filePath
 $filePath = $uploadDir . $fileName;

 $result = move_uploaded_file($tmpName, $filePath);
 if (!$result) {
 echo Error uploading file;
 exit;
 }

 include 'library/config.php';
 include 'library/opendb.php';

 if(!get_magic_quotes_gpc())
 {
 $fileName = addslashes($fileName);
 $filePath = addslashes($filePath);
 }

 $query = INSERT INTO upload2 (name, size, type, path ) .
 VALUES ('$fileName', '$fileSize', '$fileType', '$filePath');

 mysql_query($query) or die('Error, query failed : ' . mysql_error());

 include 'library/closedb.php';

 echo brFile uploadedbr;
 }
 ?
 
 end

  On 11/17/05, Micah Stevens [EMAIL PROTECTED] wrote:
  Keep in mind you're referring to a filesystem path, and a relative one to
  boot, so what you're telling php is, that your upload directory is:
 
  /home/somally/public_html/music/music/media/
 
  Which doesn't sound like what you intend.
 
  Also don't trust the php line numbers if you have significant whitespace
  in
  your code, sometimes it can get screwey. Look for your move_uploaded_file
  statement.
 
  -Micah
 
  On Thursday 17 November 2005 8:58 am, Mohamed Yusuf wrote:
   I am trying to upload music file to server using php and saving file
 
  path
 
   to the MySql, But I am getting this error message *Warning*:
   move_uploaded_file(music/media/): failed to open stream: No such file
   or directory in */home/somally/public_html/music/upload2.php* on line
 
  *36*.
 
   line 36 is reference of this code *$uploadDir = 'www/music/media/';*
   so what am I missing?, any help?
 
  --
  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] Problem of Upload media file

2005-11-17 Thread Micah Stevens

No. It's not okay.. you're already in the music directory.. if you want it in 
the media subdir, just put 'media/'



On Thursday 17 November 2005 10:40 am, Mohamed Yusuf wrote:
 so should I change the directory?
 where I want to upload file is
 www.somalilyrics.com/music/media/http://www.somalilyrics.com/music/media/
, therefore what about if I say
 *$uploadDir = 'music/media/'; *is that fine?
 if it is not fine would you please show me how I have to do it?

 On 11/17/05, Micah Stevens [EMAIL PROTECTED] wrote:
  Well, the error doesn't match the code, but the code says to upload the
  file
  to:
 
  /home/somally/public_html/music/www/media/
 
  Is that correct?
 
  On Thursday 17 November 2005 9:41 am, Mohamed Yusuf wrote:
   here is the complete code, so you can check it
   
  
   ?
  
   $uploadDir = 'www/media/';
  
  
   if(isset($_POST['upload']))
   {
   $fileName = $_FILES['userfile']['name'];
   $tmpName = $_FILES['userfile']['tmp_name'];
   $fileSize = $_FILES['userfile']['size'];
   $fileType = $_FILES['userfile']['type'];
  
   // the files will be saved in filePath
   $filePath = $uploadDir . $fileName;
  
   $result = move_uploaded_file($tmpName, $filePath);
   if (!$result) {
   echo Error uploading file;
   exit;
   }
  
   include 'library/config.php';
   include 'library/opendb.php';
  
   if(!get_magic_quotes_gpc())
   {
   $fileName = addslashes($fileName);
   $filePath = addslashes($filePath);
   }
  
   $query = INSERT INTO upload2 (name, size, type, path ) .
   VALUES ('$fileName', '$fileSize', '$fileType', '$filePath');
  
   mysql_query($query) or die('Error, query failed : ' . mysql_error());
  
   include 'library/closedb.php';
  
   echo brFile uploadedbr;
   }
   ?
   
   end
  
   On 11/17/05, Micah Stevens [EMAIL PROTECTED] wrote:
Keep in mind you're referring to a filesystem path, and a relative
one
 
  to
 
boot, so what you're telling php is, that your upload directory is:
   
/home/somally/public_html/music/music/media/
   
Which doesn't sound like what you intend.
   
Also don't trust the php line numbers if you have significant
 
  whitespace
 
in
your code, sometimes it can get screwey. Look for your
 
  move_uploaded_file
 
statement.
   
-Micah
   
On Thursday 17 November 2005 8:58 am, Mohamed Yusuf wrote:
 I am trying to upload music file to server using php and saving
 file
   
path
   
 to the MySql, But I am getting this error message *Warning*:
 move_uploaded_file(music/media/): failed to open stream: No such
 
  file
 
 or directory in */home/somally/public_html/music/upload2.php* on
 
  line
 
*36*.
   
 line 36 is reference of this code *$uploadDir =
 'www/music/media/';* so what am I missing?, any help?
   
--
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] Sending multiple items via a single form field

2005-11-14 Thread Micah Stevens


You could just seperate the data in the field's value with a delimeter like | 
or something you wouldn't see in the data, then explode() based on that? 

What kind of field are you using? Your explanation is very vague. 

On Monday 14 November 2005 12:40 pm, Chris Payne wrote:
 Hi there everyon,



 I have a set of form fields dynamically generated but each item must
 contain 2 pieces of data - the input from the field AND the id that the
 input represents from the DB.  I had this info a while back but had a major
 HD crash and lost the info I had, how can I do this easily in PHP?



 Hopefully an easier to understand scenario:



 I have a form with - example - 5 items listed, each item from the DB and
 you select ONE item only out of the list, when you submit the form it sends
 the input from the field you select BUT I also need it to send an addition
 bit of info in the form of $id so that on the processing page, I can
 extract both the ID and the data entered from a single field.  Obviously I
 can't use a hidden field for this so the data has to be tacked-on to the
 input field somehow?



 Any help would save my life :-)



 Chris

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



Re: [PHP-DB] Table Output Question

2005-11-14 Thread Micah Stevens

You don't have to output two rows.. just do this:

$color = red; // init first color.
while ($row = mysql_fetch_assoc($data)) {
if ($color == red) {
$color = blue;
} else {
$color = red;
}
?
tr bgcolor=?=$color?td../td/tr 

?
}

-Micah 

On Monday 14 November 2005 3:37 pm, Jeff Grossman wrote:
 I have a table, where each line is the output of a query from a MySQL
 database.  I do not use borders, so the page is a little difficult to
 read sometimes.  Is it possible, or how do I, alternate the background
 color of each row when I output it?

 My code is like this:

 while (query) {
   TR
   TD/TD
   /TR
 }

 I am not sure how to output two rows in the same while loop.

 Thanks for any help you can offer me.

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



Re: [PHP-DB] Re: Table Output Question

2005-11-14 Thread Micah Stevens

I don't see what's more elegant about. They have a good point that you only 
need to do one out of the two, but doing it in Javascript versus PHP only has 
the advantage that it puts the processing load for that on the client 
computer. 

Am I missing something? 

On Monday 14 November 2005 5:25 pm, Ajree wrote:
 Take a look at this article on ALA:
 http://www.alistapart.com/articles/zebratables/

 It makes markup more elegant than repeated tr bgcolor='...'.

 --
 Ajree

 Jeff Grossman wrote:
  I have a table, where each line is the output of a query from a MySQL
  database.  I do not use borders, so the page is a little difficult to
  read sometimes.  Is it possible, or how do I, alternate the background
  color of each row when I output it?
 
  My code is like this:
 
  while (query) {
  TR
  TD/TD
  /TR
  }
 
  I am not sure how to output two rows in the same while loop.
 
  Thanks for any help you can offer me.

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



Re: [PHP-DB] Re: Table Output Question

2005-11-14 Thread Micah Stevens

Sorry if I sounded offended, I'm not. I was just curious because the advantage 
wasn't obvious to me. I see your point now though. Thanks for the insight. 

On Monday 14 November 2005 6:12 pm, Ajree wrote:
 Micah Stevens wrote:
  I don't see what's more elegant about. They have a good point that you
  only need to do one out of the two, but doing it in Javascript versus PHP
  only has the advantage that it puts the processing load for that on the
  client computer.
 
  Am I missing something?

 The second advantage is being more web standards compliant. Taking
 presentation out of the markup (clean table structure instead of tr
 attributes mess). But it's not the place for this (non-php) discussion,
 I just wanted to show another solution. 'More elegant' is only my
 opinion and I didn't want to offend anyone :)

 Best regards,
 Ajree

  On Monday 14 November 2005 5:25 pm, Ajree wrote:
 Take a look at this article on ALA:
 http://www.alistapart.com/articles/zebratables/
 
 It makes markup more elegant than repeated tr bgcolor='...'.
 
 --
 Ajree
 
 Jeff Grossman wrote:
 I have a table, where each line is the output of a query from a MySQL
 database.  I do not use borders, so the page is a little difficult to
 read sometimes.  Is it possible, or how do I, alternate the background
 color of each row when I output it?
 
 My code is like this:
 
 while (query) {
TR
TD/TD
/TR
 }
 
 I am not sure how to output two rows in the same while loop.
 
 Thanks for any help you can offer me.

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



Re: [PHP-DB] Re: Table Output Question

2005-11-14 Thread Micah Stevens

Sorry, that's shorthand.. ?=$color? is the same as:

? echo $color ?

? is the start tag for a php block, ? is the end tag.. 

On Monday 14 November 2005 6:26 pm, Jeff Grossman wrote:
 Micah Stevens [EMAIL PROTECTED] wrote:
  You don't have to output two rows.. just do this:
 
  $color = red; // init first color.
  while ($row = mysql_fetch_assoc($data)) {
 if ($color == red) {
 $color = blue;
 } else {
 $color = red;
 }
 ?
 tr bgcolor=?=$color?td../td/tr
 
  ?
  }
 
  -Micah

 Great, thanks for the help and information.  May I ask, how does PHP
 know to change the color?  What do the ?'s do in ?=$color??

 Thanks for the help.

 Jeff

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



Re: [PHP-DB] Re: Login Auth help?

2005-11-10 Thread Micah Stevens

I'd pull the addslashes() and use mysql_real_escape_string() instead. I'd also 
echo the query that's being sent to the database and compare to make sure 
it's doing what it should. 

-Micah 

On Thursday 10 November 2005 8:22 pm, JeRRy wrote:
 Hi,

 Well I tried this code but it fails, if I enter a correct User and Pass set
 in the db it just prompts for the user/pass again.  The error message that
 should apply if wrong three times appears but the sucessful message I can't
 get regardless of correct user pass or not, any help please?

 ?php
 function displayLogin() {
 header(WWW-Authenticate: Basic realm=\My Website\);
 header(HTTP/1.0 401 Unauthorized);
 echo h2Authentication Failure/h2;
 echo The username and password provided did not work. Please reload this
 page and try again.; exit;
 }
 $db = mysql_connect('localhost','db_user',db_pass') or die(Couldn't
 connect to the database.); mysql_select_db('db_name') or die(Couldn't
 select the database); if (!isset($PHP_AUTH_USER) || !isset($PHP_AUTH_PW))
 {
 // If username or password hasn't been set, display the login request.
 displayLogin();
 } else {
 // Escape both the password and username string to prevent users from
 inserting bogus data. $PHP_AUTH_USER = addslashes($PHP_AUTH_USER);
 $PHP_AUTH_PW = md5($PHP_AUTH_PW);
 // Check username and password agains the database.
 $result = mysql_query(SELECT count(id) FROM users WHERE
 password='$PHP_AUTH_PW' AND username='$PHP_AUTH_USER') or die(Couldn't
 query the user-database.); $num = mysql_result($result, 0);
 if (!$num) {
 // If there were no matching users, show the login
 displayLogin();
 }
 }
 // All code/html below will only be displayed to authenticated users.
 echo Congratulations! You're now authenticated.;

 ?


 J


 -
 Do you Yahoo!?
   Yahoo! News: Get the latest news via video today!

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



Re: [PHP-DB] [PDO] Number of rows found by Select

2005-11-09 Thread Micah Stevens

Ick.. this is why I don't use OOP DBA libraries.. 

Uhm.. without spending a bit of time learning more about PDO, I'd be hard 
pressed to answer this one. Why are you getting issues with asynchronous 
unbuffered queries? If they're unbuffered, how is the code execution 
continuing before you get data returned?

Seems weird to me, but I'm probably misunderstanding the error message.

-Micah 

On Wednesday 09 November 2005 9:21 am, Rob C wrote:
 So would it be possible to write a select() function to handle the
 wierdness? I'm attempting to write one but I'm getting buffered query
 errors. This function is part of a Database Manager class and is
 supposed to return a PDO::Statement with the number of rows being stored
 in a referenced paramater.

 Error:
 'SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other
 unbuffered queries are active. Consider using PDOStatement::fetchAll().
 Alternatively, if your code is only ever going to run against mysql, you
 may enable query buffering by setting the
 PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute.' in
 E:\Server\swi\qpf\mng\data.class.php:64 Stack trace: #0
 E:\Server\swi\qpf\mng\data.class.php(64): PDOStatement-execute() #1
 E:\Server\swi\www\db.php(13): DM::select('* FROM cdrs WHE...', 20, -1)
 #2 {main} thrown in E:\Server\swi\qpf\mng\data.class.php on line 64


 Function:

 public static function select($sql, $count = NULL, $limit = NULL)
 {
  $db = self::handle(); #Singleton method to create/retrieve db handle
  $buf = array(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY = TRUE);

  $sql = 'SELECT '.(!is_null($count)?'SQL_CALC_FOUND_ROWS ':'').$sql;

  $stmt = $db-prepare($sql, $buf);
  $stmt-execute();

  if (!is_null($count)) {
  $rows = $db-prepare('SELECT found_rows() AS rows', $buf);
  $rows-execute(); #ERROR HERE
  $rows_array = $rows-fetch(PDO::FETCH_NUM);
  $rows-closeCursor();
  $count = $rows_array[0];

  if (!is_null($limit)  $count  $limit) {
  $count = $limt;
  }
  }

  return $stmt;
 }

 Where am I going wrong here?

 Rob

 Micah Stevens wrote:
  There's a function called 'found_rows()' function, so you could try
  issuing a query, then issuing a second one 'SELECT FOUND_ROWS();' and it
  should give the number of rows returned by the previous select.
 
  Here's details:
  http://dev.mysql.com/doc/refman/4.1/en/information-functions.html
 
  On Tuesday 08 November 2005 9:13 am, Micah Stevens wrote:
 yeah, it would help if I read the whole post. Sorry.
 
 On Tuesday 08 November 2005 9:06 am, Dwight Altman wrote:
 I suppose you could use count( PDOStatement::fetchAll() ), but I
 understand your amazement.
 
 mysql_num_rows() is specific to MySQL.  He wants a PDO version.
 
 -Original Message-
 From: Micah Stevens [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, November 08, 2005 10:51 AM
 To: php-db@lists.php.net
 Subject: Re: [PHP-DB] [PDO] Number of rows found by Select
 
 
 
 mysql_num_rows()
 
 On Tuesday 08 November 2005 5:17 am, Rob C wrote:
 What is the recommended way to find the number of rows found by a
 SELECT query? PDOStatement::rowCount() doesn't work with MySQL and is a
 bit of a hack anyway. Doing a COUNT(*) before the SELECT is very
 hackish - the data could have changed and it's an extra query. What is
 there that's better than either of these? Is there any way to use
 COUNT(*) without risking data change, such as inside a transaction?
 
 I'm amazed that there is no mysql_num_rows() equivilent, I get the
 feeling that I'm missing something obvious. I can only presume there is
 some technical limitation that I'm not appreciating, if anyone can shed
 some light on this, I'd like to know.
 
 I'm new to both PDO and this mailing list, so please be gentle with me.
 I'm using PDO 1.0RC2, PHP 5.0.5 and MySQL 4.1.15.
 
 Rob
 
 --

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



Re: [PHP-DB] [PDO] Number of rows found by Select

2005-11-08 Thread Micah Stevens

mysql_num_rows()


On Tuesday 08 November 2005 5:17 am, Rob C wrote:
 What is the recommended way to find the number of rows found by a SELECT
   query? PDOStatement::rowCount() doesn't work with MySQL and is a bit
 of a hack anyway. Doing a COUNT(*) before the SELECT is very hackish -
 the data could have changed and it's an extra query. What is there
 that's better than either of these? Is there any way to use COUNT(*)
 without risking data change, such as inside a transaction?

 I'm amazed that there is no mysql_num_rows() equivilent, I get the
 feeling that I'm missing something obvious. I can only presume there is
 some technical limitation that I'm not appreciating, if anyone can shed
 some light on this, I'd like to know.

 I'm new to both PDO and this mailing list, so please be gentle with me.
 I'm using PDO 1.0RC2, PHP 5.0.5 and MySQL 4.1.15.

 Rob

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



Re: [PHP-DB] [PDO] Number of rows found by Select

2005-11-08 Thread Micah Stevens

yeah, it would help if I read the whole post. Sorry. 

On Tuesday 08 November 2005 9:06 am, Dwight Altman wrote:
 I suppose you could use count( PDOStatement::fetchAll() ), but I
 understand your amazement.

 mysql_num_rows() is specific to MySQL.  He wants a PDO version.

 -Original Message-
 From: Micah Stevens [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, November 08, 2005 10:51 AM
 To: php-db@lists.php.net
 Subject: Re: [PHP-DB] [PDO] Number of rows found by Select



 mysql_num_rows()

 On Tuesday 08 November 2005 5:17 am, Rob C wrote:
  What is the recommended way to find the number of rows found by a SELECT
query? PDOStatement::rowCount() doesn't work with MySQL and is a bit
  of a hack anyway. Doing a COUNT(*) before the SELECT is very hackish -
  the data could have changed and it's an extra query. What is there
  that's better than either of these? Is there any way to use COUNT(*)
  without risking data change, such as inside a transaction?
 
  I'm amazed that there is no mysql_num_rows() equivilent, I get the
  feeling that I'm missing something obvious. I can only presume there is
  some technical limitation that I'm not appreciating, if anyone can shed
  some light on this, I'd like to know.
 
  I'm new to both PDO and this mailing list, so please be gentle with me.
  I'm using PDO 1.0RC2, PHP 5.0.5 and MySQL 4.1.15.
 
  Rob

 --

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



Re: [PHP-DB] [PDO] Number of rows found by Select

2005-11-08 Thread Micah Stevens

There's a function called 'found_rows()' function, so you could try issuing a 
query, then issuing a second one 'SELECT FOUND_ROWS();' and it should give 
the number of rows returned by the previous select. 

Here's details:
http://dev.mysql.com/doc/refman/4.1/en/information-functions.html



On Tuesday 08 November 2005 9:13 am, Micah Stevens wrote:
 yeah, it would help if I read the whole post. Sorry.

 On Tuesday 08 November 2005 9:06 am, Dwight Altman wrote:
  I suppose you could use count( PDOStatement::fetchAll() ), but I
  understand your amazement.
 
  mysql_num_rows() is specific to MySQL.  He wants a PDO version.
 
  -Original Message-
  From: Micah Stevens [mailto:[EMAIL PROTECTED]
  Sent: Tuesday, November 08, 2005 10:51 AM
  To: php-db@lists.php.net
  Subject: Re: [PHP-DB] [PDO] Number of rows found by Select
 
 
 
  mysql_num_rows()
 
  On Tuesday 08 November 2005 5:17 am, Rob C wrote:
   What is the recommended way to find the number of rows found by a
   SELECT query? PDOStatement::rowCount() doesn't work with MySQL and is a
   bit of a hack anyway. Doing a COUNT(*) before the SELECT is very
   hackish - the data could have changed and it's an extra query. What is
   there that's better than either of these? Is there any way to use
   COUNT(*) without risking data change, such as inside a transaction?
  
   I'm amazed that there is no mysql_num_rows() equivilent, I get the
   feeling that I'm missing something obvious. I can only presume there is
   some technical limitation that I'm not appreciating, if anyone can shed
   some light on this, I'd like to know.
  
   I'm new to both PDO and this mailing list, so please be gentle with me.
   I'm using PDO 1.0RC2, PHP 5.0.5 and MySQL 4.1.15.
  
   Rob
 
  --

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



Re: [PHP-DB] Using PHP to import a DB

2005-11-05 Thread Micah Stevens



system(mysql -u user -p db  /tmp/mydb);



On Saturday 05 November 2005 4:02 pm, Todd Cary wrote:
 My client switched from a dedicated server to a shared server, so I
 cannot use the command line to import a DB that was produced with
 mysqldump.  Can I duplicate mysql -u user -p db  /tmp/mydb with php?

 Any suggestions are greatly appreciated

 Todd

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



Re: [PHP-DB] Using PHP to import a DB

2005-11-05 Thread Micah Stevens

Don't use it, use --password= instead.. 

The downside to this is that anyone can see your password in the process list, 
but I'm going to hazard a guess that no users are scanning the process list 
that often on a shared webserver. 

-Micah 

On Saturday 05 November 2005 5:21 pm, Todd Cary wrote:
 Micah -

 With the -p switch, the user is asked for the password.  How does that
 happen with the system command?

 Todd

 Micah Stevens wrote:
  system(mysql -u user -p db  /tmp/mydb);
 
  On Saturday 05 November 2005 4:02 pm, Todd Cary wrote:
 My client switched from a dedicated server to a shared server, so I
 cannot use the command line to import a DB that was produced with
 mysqldump.  Can I duplicate mysql -u user -p db  /tmp/mydb with php?
 
 Any suggestions are greatly appreciated
 
 Todd

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



Re: [PHP-DB] PHP and MSSQL on Linux

2005-11-02 Thread Micah Stevens

Run it from the command line as the apache user. See if that makes a 
difference. I'd guess not though.

Apache's php module doesn't really put any restrictions that I know of on the 
scripting.. that's a strange effect.. 

On Wednesday 02 November 2005 10:54 am, [EMAIL PROTECTED] wrote:
 I originally posted this to the general discussion but wanted to see if
 anyone on this list had an idea.  The issue is trying to connect to the
 MSSQL with PHP from a linux box (Fedora Core 4 in this instance)

  An interesting development.  I found some reference to running my PHP
  script from the command line to take Apache out of the picture.  Lo and
  behold, the script worked.  I was able to connect to the server.  So the
  issue seems to be related with Apache.  Any idea what I would need to do
  there to make the script work via the web?
 
  Robbert
 
  [EMAIL PROTECTED] wrote on 11/02/2005, 05:50:01 PM:
   Thanks for your help.  I'd love to hear if you have any success with
   the RPMs.  Something I've seen over and over again in the documentation
   is the compilation of php adding --with-mssql.  My PHP info output
   does not include that marker.
  
   The output is as follows
   './configure' '--build=i386-redhat-linux' '--host=i386-redhat-linux'
   '--target=i386-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr'
   '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin'
   '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include'
   '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var'
   '--sharedstatedir=/usr/com' '--mandir=/usr/share/man'
   '--infodir=/usr/share/info' '--cache-file=../config.cache'
   '--with-libdir=lib' '--with-config-file-path=/etc'
   '--with-config-file-scan-dir=/etc/php.d' '--disable-debug' '--with-pic'
   '--disable-rpath' '--with-bz2' '--with-curl' '--with-exec-dir=/usr/bin'
   '--with-freetype-dir=/usr' '--with-png-dir=/usr'
   '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-gmp'
   '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-png'
   '--with-pspell' '--with-expat-dir=/usr' '--with-pcre-regex=/usr'
   '--with-zlib' '--with-layout=GNU' '--enable-exif' '--enable-ftp'
   '--enable-magic-quotes' '--enable-sockets' '--enable-sysvsem'
   '--enable-sysvshm' '--enable-sysvmsg' '--enable-track-vars'
   '--enable-trans-sid' '--enable-yp' '--enable-wddx'
   '--with-pear=/usr/share/pear' '--with-kerberos'
   '--enable-ucd-snmp-hack' '--with-unixODBC=shared,/usr'
   '--enable-memory-limit' '--enable-shmop' '--enable-calendar'
   '--enable-dbx' '--enable-dio' '--with-mime-magic=/etc/httpd/conf/magic'
   '--without-sqlite' '--with-libxml-dir=/usr' '--with-xml'
   '--with-apxs2=/usr/sbin/apxs' '--without-mysql' '--without-gd'
   '--without-odbc' '--disable-dom' '--disable-dba'
  
   Howver, under additional .ini files parsed, I see the mssql file:
   /etc/php.d/ldap.ini, /etc/php.d/mssql.ini, /etc/php.d/mysql.ini,
   /etc/php.d/mysqli.ini, /etc/php.d/odbc.ini
  
   And further on down are the mssql configuration settings.
  
   Rick Emery  wrote on 11/02/2005, 05:19:06 PM:
Quoting [EMAIL PROTECTED]:
 Yup, I thought that was the problem too but when I added my server
 to the conf file, there was no change.  When you set up your MSSQL
 connection in fedora, did you install anything else other than
 MSSQL and PHP-MSSQL?  Or did you have to set anything in your
 php.ini file to use the new extension?
   
Well, I didn't have the rpms; I compiled from source. I don't have
that box available anymore, but I've checked my notes. First, I
compiled freetds (nothing special in the configure line), then I
compiled php using --with-mssql=/usr (to point to the freetds
libraries). All of this should have been handled within the rpms,
though, and if phpinfo is showing the mssql extension loaded, I'm not
sure why it wouldn't be working. I don't remember modifying php.ini
at all for the mssql stuff.
   
Hopefully over the next couple of days I'll have some time to set up
a test box and try the rpms to which you pointed me, to see if I run
into the same trouble.
   
Rick
   
--
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 General 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 and MSSQL on Linux

2005-11-02 Thread Micah Stevens

System commands are supposed to output errors on STERR, not on STOUT, php's 
system commands only grab STOUT so if there's an error you'll get no output.. 
You need to redirect STERR to STOUT when you issue the command.. 

Just put this at the end of your command: 
21

Don't know if that's the issue, but it sounds like it. 

-Micah 


On Wednesday 02 November 2005 11:36 am, [EMAIL PROTECTED] wrote:
 I ran it as the apache user and it worked fine (from the command line).
   I do notice that when I run a system command using the exec or system
 functions, I get nothing back on some of the commands (primarily
 traceroute and ping).  Others do work (whoami)

 Robbert

 Micah Stevens [EMAIL PROTECTED] wrote on 11/02/2005, 07:58:55

 PM:
  Run it from the command line as the apache user. See if that makes a
  difference. I'd guess not though.
 
  Apache's php module doesn't really put any restrictions that I know of on
  the scripting.. that's a strange effect..
 
  On Wednesday 02 November 2005 10:54 am, [EMAIL PROTECTED] wrote:
   I originally posted this to the general discussion but wanted to see if
   anyone on this list had an idea.  The issue is trying to connect to the
   MSSQL with PHP from a linux box (Fedora Core 4 in this instance)
  
An interesting development.  I found some reference to running my PHP
script from the command line to take Apache out of the picture.  Lo
and behold, the script worked.  I was able to connect to the server. 
So the issue seems to be related with Apache.  Any idea what I would
need to do there to make the script work via the web?
   
Robbert
   
[EMAIL PROTECTED] wrote on 11/02/2005, 05:50:01 PM:
 Thanks for your help.  I'd love to hear if you have any success
 with the RPMs.  Something I've seen over and over again in the
 documentation is the compilation of php adding --with-mssql.  My
 PHP info output does not include that marker.

 The output is as follows
 './configure' '--build=i386-redhat-linux'
 '--host=i386-redhat-linux' '--target=i386-redhat-linux-gnu'
 '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr'
 '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc'
 '--datadir=/usr/share' '--includedir=/usr/include'
 '--libdir=/usr/lib' '--libexecdir=/usr/libexec'
 '--localstatedir=/var' '--sharedstatedir=/usr/com'
 '--mandir=/usr/share/man'
 '--infodir=/usr/share/info' '--cache-file=../config.cache'
 '--with-libdir=lib' '--with-config-file-path=/etc'
 '--with-config-file-scan-dir=/etc/php.d' '--disable-debug'
 '--with-pic' '--disable-rpath' '--with-bz2' '--with-curl'
 '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr'
 '--with-png-dir=/usr'
 '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext'
 '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl'
 '--with-png' '--with-pspell' '--with-expat-dir=/usr'
 '--with-pcre-regex=/usr' '--with-zlib' '--with-layout=GNU'
 '--enable-exif' '--enable-ftp' '--enable-magic-quotes'
 '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm'
 '--enable-sysvmsg' '--enable-track-vars' '--enable-trans-sid'
 '--enable-yp' '--enable-wddx'
 '--with-pear=/usr/share/pear' '--with-kerberos'
 '--enable-ucd-snmp-hack' '--with-unixODBC=shared,/usr'
 '--enable-memory-limit' '--enable-shmop' '--enable-calendar'
 '--enable-dbx' '--enable-dio'
 '--with-mime-magic=/etc/httpd/conf/magic' '--without-sqlite'
 '--with-libxml-dir=/usr' '--with-xml'
 '--with-apxs2=/usr/sbin/apxs' '--without-mysql' '--without-gd'
 '--without-odbc' '--disable-dom' '--disable-dba'

 Howver, under additional .ini files parsed, I see the mssql file:
 /etc/php.d/ldap.ini, /etc/php.d/mssql.ini, /etc/php.d/mysql.ini,
 /etc/php.d/mysqli.ini, /etc/php.d/odbc.ini

 And further on down are the mssql configuration settings.

 Rick Emery  wrote on 11/02/2005, 05:19:06 PM:
  Quoting [EMAIL PROTECTED]:
   Yup, I thought that was the problem too but when I added my
   server to the conf file, there was no change.  When you set up
   your MSSQL connection in fedora, did you install anything else
   other than MSSQL and PHP-MSSQL?  Or did you have to set
   anything in your php.ini file to use the new extension?
 
  Well, I didn't have the rpms; I compiled from source. I don't
  have that box available anymore, but I've checked my notes.
  First, I compiled freetds (nothing special in the configure
  line), then I compiled php using --with-mssql=/usr (to point to
  the freetds libraries). All of this should have been handled
  within the rpms, though, and if phpinfo is showing the mssql
  extension loaded, I'm not sure why it wouldn't be working. I
  don't remember modifying php.ini at all for the mssql stuff.
 
  Hopefully over the next couple of days I'll have some time to set
  up

Re: [PHP-DB] PHP MSSQL on Linux

2005-11-01 Thread Micah Stevens
Is it from php or the mssql driver? If it's from the driver, then the library 
is installed at least partially correctly. If it's from php, perhaps not. 

From there you can narrow it down by checking the connection parameters 
outside of php to make sure they're right, is there a mssql client for linux?

If the driver is loading, I would hope it would give better error messages 
than just 'connection failed'.. but as I've never used the driver I might be 
wrong. 

You can also packet sniff the network during the connection attempt to see 
what goes on there, there's lots of clues that could be helpful in the packet 
stream. 

-Micah 

On Tuesday 01 November 2005 2:30 pm, [EMAIL PROTECTED] wrote:
 A few months back I wrote the list asking for help making a connection
 to a MS SQL database from our linux webserver.  At that time I was able
 to make a successfull connection on Fedora Core 1 after installing
 php-mssql.rpm and a freetds rpm.  When I upgradd to FC4, I was unable
 to continue my project because the RPMs had not been built for
 PHP5.0.4, whic is the version we run now.

 Today, I was able to get the version of php-mssql I needed and installed
 it successfully.  I am able to make a connection to our ms sql server
 using tsql.  There is a mssql.ini file in the php.d directory and the
 mssql.so file is in /usr/lib/php/modules/.  Using the
 get_loaded_extensions fuction, I see that mssql is a loaded module and
 the phpinfo() function shows me mssql configuration files.  All
 indicators tell me that I should be able to connect.

 Obvsiously, since I'm posting to the list, you can guess that it's not
 working.  The error message I get back is useless as I'm only told that
 the connection failed.  Does anyone know anything else I need to check
 to get the connection working?

 Thank you,
 Robbert van Andel

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



Re: [PHP-DB] PHP MSSQL on Linux

2005-11-01 Thread Micah Stevens

Hmm.. if you're using a function like mssql_error or something like that, it's 
likely coming from the driver and not php.. 

Did you see this on the docs page?

I have spent the last 2 days trying to get PHP to connect to MSDE on Windows 
2003 Web Edition.
 
 Although initally PHP would connect to the database without a problem, it 
would then refuse to connect, hitting F5 enough times would eventually 
connect to the database. As you can imagine this intermittent problem was 
hard to trace.
 
 I was using PHP 5.0.5 (although 5.0.4 has the same problem) on a Windows 2003 
Web Edition SP1 server, and was trying to connect to MSDE Rel A.
 
 Solution:
 ~
 
 Firstly MSDE needed to be installed with the following arguments: 
SECURITYMODE=SQL DISABLENETWORKPROTOCOLS=0.
 
 Secondly it was necessary to delete ntwdblib.dll from c:\php
 
 Thirdly I downloaded the SQL 2000 evaluation and installed only the client 
tools on a seperate PC (Ent. Manager will now connect to the database).
 
 Lastly I copied the version of ntwdblib.dll from the PC with Ent. Manager on 
it (ver 2000.80.2039.0) to c:\windows\system32\
 
 After a re-boot no more connection problems.
 
 Pls note that this is only for 2003 Web Edition with MSDE, this problem does 
not seem to occour with Standard Edition

-Micah

On Tuesday 01 November 2005 3:18 pm, [EMAIL PROTECTED] wrote:
 The error I'm getting is from the PHP function. Both mssql_connect and
 PEAR are returning the same error.  As far as I can tell, mssql only
 returns the last line of an error message so I can't be sure that the
 error I'm seeing is from MSSQL or PHP.  Running TCPdump shows no
 traffic is going to my sql database from the webserver.  But when I run
 tsql,it shows that communication occurred.

 This looks like a problem with my PHP configuration but I'm at a loss as
 to what it is.

 Robbert

 Micah Stevens [EMAIL PROTECTED] wrote on 11/01/2005, 11:55:52

 PM:
  Is it from php or the mssql driver? If it's from the driver, then the
  library is installed at least partially correctly. If it's from php,
  perhaps not.
 
  From there you can narrow it down by checking the connection parameters
  outside of php to make sure they're right, is there a mssql client for
  linux?
 
  If the driver is loading, I would hope it would give better error
  messages than just 'connection failed'.. but as I've never used the
  driver I might be wrong.
 
  You can also packet sniff the network during the connection attempt to
  see what goes on there, there's lots of clues that could be helpful in
  the packet stream.
 
  -Micah
 
  On Tuesday 01 November 2005 2:30 pm, [EMAIL PROTECTED] wrote:
   A few months back I wrote the list asking for help making a connection
   to a MS SQL database from our linux webserver.  At that time I was able
   to make a successfull connection on Fedora Core 1 after installing
   php-mssql.rpm and a freetds rpm.  When I upgradd to FC4, I was unable
   to continue my project because the RPMs had not been built for
   PHP5.0.4, whic is the version we run now.
  
   Today, I was able to get the version of php-mssql I needed and
   installed it successfully.  I am able to make a connection to our ms
   sql server using tsql.  There is a mssql.ini file in the php.d
   directory and the mssql.so file is in /usr/lib/php/modules/.  Using the
   get_loaded_extensions fuction, I see that mssql is a loaded module and
   the phpinfo() function shows me mssql configuration files.  All
   indicators tell me that I should be able to connect.
  
   Obvsiously, since I'm posting to the list, you can guess that it's not
   working.  The error message I get back is useless as I'm only told that
   the connection failed.  Does anyone know anything else I need to check
   to get the connection working?
  
   Thank you,
   Robbert van Andel
 
  --
  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



  1   2   3   >