[PHP-DB] Insert Update

2001-08-05 Thread Joris Kluivers

thanks for the REPLACE INTO query

joris



[PHP-DB] Re: counting and displaying a how many figure

2001-08-05 Thread Hugh Bothwell


Dave Carrera [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi All

 I would like to know how to count how many downloads of a file I have on
my
 site is downloaded and display something like  file.name downloaded 
 times on my page.

 I have this idea using mysql db.
 table files
 ID int autoincrment,
 file_name,
 URL,

 I believe this would utilise something like the count() function but I
 haven't used this yet

Depends whether you want to track any additional information, like the IP of
the downloader or a timestamp; if so, you need a separate table with
per-download entries.

If all you want is a count, I would just add a field to the file table...
UPDATE TABLE files SET download_count=download_count+1 WHERE ID=$fileId.



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] List Results Not Working

2001-08-05 Thread Miles Thompson

I think Hugh nailed the problem, but when a script throws errors it's often 
helpful to save it with a .phps extension and call it from your browser. 
That often shows errors in syntax if a line isn't the colour you expect. It 
also forces you to look at it differently because the colourization often 
differs from your normal editor.

I assume that by now this glitch is well behind you.

Cheers - Miles

At 04:30 PM 8/4/01 -0400, Steve Fitzgerald wrote:
I'm trying to list the results of a query, but I keep getting the following
error:

   Parse error: parse error, expecting `T_STRING'
or `T_VARIABLE' or `T_NUM_STRING'

   I must be missing something because I can't
find what's causing the parse error.

   Any thoughts?

   $db = @mysql_select_db($db_name, $connection)
or die(mysql_error());

   $display_calls_sql = SELECT
CallID,CallDateTime,CallSubject,CallStatus FROM calls WHERE
   ContactID = $ContactID;

   $display_calls_result =
@mysql_query($display_calls_sql,$connection) or die(mysql_error());
   $numrows =
mysql_num_rows($display_calls_result);
   if ($numrows0) {
   while ($list =
mysql_fetch_array($display_calls_result)){
   echo .$list[CallID].
.$list[CallDateTime]. a

href=\display_call.php?ContactID=$ContactID\ .$list[CallSubject].
/a
   .$list[CallStatus]. brbr;

   }}




--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Cant load MSSQL extension (Win, PHP, Apache)

2001-08-05 Thread Phil

Hi everybody,

If I edit the php3.ini and activate a extension, I can see the effect with
the function phpinfo(). This works with all extensions, exept mssql.dll and
mssql70.dll. What am I doing wrong?? I dont think this is a general
problem!!

And, ladies and gentleman, I need help... thx!!


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] checking for results return from mysql

2001-08-05 Thread Jon Yaggie

i suppose this much have a simple solution i am missing.  but here is the situation.

i want to checkand see if my query returned any results.   problem is if i check liek 
this -
if($results = mysql_fetch_array($result))

it appears that a resource is returned regardless.  so this is always true.

the real problem is that i need to find out if something is returned without actually 
accessing the data.  because this if statement appears to be calling the first row of 
result data so later when i use a while loop to go through the data i am missing the 
first result returned.

i have tried putting a few other mysql function in the conditional.  maybe i am on the 
wrong path  . . would one of the cariable functions like isset()  or soemthing check 
this?








Thank You,
 
Jon Yaggie
www.design-monster.com
 
And they were singing . . . 
 
'100 little bugs in the code
100 bugs in the code
fix one bug, compile it again
101 little bugs in the code
 
101 little bugs in the code . . .'
 
And it continued until they reached 0





RE: [PHP-DB] checking for results return from mysql

2001-08-05 Thread olinux

try this

$result = mysql_query($sql_query);

if ($result) {
  while ($row = mysql_fetch_array($result)) {
  $var_1 = $row['var_1'];
  $var_2 = $row['var_2'];
  }
}


olinux

-Original Message-
From: Jon Yaggie [mailto:[EMAIL PROTECTED]]
Sent: Sunday, August 05, 2001 1:36 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] checking for results return from mysql


i suppose this much have a simple solution i am missing.  but here is the
situation.

i want to checkand see if my query returned any results.   problem is if i
check liek this -
if($results = mysql_fetch_array($result))

it appears that a resource is returned regardless.  so this is always true.

the real problem is that i need to find out if something is returned without
actually accessing the data.  because this if statement appears to be
calling the first row of result data so later when i use a while loop to go
through the data i am missing the first result returned.

i have tried putting a few other mysql function in the conditional.  maybe i
am on the wrong path  . . would one of the cariable functions like isset()
or soemthing check this?








Thank You,

Jon Yaggie
www.design-monster.com

And they were singing . . .

'100 little bugs in the code
100 bugs in the code
fix one bug, compile it again
101 little bugs in the code

101 little bugs in the code . . .'

And it continued until they reached 0




_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Fw: [PHP-DB] checking for results return from mysql

2001-08-05 Thread Jon Yaggie

meant ot post this to the list   .. .



 i tried this.  but it appears if($result) always returns true . . .(or
maybe
 i am crazy but mine seemsed to.  of course unless there is error.

 but i did find a function who i am open to better suggestions because it
 seems kine out of the way solution

 if(mysql_fetch_array($result))
 {

 $mysql_data_seek($result, 0);

 while . . . . .


 - Original Message -
 From: olinux [EMAIL PROTECTED]
 To: Jon Yaggie [EMAIL PROTECTED]; php-db
 [EMAIL PROTECTED]
 Sent: Monday, August 06, 2001 12:19 AM
 Subject: RE: [PHP-DB] checking for results return from mysql


  try this
 
  $result = mysql_query($sql_query);
 
  if ($result) {
while ($row = mysql_fetch_array($result)) {
$var_1 = $row['var_1'];
$var_2 = $row['var_2'];
}
  }
 
 
  olinux
 
  -Original Message-
  From: Jon Yaggie [mailto:[EMAIL PROTECTED]]
  Sent: Sunday, August 05, 2001 1:36 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP-DB] checking for results return from mysql
 
 
  i suppose this much have a simple solution i am missing.  but here is
the
  situation.
 
  i want to checkand see if my query returned any results.   problem is if
i
  check liek this -
  if($results = mysql_fetch_array($result))
 
  it appears that a resource is returned regardless.  so this is always
 true.
 
  the real problem is that i need to find out if something is returned
 without
  actually accessing the data.  because this if statement appears to be
  calling the first row of result data so later when i use a while loop to
 go
  through the data i am missing the first result returned.
 
  i have tried putting a few other mysql function in the conditional.
maybe
 i
  am on the wrong path  . . would one of the cariable functions like
isset()
  or soemthing check this?
 
 
 
 
 
 
 
 
  Thank You,
 
  Jon Yaggie
  www.design-monster.com
 
  And they were singing . . .
 
  '100 little bugs in the code
  100 bugs in the code
  fix one bug, compile it again
  101 little bugs in the code
 
  101 little bugs in the code . . .'
 
  And it continued until they reached 0
 
 
 
 
  _
  Do You Yahoo!?
  Get your free @yahoo.com address at http://mail.yahoo.com



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] mail problem with ... Unbalanced ''

2001-08-05 Thread Tom Hodder


Hi,

sorry if this is slightly off topic but I thought someone might have some
idea of the problem.

I am using the mail function like so;

mail( $to, $subject, $this-mime );

where the arguments have the following values;

print '$to = '.$to.\n;
print '$subject = '.$subject.\n;
print '$this-mime = '.$this-mime.\n;

$to = Tom Hodder [EMAIL PROTECTED]
$subject = htrheht
$this-mime = This is a MIME encoded message.

--=_ab31b28377a78eb2ae3ca4c36b9262ec
Content-Type: text/plain
Content-Transfer-Encoding: base64

RW50ZXIgeW91ciBQTEFJTiBURVhUIG5ld3NsZXR0ZXIgaGVyZS5FbnRlciB5b3VyIFBMQUlOIFRF
WFQgbmV3c2xldHRlciBoZXJlLkVudGVyIHlvdXIgUExBSU4gVEVYVCBuZXdzbGV0dGVyIGhlcmUu
RW50ZXIgeW91ciBQTEFJTiBURVhUIG5ld3NsZXR0ZXIgaGVyZS5FbnRlciB5b3VyIFBMQUlOIFRF
WFQgbmV3c2xldHRlciBoZXJlLkVudGVyIHlvdXIgUExBSU4gVEVYVCBuZXdzbGV0dGVyIGhlcmUu
DQoNCg0KDQpFbnRlciB5b3VyIFBMQUlOIFRFWFQgbmV3c2xldHRlciBoZXJlLkVudGVyIHlvdXIg
UExBSU4gVEVYVCBuZXdzbGV0dGVyIGhlcmUuRW50ZXIgeW91ciBQTEFJTiBURVhUIG5ld3NsZXR0
ZXIgaGVyZS5FbnRlciB5b3VyIFBMQUlOIFRFWFQgbmV3c2xldHRlciBoZXJlLkVudGVyIHlvdXIg
UExBSU4gVEVYVCBuZXdzbGV0dGVyIGhlcmUuDQoNCg0KRW50ZXIgeW91ciBQTEFJTiBURVhUIG5l
d3NsZXR0ZXIgaGVyZS5FbnRlciB5b3VyIFBMQUlOIFRFWFQgbmV3c2xldHRlciBoZXJlLkVudGVy
IHlvdXIgUExBSU4gVEVYVCBuZXdzbGV0dGVyIGhlcmUuRW50ZXIgeW91ciBQTEFJTiBURVhUIG5l
d3NsZXR0ZXIgaGVyZS4=

--=_ab31b28377a78eb2ae3ca4c36b9262ec--

this generates a return email with the following contents...



The original message was received at Sun, 05 Aug 2001 19:48:50 +0100

  - The following addresses had permanent fatal errors -
[EMAIL PROTECTED] [EMAIL PROTECTED]

  - Transcript of session follows -
... while talking to mail.globalgold.co.uk
 RCPT To:[EMAIL PROTECTED] [EMAIL PROTECTED]
 553 [EMAIL PROTECTED] [EMAIL PROTECTED]... Unbalanced ''




I would be grateful if anyone could shed some light on this problem..

Cheers

Tom Hodder


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] checking for results return from mysql

2001-08-05 Thread Cody

At Sunday, 5 August 2001, olinux [EMAIL PROTECTED] wrote:

try this

$result = mysql_query($sql_query);

if ($result) {
  while ($row = mysql_fetch_array($result)) {
  $var_1 = $row['var_1'];
  $var_2 = $row['var_2'];
  }
}

olinux

This might work:

$result = mysql_query($sql_query);

$num_rows = mysql_num_rows($result);

 if($num_rows  0) {
  *** code to execute if any rows were returned ***
 } else {
  *** code to execute if zero rows were returned ***
 }

Hope this helps!

Cody







-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] cleaning up auto_increment fields

2001-08-05 Thread Ben Bleything

Hello all!

Is it worth my time (both real and processor) to make my application
find gaps in the auto_increment sequence (in MySQL) and fill them when I
add new data?  I'm concerned about overloading the capacities of my
datatypes (although they are very liberal).

I think it wouldn't be that difficult... but would probably slow the
application down... I fear that, because of the relationships I have, if
I ever decide to compact the database later, it will be an extremely
trying task.

Thanks,
Ben


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Grouping functions inside WHERE clause - may or not

2001-08-05 Thread Ventsyslav Vassilev

10x Paul - i know that this is a PHP list, but PHPMySQL are almost like
husbands already:-))
In addition - in this list are being posted many mysql questions, right? It
is PHP.DB...
My purpose was to get results with one query only.

If expr is a TIMESTAMP, DATE, or DATETIME column, MIN() and MAX() are
formatted to the same format if they are constants.
+, i still do not understand above passage from MySQL manual
have a nice day...


Paul Dubois [EMAIL PROTECTED] wrote in message
news:p04330106b791e5e07dfd@[192.168.1.31]...
 At 6:59 PM +0300 8/4/01, Ventsyslav Vassilev wrote:
 Hi,
 My simple question is:
 May i use grouping functions in the WHERE clause of a SQL query in mySQL?
 
 For example, this failed to work:
 SELECT date_field FROM tablename WHERE date_filed BETWEEN MIN(date_field)
 AND MAX(date_field);
 
 In the mySQL manual i red the following into Functions to use in SELECT
and
 WHERE clauses/Comparision operators section:
 
 If expr is a TIMESTAMP, DATE, or DATETIME column, MIN() and MAX() are
 formatted to the same format if they are constants.
 
 What this means?
 
 may i use min()/max() into WHERE or not?

 1) The WHERE clause is used to determine which records to select.
 2) MIN() and MAX() are determined based on the values of the selected
 records.

 You draw the conclusion.

 However, you may be able to use user-defined variables to do what you
 want.  Execute a couple of queries:

 SELECT @dmin := MIN(date_field), @dmax := MAX(date_field) FROM tablename;
 SELECT date_field FROM tablename WHERE date_field BETWEEN @dmin and @dmax;


 By the way, this is a PHP list.  What's your PHP question?


 Pls help!
 --
 
 Ventsyslav Vassilev
 Comel Soft Multimedia
 Sofia, Bulgaria
 ICQ UIN: 11199819
 e-mail: [EMAIL PROTECTED]


 --
 Paul DuBois, [EMAIL PROTECTED]



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Creating .DBF files from an AccessDatabase

2001-08-05 Thread Travis Cannell

hi

I am looking for a script that will allow me export my ms access database in
.dbf format.  Any comments related to the subject would also be helpful.

Thanks in advance,

Travis



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]