Re: [PHP-DB] how do i fetch some text

2005-05-31 Thread Jochem Maas

chintan wrote:

how do i fetch some text from a webpage for some generated field?
like i want to fetch a score line from a sport site in which the line 
says score?
actually i want to fetch an IP from my ISP's page which displays it with 
my user name.


where is the DB in this question? (probably you would get better response
on the php-generals list.)

what you want to do sounds quite involved, if you want your script to grab
the same page as you see in your browser then you will probably
have to use something like the cURL extension or use a shell cmd like 'wget'
in order that you can spoof UserAgent headers, pass login info, send a
valid cookie along with the request.
once you have the page you will have use some code to 'scrape' out the data you 
want,
a suitable regular expression is the first thing that springs to mind 
inconjunction
with preg_match() - but there are lots of other ways, php is abounds with
string searching and manipulation function (time to dig into the manual :-)

you might also want to search for the term 'screen scraping' or variations
in order to get a better understanding of how to go about it.

maybe there is a much easier way to do what you want.
in order to find out answer the following 2 questions, maybe it will
help someone to offer a totally different solution:

1. what is the relevance of the IP address, to what does it belong?
2. why do you need this IP? what is your end goal?

rgds,
Jochem





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



[PHP-DB] use of pg_query_params

2005-05-31 Thread Magnus Kvalheim

Hi,

I'm trying to make use of the pg_query_params function (ref: 
http://dk2.php.net/manual/en/function.pg-query-params.php ), but keep 
getting the error: Fatal error: Call to undefined function 
pg_query_params()


I have
PHP Version 5.0.3
PostgreSQL 8.0.3

I belive to have read that the pg_query_params is only available in some 
of the steam-builds, but were unable to find this post again.


Can someone comfirm or suggest a solution to make this work.

best
Magnus

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



[PHP-DB] Re: DB dont_die and errors

2005-05-31 Thread Román Sánchez

Hi all,

When the connection fails, the default behaviour is to die, printing also the 
dns, with user and password!!!


How can I avoid this?



If the package you use won't give an option to avoid this you could 
buffer the output with the ob_xxx functions.


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



Re: [PHP-DB] Missing mysql.so?. .

2005-05-31 Thread Martin Norland

KEVIN ZEMBOWER wrote:

I'm trying to fix PHP and MySQL on a Debian woody system that might be pretty 
messed up. The system has some parts, perhaps some libraries, in Debian testing 
with the bulk of the system in stable. I thought it's been running okay since I 
made these system changes, but today I had to reboot it and php and MySQL 
failed.

I've removed and reinstalled the Debian packages from stable:
cn2:/var/www/centernet/htdocs/phpmyadmin# apt-get install -t stable php4 
php4-cgi php4-common php4-mysql php4-mcal php4-cli

[snip]

Is it normal that the php4, php4-mysql, php4-mcal and php4-cgi versions are all 
4.1.2, but that php4-common and php4-cli are 4.3.10?

[snip]

I tried linking or copying the files in 20010901 to 20020429, but that gave an 
error about a mismatch.

Any suggestions on what I can try to get this system back in working order? If 
possible, I'd like to stay within the Debian system, using Debian package 
management commands rather than downloading source and recompiling.

Thanks for reading through all this and for your advice and suggestions.


php4-cli and php4-common don't exist in stable, it's pulling from 
testing - I expect you've got apt-pining setup:

http://packages.debian.org/cgi-bin/search_packages.pl?keywords=php4searchon=namessubword=1version=allrelease=all

so I would start there...
apt-get remove php4-common php4-cli php4-mysql;
apt-get update;
apt-get install php4-mysql;
see how that goes.  You might need to re-remove everything.  When all is 
said and done check your php.ini, in case it has remaining lines 
pointing at wrong libs/etc.


cheers,
--
- Martin Norland, Sys Admin / Database / Web Developer, International 
Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.


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



Re: [PHP-DB] How many rows for 100 questions?

2005-05-31 Thread ...helmut
THank you for ya'lls feedback, one more question in regards to ID's, Primary 
Keys and indexing.

Lets say that in the future the admin wants to list all the records for 
answer 50, now, if I have my user ID as the primary key, do I have to index 
all my answers so they are easy to search? or it doesnt really matter?

Thanks!

-- 
...helmut
helmutgranda.com



Andrés G. Montañez [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 I have a questionary that has 100 questions,
 
 Should I create 2 tables 1 with the user information and the second one
 with
 the 100 questions? What is your recommendation?

I recommend you the next table configuration:

1 table for users
1 table for the questions (so you can have more than 100)
IF the User can Input the Answer - 1 table with User ID, Questin ID
and the Answer
IF the User only selects a pre-defined Answer - 1 table Answer ID,
Questin ID, Answer

1 table User ID, Questin ID, Answer ID

IF the User can select a pre-defined answer OR input, a MIX of both 
solutions.

-- 
Atte, Andrés G. Montañez
Técnico en Redes y Telecomunicaciones
Montevideo - Uruguay 

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



[PHP-DB] write to file, difficulty inputting data

2005-05-31 Thread mayo
I'm writing customer orders into a file. I'm 
 
1. getting data from session variables and a database,
2. putting it into a variable called $fileContent
3. then touch($filename);
4. then writing $fileContent to $filename - the code is at the bottom
 
The test versions of this have all gone well.
 
The file must contain the data in a preset format. All the data is on
one line (no line breaks) and each field has a preset limit, The file is
FTPed and the data parsed.
 
So far so good. It works with one customer order
 
Now when I want to write multiple customer orders it doesn't work?
Abbreviated code is below
 
// CODE FOR MULTIPLE ORDERS
 
while($row = mysql_fetch_array( $result ))
{
 
$theItemID=$row[orderedItems.itemID];
$theItemPrice=$row[itemPrice];
$theItemQty=$row[itemQty];
 
$thisItemID= sprintf(% 6d,$theItemID);
$thisItemPrice= sprintf(%7.2f,$theItemPrice);
$thisItemQty= sprintf(% 7d,$theItemQty);
 
$moreContent=
 
\n .
20 .
$thisOrder .
 
$thisItemID .
 
$thisItemPrice .
 
$thisItemQty . \n;
 
}
//END CODE
 
// CODE BELOW IS FOR WRITE TO FILE
 
// Make sure the file exists and is writable first.
if (is_writable($filename)) {
 
// Open $filename in write mode.
 
if (!$handle = fopen($filename, 'w')) {
 echo Cannot open file ($filename);
 exit;
}
 
// Write $fileContent to opened file.
if (fwrite($handle, $fileContent) === FALSE) {
echo Cannot write to file ($filename);
exit;
}
 
fclose($handle);


Re: [PHP-DB] How many rows for 100 questions?

2005-05-31 Thread Bastien Koert
indexes should, on average, be applied to any column(s) that are in a where 
clause, multi-column indexes are acceptable


bastien


From: ...helmut [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: Re: [PHP-DB] How many rows for 100 questions?
Date: Tue, 31 May 2005 15:38:31 -0500

THank you for ya'lls feedback, one more question in regards to ID's, 
Primary

Keys and indexing.

Lets say that in the future the admin wants to list all the records for
answer 50, now, if I have my user ID as the primary key, do I have to index
all my answers so they are easy to search? or it doesnt really matter?

Thanks!

--
...helmut
helmutgranda.com



Andrés G. Montañez [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I have a questionary that has 100 questions,
 
 Should I create 2 tables 1 with the user information and the second one
 with
 the 100 questions? What is your recommendation?

I recommend you the next table configuration:

1 table for users
1 table for the questions (so you can have more than 100)
IF the User can Input the Answer - 1 table with User ID, Questin ID
and the Answer
IF the User only selects a pre-defined Answer - 1 table Answer ID,
Questin ID, Answer

1 table User ID, Questin ID, Answer ID

IF the User can select a pre-defined answer OR input, a MIX of both
solutions.

--
Atte, Andrés G. Montañez
Técnico en Redes y Telecomunicaciones
Montevideo - Uruguay

--
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] how do i fetch some text

2005-05-31 Thread chintan

Jochem Maas wrote:

chintan wrote:


how do i fetch some text from a webpage for some generated field?
like i want to fetch a score line from a sport site in which the line 
says score?
actually i want to fetch an IP from my ISP's page which displays it 
with my user name.



where is the DB in this question? (probably you would get better response
on the php-generals list.)

what you want to do sounds quite involved, if you want your script to grab
the same page as you see in your browser then you will probably
have to use something like the cURL extension or use a shell cmd like 
'wget'

in order that you can spoof UserAgent headers, pass login info, send a
valid cookie along with the request.
once you have the page you will have use some code to 'scrape' out the 
data you want,
a suitable regular expression is the first thing that springs to mind 
inconjunction

with preg_match() - but there are lots of other ways, php is abounds with
string searching and manipulation function (time to dig into the manual :-)

you might also want to search for the term 'screen scraping' or variations
in order to get a better understanding of how to go about it.

maybe there is a much easier way to do what you want.
in order to find out answer the following 2 questions, maybe it will
help someone to offer a totally different solution:

1. what is the relevance of the IP address, to what does it belong?
2. why do you need this IP? what is your end goal?

rgds,
Jochem



I want this ip to forward the website to my computer's web which has 
currently free domain named jantasalescorporation.browse.to
I have put a web on a free link and i want to have a transfer link on 
that web to my pc's site as it runs on dynamic or

just tell me if u can go the http://www.jantasalescorporation.browse.to
and search and view the website.
And i doesn't know that DNS setup?!!

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