[PHP-DB] RE: PHP help question

2008-02-13 Thread Matthias Willerich
 The Database is created on PC A... I'm working on PC B... and my
 problem is that i am not able to connect to the PC A Database using
 the IP address as a host (since the database is not on my machine).
 but if i'm on PC A i can connect with the localhost.
 
 The question is that: do i need any configuration so i can access the
 database?

First things first: This has nothing to do with PHP itself, it's just a
configuration issue.

You need to check the following things: Is your configuration on PC B set up
to the right IP (as host), db, username and password? On PC A, what host is
associated with the user? If it's localhost, it won't work. I think that you
can set up the same user for localhost and any host with different
passwords, make sure that's not the case (or that you have the right
password on PC B). Finally, do any firewalls on PC B or PC A or other
network constraints let the communication through?

This is all fairly basic, but I hope it helps.

Cheers,
Matthias

--
Matthias Willerich
http://www.contentwithstyle.co.uk

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



[PHP-DB] RE: Turning result into array from columns

2006-09-23 Thread Matthias Willerich
Hello,
  $q = sprintf(SELECT id FROM content);
This has nothing to do with your problem, but why don't you just do the
following?
$q = 'SELECT id FROM content'; 

But here's your problem. Change
  $realones = $row['id'];
into
$realones[] = $row['id'];
And you get your desired result.

Matthias

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



[PHP-DB] RE: Ye old $_SESSION variables :)

2006-03-14 Thread Matthias Willerich
 Try to make a small new script that only contains a form and a session.
 Then try a from with the same field names as the variable names.
 name='test' = $_SESSION['test'].
 When the session data is overwritten by the second try, registerglobals is
 switchd on.
 The thing you can do then is to rename your form fields. I use:
 name='in[YourFieldName]'
 This outputs an array:
 $_POST =
   in =
   YourFieldName = 'bar'
 
 Adriaan

Ayy. If registerglobals should be on, try to turn it off. It just supports
laziness and promotes confusion. But that's just my very subjective opinion.


Checking for registerglobals is a good idea, though, and grouping form
fields into an array is one as well, as long as you stay in php with your
backend.

Also, try fiddling with your cookie settings, if a lower setting solves the
problem, you have to add the session-id to the action in the form tag, i.e.
form method=post action=somewhere.php?
=?=session_name().'='.session_id();?

Ah, and, don't know if you knew or not: You can see what's left of your
session, your post and generally any array with print_r or vardump, i.e.
print_r($_SESSION); print_r($_POST). As other people said, you probably
either forgot to session_start() somewhere, or the post screws up the
transparent session id thingy, or registerglobals is on.

Matthias

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



RE: [PHP-DB] MySQL Connect using Dreamweaver

2005-10-13 Thread Matthias Willerich
That's a very common one. You're on windows, right?
Try putting in consider upgrading MySQL client into google. The first one
I found was this one:

http://www.experts-exchange.com/Web/Web_Languages/PHP/PHP_Windows/Q_21252231
.html

Although the guy first claims it's not the OLD_PASSWORD problem, believe me,
it is.

Alternatively look up the error code, although I don't know if that would've
helped in this case.

-Original Message-
From: W Roothman [mailto:[EMAIL PROTECTED]
Sent: 13 October 2005 06:18
To: php-db@lists.php.net
Subject: [PHP-DB] MySQL Connect using Dreamweaver


Dear All,

I have installed MySQL 5 with PHP 4.3.3.

When trying to connect to a database form the 'Database' tab in Dreamweaver,
I now get the following error when trying to select a DB:

'1251 Client does not support authentication protocol requested by server;
consider upgrading MySQL client'

Regards,

Will

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



RE: [PHP-DB] Defined Constants

2005-10-13 Thread Matthias Willerich
2 possibilities:
either you put the defined value instead of the definition down in the
option value (but i'm sure you thought of this one)
or you use echo constant($_POST['myType']);. Or GET, depending on how you
send your form.

Hey, this time I learned something, too! I found it in the php helpfile,
making my way from define to a chapter about constants, to this function.
Here, if you're looking for functionality things, I think it's better than
the online documentation:
http://www.php.net/download-docs.php


-Original Message-
From: Ng Hwee Hwee [mailto:[EMAIL PROTECTED]
Sent: 13 October 2005 07:13
To: PHP DB List
Subject: [PHP-DB] Defined Constants


Hi all,

just a very simple question. my form has the following define statements and
select box:

define(JOVIAL, likes to joke alot);
define(CHEERFUL, always wears a smile on his face);
define(ADVENTUROUS, likes sports and plays well too);
define(MYSTERIOUS, there's always something to discover everyday);

select name=myType
  option value=JOVIAL?=JOVIAL;?/option
  option value=CHEERFUL?=CHEERFUL;?/option
  option value=ADVENTUROUS?=ADVENTUROUS;?/option
  option value=MYSTERIOUS?=MYSTERIOUS;?/option
/select

after i post my form, the value $myType will be one of my define statements.
For example, user chooses CHEERFUL thus when i echo $myType, I will get
CHEERFUL but actually, what i really want to get is always wears a smile
on his face.

can someone advise me how i can achieve this?? sounds simple but i really
don't know how!! =(

thanks in advance!!
hwee

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



RE: [PHP-DB] ODBC Problem

2005-10-11 Thread Matthias Willerich
this sounds a little bit like a wrong charset. I don't know which one your
database or your php is running on, but, for a start, play with this:
- charset of the file: If you open your file in an editor that allows
storing it as different kinds of charsets, try saving it as something else.
It's probably ANSI, try UTF-8 or Unicode.
- charset of delivery: If your request ends in one or the other form of
html, remember to put in a content type, like this:
meta http-equiv=Content-Type content=text/html; charset=?php echo
$charset; ?
again, play around with the variable $charset, or, instead, hardcode it in
the way you need it. I'm not sure about this, but maybe you can change the
same thing by changing the character encoding in your browser manually and
not putting in any content-type. Once you've found what you need, put it in
as meta tag.

Cheers,
Matthias


-Original Message-
From: Rodrigo Haces [mailto:[EMAIL PROTECTED]
Sent: 10 October 2005 23:13
To: php-db@lists.php.net
Subject: [PHP-DB] ODBC Problem


Hi all:

Im  currently using php to connect to a database in another server, this is
a
intersystems cache database.

if i do a query to my database and the result has special spanish characters
like ´ (á,é,í,ó,ú) it returns me another character, this one changes from
time to time, i just tried to make a test with the isql shell program, i
connect and ask for the same query and in shell it returns the correct
characters.

If someone can help me please i'll apretiate.

Thanks
rodrigo

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

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



[PHP-DB] RE: domxml_open_mem and cdata

2005-10-07 Thread Matthias Willerich
so far no reply, but a little update:
I uploaded it to a linux server, similar setup(PHP4, apache1.3.something),
same problem.
Any ideas for a work-around? What do you use to edit XML on the
(php-)server? I don't have enough time to redo it for MSXML

Cheers,
Matthias

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



[PHP-DB] domxml_open_mem and cdata

2005-10-06 Thread Matthias Willerich
hello,
I hope this isn't too off-topic for the list, if it is, please point me to a
better one:

I have to edit an xml file, and I was going to do that via DOMXML. The
editing process itself is fine, but I now realised that all content that was
in cdata brackets gets stored back without them.

example:

$xml=content![CDATA[Hello list.]]/content;
$dom = domxml_open_mem($xml);
die($dom-dump_mem()); //echoes: contentHello list./content

I'm on
apache 1.3.33
php 4.4.0
domXML version 20020815
libxml version 20611
and the whole thing is on windows XP

this is of course simplified. if you tried it on your machine, you'll find
an xml header in the output, and of course, my input-xml has one.

The only proof of this that I have found so far is in a german phpforum,
where a guy has the exact same problem, but sadly noone replied. That makes
me think that it's either highly uncommon, unsolveable or a stupid error
everyone but me knows.

I'd alternatively use domxml_open_file (if that's the cure), but I get an
I/O error when I try opening a file, relative or absolute paths, same
directory or anywhere else. The content is fine after file_get_contents.

Help is highly appreciated,
Matthias

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



[PHP-DB] RE: Upload images with minimun effort from final user

2005-09-28 Thread Matthias Willerich
A.J. Brown:
snip
A better solution is to rename the image to the unique ID of the news
article it's associated with (assuming there is only one image allowed per
article).  This helps eliminate the chances of overwriting an existing image
without bothering the user with error messages.  When I do this, I usually
use the md5sum of the unique ID instead of the actual number.  For example:

$image_name = md5($article_id) . .jpg;
/snip

is there a reason for this md5 approach? As you don't add any information,
the news id is probably in the querystring anyway, how does it improve
anything?

I'm in the middle of writing an article about piecing together an imagebank
prototype, and I've found so far that most people would like to add extra
information, and store the image not connected to news or any listed
articles. Like this, they can be reused, without uploading them again. A
good filename approach is something still to do. Does it really matter, if
the filename is something identifiable? Is it not even nicer if it was
'image_title_'.$id.'.jpg'? more readable than a checksum?

Cheers,
Matthias

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



[PHP-DB] RE: DATE(r)

2005-09-09 Thread Matthias Willerich


you gave yourself half of the answer:
date('Y-m-d H:i:s');
http://uk.php.net/manual/en/function.date.php
do you work on a pc?
there's also a *.chm to download, which I find very convenient:
http://uk.php.net/download-docs.php
or, a firefox search extension, somewhere, to add to that top right
searchbox.

Matthias

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



RE: [PHP-DB] retrieve text from pdf

2005-09-08 Thread Matthias Willerich
I can second that.

I've worked with it under linux before (over a year ago, though), using
pdftotext with exec() or system(), and it worked very well in the tests. I
used it to index pdfs that other people were uploading and offer a little
teaser on the site. Sadly it never went live, and I changed companies and
forgot to take the code. But, seriously, this is not hard to use, once you
know how to use system calls in php.

Cheers,
Matthias

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