RE: [PHP-DB] date conversions

2004-12-16 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 16 December 2004 06:00, neil wrote:

 Hi
 
 I am needing to convert a d/m/y date such as 30/11/2004 into the
 format that mysql can use ie. 2004-11-20
 
 If I try the following:
 
 $testdate=30/11/2004;
 echo date(Y-m-d, strtotime($testdate));
 
 the result is - 2006-06-11

strtotime() is, unfortunately, a little American biased and only recognises
the mm/dd/ numeric format (using slashes).  So the above is returning
the equivalent of the 11th day of the 30th month of 2004!

You can use other PHP functions, as has been suggested, but you might also
investigate the mySQL date formatting functions, as I believe they work
perfectly well on input dates as well as output ones.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



RE: [PHP-DB] MYSQL Maximum Time Exceeded

2004-12-16 Thread aNNa
 This not be what you need, but I think there are some squiggle brackets
missing.

The curly brackets aren't the problem as they're not needed for just
one statement.

Examples at: 
http://www.php.net/manual/en/language.control-structures.php#control-structures.if

anna

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



[PHP-DB] Pagination

2004-12-16 Thread David Ziggy Lubowa


Hey guys, 

  I am working on an internal db and i have a script[below] which does some 
searching for me, now i am no expert in php but atleast i can always read up, 
i want to add some kind of pagination because just incase i search for 
somethign in particular i dont want it to display 100 entries on my form, how 
can i incorperate a pagination script in the script below, 

all help is highly appreciated

[snip]


?php

  $var = @$_GET['q'] ;
  $trimmed = trim($var); 

// check for an empty string and display a message.
if ($trimmed == )
  {
  echo pPlease enter a search.../p;
  exit;
  }


$link = mysql_connect(localhost, beef,b33f);
mysql_select_db(ip, $link);
$qry = mysql_query(SELECT * FROM IP_Addresses where free like '%.
$_GET['q'].%', $link);

?
table border=1 width=100%tr?php

if (mysql_num_rows($qry)==0 ) {

print  Oops No records found ;
?
br
a href=http://localhost/ipsearch2.html;Back/a
/br
?
exit();
}
if (mysql_num_rows($qry)  0) {
   for ($i = 0; $imysql_num_fields($qry); $i++) {
   echo td align=centerstrong . mysql_field_name($qry, $i) . 
/td;   echo td align=centerstrong . mysql_field_name($qry, 
$i) . /td;
   }
}

?

/tr?php

if (mysql_num_rows($qry)  0) {
   for ($j = 0; $jmysql_num_rows($qry); $j++) {

   ?tr?php

   for ($k = 0; $kmysql_num_fields($qry); $k++) {
   echo td align=center . mysql_result($qry,$j, $k) . /td;
   }

   ?/tr?php

   }
}

?

[/snip]

cheers

-Z

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



Re: [PHP-DB] Pagination

2004-12-16 Thread Ignatius Reilly
have a look at the PEAR Pager class.
very useful.

_
- Original Message - 
From: David Ziggy Lubowa [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: 16 December 2004 23:38
Subject: [PHP-DB] Pagination




 Hey guys,

   I am working on an internal db and i have a script[below] which does
some
 searching for me, now i am no expert in php but atleast i can always read
up,
 i want to add some kind of pagination because just incase i search for
 somethign in particular i dont want it to display 100 entries on my form,
how
 can i incorperate a pagination script in the script below,

 all help is highly appreciated

 [snip]


 ?php

   $var = @$_GET['q'] ;
   $trimmed = trim($var);

 // check for an empty string and display a message.
 if ($trimmed == )
   {
   echo pPlease enter a search.../p;
   exit;
   }


 $link = mysql_connect(localhost, beef,b33f);
 mysql_select_db(ip, $link);
 $qry = mysql_query(SELECT * FROM IP_Addresses where free like '%.
 $_GET['q'].%', $link);

 ?
 table border=1 width=100%tr?php

 if (mysql_num_rows($qry)==0 ) {

 print  Oops No records found ;
 ?
 br
 a href=http://localhost/ipsearch2.html;Back/a
 /br
 ?
 exit();
 }
 if (mysql_num_rows($qry)  0) {
for ($i = 0; $imysql_num_fields($qry); $i++) {
echo td align=centerstrong . mysql_field_name($qry, $i) .
 /td;   echo td align=centerstrong .
mysql_field_name($qry,
 $i) . /td;
}
 }

 ?

 /tr?php

 if (mysql_num_rows($qry)  0) {
for ($j = 0; $jmysql_num_rows($qry); $j++) {

?tr?php

for ($k = 0; $kmysql_num_fields($qry); $k++) {
echo td align=center . mysql_result($qry,$j, $k) . /td;
}

?/tr?php

}
 }

 ?

 [/snip]

 cheers

 -Z

 -- 
 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] Pagination

2004-12-16 Thread Bruno B B Magalhães
Hi you all,
here is how I am doing in a veery big class of mine.. Course that 
uses class's specific terms, but it's very easy to understand.

=
	/*
	*  Fetch paginated results
	*/
	function fetch_paginated($query='',$page=1,$itens=20)
	{
		$this-query($query.' LIMIT '.(($page*$itens)-$itens).','.$itens);
  - IMPORTANT IT APPENDS A XXX,XXX LIMIT IN THE END OF QUERY.
		if($this-num_rows()  0)
		{
			while($this-fetch_array())
			{
$results[] = $this-row;
			}
		}
		else
		{
			return null;
		}

		
		$this-query($query.' LIMIT 
0,'.(($page*$itens)-$itens));		$this-page_prev = $this-num_rows();
  - HOW MANY ROWS BEFORE
		
		$this-query($query.' LIMIT 
'.(($page*$itens)-$itens).',1');
		$this-page_next = $this-num_rows();  - HOW MANY ROWS 
AHEAD
		
		$this-page_pages_before = ($this-page_prev/$itens);   
- HOW MANY PAGES BEFORE
		$this-page_pages_after = ($this-page_next/$itens);   - 
HOW MANY PAGES AHEAD
		
		$this-query($query);
		$this-page_total = $this-num_rows();  - TOTAL RECORDS 
(INCLUDING CURRENT, BEFORE AND AFTER PAGES)
		
		$this-page_from = (($page*$itens)-$itens);   - NEXT PAGE
		$this-page_to = ($page*$itens);  - PAGE AFTER
		
		return $results;
	}
=

The important thing here is how you build the limit statement:   LIMIT 
(($page_number*$itens_per_page)-$itens_per_page),$itens_per_page

Where page number MUST start at 1, NOT 0.
Regards,
Bruno B B Magalhaes
On Dec 16, 2004, at 8:38 PM, David Ziggy Lubowa wrote:

Hey guys,
  I am working on an internal db and i have a script[below] which does 
some
searching for me, now i am no expert in php but atleast i can always 
read up,
i want to add some kind of pagination because just incase i search for
somethign in particular i dont want it to display 100 entries on my 
form, how
can i incorperate a pagination script in the script below,

all help is highly appreciated
[snip]
?php
  $var = @$_GET['q'] ;
  $trimmed = trim($var);
// check for an empty string and display a message.
if ($trimmed == )
  {
  echo pPlease enter a search.../p;
  exit;
  }
$link = mysql_connect(localhost, beef,b33f);
mysql_select_db(ip, $link);
$qry = mysql_query(SELECT * FROM IP_Addresses where free like '%.
$_GET['q'].%', $link);
?
table border=1 width=100%tr?php
if (mysql_num_rows($qry)==0 ) {
print  Oops No records found ;
?
br
a href=http://localhost/ipsearch2.html;Back/a
/br
?
exit();
}
if (mysql_num_rows($qry)  0) {
   for ($i = 0; $imysql_num_fields($qry); $i++) {
   echo td align=centerstrong . mysql_field_name($qry, 
$i) .
/td;   echo td align=centerstrong . 
mysql_field_name($qry,
$i) . /td;
   }
}

?
/tr?php
if (mysql_num_rows($qry)  0) {
   for ($j = 0; $jmysql_num_rows($qry); $j++) {
   ?tr?php
   for ($k = 0; $kmysql_num_fields($qry); $k++) {
   echo td align=center . mysql_result($qry,$j, $k) . 
/td;
   }

   ?/tr?php
   }
}
?
[/snip]
cheers
-Z
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

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


RE: [PHP-DB] PHP 4.3.10RC2 - Any change in the way rows are fetch ed ?

2004-12-16 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



On 16 December 2004 12:51, Vincent KONIECZEK wrote:

 Hi there,
 
 
 I was testing PHP 4.3.10RC2 with a well-tested web application when I
 saw it failed badly. 
 
 After a little debug, I have found that the problem comes
 from this SQL
 query:
 SELECT CONCAT(num) AS k FROM user WHERE uid LIKE '%%'
 where user is a table with num as the PK and uid as a VARCHAR(128).
 
 I expect a result like this one (var_export-like display) of
 the fetched
 row (with mysql_fetch_array()):
 ([0] = 67,[k] = 67)
 But mysql_fetch_array() gives me:
 ([0] = ([0] = 67,[k] = 67))
 
 For me, it is a really big problem.
 I do not have it with PHP 4.3.8.
 I did not take the time to test with PHP 4.3.9 nor 4.3.10 but
 I took a
 look at the documentation web sites, the latest Changelogs and made a
 search on the mailing lists but found nothing about it.

Similar problems have been reported to the bugs database, and have been
traced to an old version of the Zend Optimiser -- if you are using this, try
disabling it, and if your application then works ok upgrade to the latest
version.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



[PHP-DB] PHP 4.3.10RC2 - Any change in the way rows are fetched ?

2004-12-16 Thread Vincent KONIECZEK
Hi there,
I was testing PHP 4.3.10RC2 with a well-tested web application when I 
saw it failed badly.

After a little debug, I have found that the problem comes from this SQL 
query:
SELECT CONCAT(num) AS k FROM user WHERE uid LIKE '%%'
where user is a table with num as the PK and uid as a VARCHAR(128).

I expect a result like this one (var_export-like display) of the fetched 
row (with mysql_fetch_array()):
([0] = 67,[k] = 67)
But mysql_fetch_array() gives me:
([0] = ([0] = 67,[k] = 67))

For me, it is a really big problem.
I do not have it with PHP 4.3.8.
I did not take the time to test with PHP 4.3.9 nor 4.3.10 but I took a 
look at the documentation web sites, the latest Changelogs and made a 
search on the mailing lists but found nothing about it.

Is this the behaviour expected from PHP 4.3.10 ? Is there a way to have 
the previous/expected behaviour ?
Or is this a bug ?
Is this the right mailing-list to find some information about this ?


Vincent


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

RE: [PHP-DB] mysql Index table

2004-12-16 Thread Bastien Koert
for inserts , yes, it does
for lots of update, deletes it might be worth to periodically drop and 
rebuild the indeces

bastien
From: Yemi Obembe [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP-DB] mysql Index table
Date: Thu, 16 Dec 2004 04:59:40 -0800 (PST)
just want to know if mysql automatically update an index table if new datas 
are inserted into the original table. for example, if i insert a row of 
data to a table I'have already created an index table for, would mysql add 
the row to the table?


-
A passion till tomorrow,
Opeyemi Obembe | ng.clawz.com


-
Do you Yahoo!?
 Yahoo! Mail - 250MB free storage. Do more. Manage less.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] apparent mysql float behavior change from 4.0 to 4.1 (without any warning?)

2004-12-16 Thread Norland, Martin
I've got some strange mysql behavior, wondered if anyone encountered it.
 
I have a database with some float(4,3) fields.
I have a version of this running on mysql 4.0[.23], and another running
on mysql 4.1[.7].
When I insert, for example, 12 into it - the 4.0 version stores '12.00'
- but the 4.1 version stores '9.999'.  It seems that mysql made a change
somewhere between 4.0 and 4.1 to force the decimal space of floats.
 
This is all well and good, I rather like losing data - it builds
character - but I've thoroughly checked their changelogs and have found
nothing to indicate this behavior change.
 
It's likely a change for sql compliance - but just to forewarn anyone
who may want to do an upgrade - this isn't an issue I've found written
out anywhere.
 
Has anyone seen this anywhere?
 

Incidentally, I tried to warn that this was O  -  T...
 Hi. This is the qmail-send program at pb1.pair.com.
 I'm afraid I wasn't able to deliver your message to the following
addresses. This is a permanent error; I've given up. Sorry it didn't
work out.
 [EMAIL PROTECTED]:
 Apparent off-topic email rejected.
It's good to know that you can post O  -  T to a list, but if you dare
to indicate it as such (with the bracketed Oh-Tee indicator at the start
of the subject) as a service to those uninterested, your mail won't go
through.  That's good policy - stomp on the good citizens and make them
misbehave.

Cheers,
- Martin Norland, 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. 
 


RE: [PHP-DB] Spot the deliberate mistake...

2004-12-16 Thread Norland, Martin
 -Original Message-
 From: Mark Benson [mailto:[EMAIL PROTECTED] 
 The following SQL statement returns an error. What is wrong with it?
The error is stated as being near 'ON DUPLICATE KEY
 UPDATE foo_no='$data[1]', alt_no='$data[2]', descript='$data[3]', pr'
 
 INSERT INTO `foobar2` SET part_no='$data[0]', foo_no='$data[1]',
alt_no='$data[2]', descript='$data[3]', price='$data[4]', 
 unit_sale='$data[5]', unit_issue='$data[6]', weight='$data[7]',
brand='$data[8]', nla_tag='0' ON DUPLICATE KEY UPDATE 
 foo_no='$data[1]', alt_no='$data[2]', descript='$data[3]',
price='$data[4]', unit_sale='$data[5]', unit_issue='$data[6]',
weight='$data
 [7]', brand='$data[8]', nla_tag='0'

You shouldn't specify your data to be inserted again after the 'ON
DUPLICATE KEY UPDATE' statement.

INSERT INTO `foobar2` SET part_no='$data[0]', foo_no='$data[1]',
alt_no='$data[2]', descript='$data[3]', price='$data[4]',
unit_sale='$data[5]', unit_issue='$data[6]', weight='$data[7]',
brand='$data[8]', nla_tag='0' ON DUPLICATE KEY UPDATE;

It's implicit that you use the same data regardless, you're saying if
it's already there, just do an update statement with the data already
provided.

Cheers,
- Martin Norland, 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] odbc_connect() parameters help please

2004-12-16 Thread Greg Jackson
Thanks, no luck tho...

Here's the code:

if($_SESSION[VIEW] == private)
 if (($odbc_conn = odbc_connect(D3_ACTIVE,,)) === false)
  die(ODBC connect call failed);

and the result:

Warning: odbc_connect(): SQL error: [Raining Data][ODBC D3 Driver]Logon
failed. Check D3 connection parameters and available licenses., SQL state
28000 in SQLConnect in C:\Documents and Settings\Administrator\My
Documents\www\activetest\searchresults.php on line 118
ODBC connect call failed

I don't want to patch the php source code if I don't have to.  It's running
on IIS - I thought of writing a vb script to do the odbc query and return
the result to php i.e. using http calls from inside the php script...  If I
try it I'll let you know if it works.

Greg

Bastien Koert [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 try $conn = odbc_connection(D3_ODBC,,);

 not blanks but empty strings

 bastien

 From: Greg Jackson [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] odbc_connect() parameters help please
 Date: Thu, 16 Dec 2004 17:55:59 +1300
 
 Hi
 
 I'm new to this group, but not to PHP :-)
 
 Does anybody know why odbc_connect() requires a username and password to
be
 supplied as well as the DSN name?  This feature is preventing me from
 accessing a database that can easily be accessed from asp with the
 following
 example  code:
 
 %
 set conn=Server.CreateObject(ADODB.Connection)
 conn.OpenD3_ODBC
 set rs=Server.CreateObject(ADODB.recordset)
 rs.Open select field1,field2 from tble where field3 like '%search%',
conn
 do until rs.EOF
for each x in rs.Fields
  Response.Write(x.name)
  Response.Write( = )
  Response.Write(x.value  br /)
next
Response.Write(br /)
rs.MoveNext
 loop
 rs.Close
 conn.Close
 %
 
 Second line of above code: conn.OpenD3_ODBC
 Note that no user or password needs to be supplied.
 
 For this particular ODBC driver (D3ODBC from Raining Data) there are in
 fact
 two sets of user/password parameters specified in the DSN i.e. all four
 fields of logon info must be supplied correctly on order to connect.
 
 I have tried all possible combinations with odbc_connect() (including
 blanks) in case it simply overrides a couple of the four fields in the
DSN.
 Nothing works.  There is network activity during the connection call and
 the
 error message from the driver is the same as when you get the password
 wrong
 from something like MSACCESS.
 
 Does anybody know of a way around this limitation?
 
 Best regards,
 Greg Jackson
 
 --
 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] Pagination

2004-12-16 Thread Graham Cossey
Try heading over to www.phpfreaks.com, they have a couple of
tutorials/examples on how to achieve this.

HTH
Graham.


On Thu, 16 Dec 2004 14:38:29 -0800, David Ziggy Lubowa
[EMAIL PROTECTED] wrote:
 
 
 Hey guys,
 
  I am working on an internal db and i have a script[below] which does some
 searching for me, now i am no expert in php but atleast i can always read up,
 i want to add some kind of pagination because just incase i search for
 somethign in particular i dont want it to display 100 entries on my form, how
 can i incorperate a pagination script in the script below,
 
[snip]

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



Re: [PHP-DB] Looping within a string?

2004-12-16 Thread Jason Wong
On Friday 17 December 2004 10:33, Chris Payne wrote:

 Im having to send an email with looped results, but Im having problems. 
 I can send an email no problem, and this code works OUTSIDE of the string,
 but not inside, can anyone see what is going wrong?

Please explain what you are doing. A string is a string. Code doesn't execute 
inside a string. What else are you doing to the string?

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Pardon this fortune.  Database under reconstruction.
*/

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



RE: [PHP-DB] Looping within a string?

2004-12-16 Thread Chris Payne
Hi there,

Well basically I have a list of items and their prices etc . which have
to be sent via email, so I need to store the data in a string.  I THOUGHT I
could execute the loop with all the elements (Such as table rows etc ...)
inside a string, but I was wrong, so how can I store the data PLUS the table
data into a string?  It has to be an HTML email and I'm stumped.  I can send
an email no problem, but not with all the data, just the last row in the
data.

Chris

On Friday 17 December 2004 10:33, Chris Payne wrote:

 Im having to send an email with looped results, but Im having problems. 
 I can send an email no problem, and this code works OUTSIDE of the string,
 but not inside, can anyone see what is going wrong?

Please explain what you are doing. A string is a string. Code doesn't
execute 
inside a string. What else are you doing to the string?

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Pardon this fortune.  Database under reconstruction.
*/

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

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.816 / Virus Database: 554 - Release Date: 12/14/2004
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.816 / Virus Database: 554 - Release Date: 12/14/2004
 

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



RE: [PHP-DB] Looping within a string?

2004-12-16 Thread David Robley
On Fri, 17 Dec 2004 13:54, Chris Payne wrote:

 Hi there,
 
 Well basically I have a list of items and their prices etc . which
 have
 to be sent via email, so I need to store the data in a string.  I THOUGHT
 I could execute the loop with all the elements (Such as table rows etc
 ...) inside a string, but I was wrong, so how can I store the data PLUS
 the table
 data into a string?  It has to be an HTML email and I'm stumped.  I can
 send an email no problem, but not with all the data, just the last row in
 the data.
 
 Chris
 
 On Friday 17 December 2004 10:33, Chris Payne wrote:
 
 I?m having to send an email with looped results, but I?m having problems.
 I can send an email no problem, and this code works OUTSIDE of the
 string, but not inside, can anyone see what is going wrong?
 
 Please explain what you are doing. A string is a string. Code doesn't
 execute
 inside a string. What else are you doing to the string?
 

Create the output in the same manner as you would use if you were displaying
it; in other words, loop through the source (database, whatever) adding the
formatting as required. Instead of echoing the output to screen, append it
to a variable. Voila, you have the data all in one variable.


-- 
David Robley

My pencil is dull, said Tom pointlessly.

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



Re: [PHP-DB] Looping within a string?

2004-12-16 Thread Jason Wong
On Friday 17 December 2004 11:24, Chris Payne wrote:

Please do not top post.

 Well basically I have a list of items and their prices etc . which have
 to be sent via email, so I need to store the data in a string.  I THOUGHT I
 could execute the loop with all the elements (Such as table rows etc ...)
 inside a string, but I was wrong, so how can I store the data PLUS the
 table data into a string?

By 'data' I assume you mean data from the database and by 'table data' I 
assume you mean the HTML markup to output a table?

  $text = '';
  while ($row = mysql_fetch_array($sql_resultc)) {
$text .= 'some html markup' . $row['id'] . 'more html';
  }

Now stick $text somewhere in the body of your mail.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
 Professor: Oh, dear. She's stuck in an infinite loop and he's an idiot. 
   Well, that's love for you.
*/

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



[PHP-DB] characters problem

2004-12-16 Thread Panos Yahoo
Dear All,

I am using php and mysql the last two years, and I still cannot find the way
to update a field on mysql from php that containts the single quotes ( ` and
' )

Examples

Here is an example of my index.php file. I have to type something on
Comments field
-
?
include(../configs/dates.inc);
include(../configs/config.inc);

echo 
br
body bgcolor=#FFF8E1 text=#2003CF link=#2003CF vlink=#2003CF alink=#2003CF
center
form method=post action=add.php

font face=\Comic Sans MS\Commentsbrtextarea rows=3 cols=40
name=mycomments tabind
ex=22/textarea

input type=submit name=Submit value=\Add Ticket\
input type=reset name=Reset value=\Clear Form\
;
mysql_close($myconn);

?
-




In the html text area, I am typing the following text : Hello My name is
Panos and I'm from Greece




The add.php file looks like this :
-
?

include(../configs/dates.inc);
include(../configs/config.inc);



$myquery=INSERT INTO `$table` (`comments`) VALUES ('$mycomments');

$myresult=mysql_db_query($db,$myquery);

mysql_close($myconn);

echo done;

?
-



ANd when i'm trying to see what was added on mysql, i have the following
result :

Hello My name is Panos and I\



-

The field on mysql is TEXT

Does anyone knows how can i resolve this problem?

Thanks

Panos

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



[PHP-DB] Re: characters problem

2004-12-16 Thread Nadim Attari
 $myquery=INSERT INTO `$table` (`comments`) VALUES ('$mycomments');

$mycomments = addslashes($mycomments);
$myquery = INSERT INTO $table (comments) VALUES ('$mycomments');

See:

http://www.php.net/addslashes

Hope it solves the problem.

nadim attari

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



[PHP-DB] mysql Index table

2004-12-16 Thread Yemi Obembe
just want to know if mysql automatically update an index table if new datas are 
inserted into the original table. for example, if i insert a row of data to a 
table I'have already created an index table for, would mysql add the row to the 
table?



-

A passion till tomorrow,
Opeyemi Obembe | ng.clawz.com






-
Do you Yahoo!?
 Yahoo! Mail - 250MB free storage. Do more. Manage less.

[PHP-DB] Spot the deliberate mistake...

2004-12-16 Thread Mark Benson
The following SQL statement returns an error. What is wrong with it? The error 
is stated as being near 'ON DUPLICATE KEY UPDATE foo_no='$data[1]', 
alt_no='$data[2]', descript='$data[3]', pr'

INSERT INTO `foobar2` SET part_no='$data[0]', foo_no='$data[1]', 
alt_no='$data[2]', descript='$data[3]', price='$data[4]', unit_sale='$data[5]', 
unit_issue='$data[6]', weight='$data[7]', brand='$data[8]', nla_tag='0' ON 
DUPLICATE KEY UPDATE foo_no='$data[1]', alt_no='$data[2]', descript='$data[3]', 
price='$data[4]', unit_sale='$data[5]', unit_issue='$data[6]', 
weight='$data[7]', brand='$data[8]', nla_tag='0'

This is passed in a PHP script so the line ending ';' is not present.

I'm getting better at writing SQL statements but sometimes it just throws me a 
total curved ball!

-- 
Mark Benson

http://homepage.mac.com/markbenson

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


[PHP-DB] html display

2004-12-16 Thread Kevin Russell
Hi list,
and yes I am a newcomer to this list but not to the realm of lamp's deve, 
any who I would like to know if any one has any good resources for making a web 
page display at 800x600 fix res, no matter what the display is set to in their 
machine, I'm moving to php5, just a simple framework would be great I can 
pickup the pieces and turn it into what I need 
thx


RE: [PHP-DB] Spot the deliberate mistake...

2004-12-16 Thread Mark Benson
 
On Thursday, December 16, 2004, at 05:21PM, Norland, Martin [EMAIL PROTECTED] 
wrote:

INSERT INTO `foobar2` SET part_no='$data[0]', foo_no='$data[1]',
alt_no='$data[2]', descript='$data[3]', price='$data[4]',
unit_sale='$data[5]', unit_issue='$data[6]', weight='$data[7]',
brand='$data[8]', nla_tag='0' ON DUPLICATE KEY UPDATE;

It's implicit that you use the same data regardless, you're saying if
it's already there, just do an update statement with the data already
provided.

If I try that it returns:

You have an error in your SQL syntax near 'ON DUPLICATE KEY UPDATE' at line 1

so I guess something doesn't work there. I also tried it with and without the 
line ending and it didn't work either way :).

-- 
Mark Benson

http://homepage.mac.com/markbenson

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


RE: [PHP-DB] Spot the deliberate mistake...

2004-12-16 Thread Norland, Martin
 -Original Message-
 From: Mark Benson [mailto:[EMAIL PROTECTED] 
 If I try that it returns:

 You have an error in your SQL syntax near 'ON DUPLICATE KEY UPDATE' at
line 1

 so I guess something doesn't work there. I also tried it with and
without the line ending and it didn't work either way :).

Are you running a version of mysql = 4.1.0 ?

If you specify the ON DUPLICATE KEY UPDATE clause (new in MySQL 4.1.0),
and a row is inserted that would cause a duplicate value in a UNIQUE
index or PRIMARY KEY, an UPDATE of the old row is performed.

http://dev.mysql.com/doc/mysql/en/INSERT.html

Also, note - I was VERY WRONG!  You are allowed to follow the statement
with what you want updated - and I believe you're supposed to.  I
knee-jerked that first answer, assuming it must be it since the
information was so redundant - my apologies.  I expect, however, that
you're not supposed to specify the key again with the update part,
though I suppose it's possible to.

Cheers,
- Martin Norland, 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] html display

2004-12-16 Thread Bastien Koert
for displays bigger than 8x6 you can use a div to border the page. for 
displays with res smaller, you're s.o.l. you cannot force the browser to a 
smaller res.

bastien

From: Kevin Russell [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP-DB] html display
Date: Thu, 16 Dec 2004 11:02:15 -0600
Hi list,
and yes I am a newcomer to this list but not to the realm of lamp's 
deve, any who I would like to know if any one has any good resources for 
making a web page display at 800x600 fix res, no matter what the display is 
set to in their machine, I'm moving to php5, just a simple framework would 
be great I can pickup the pieces and turn it into what I need
thx
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] html display

2004-12-16 Thread Kevin Russell
for displays bigger than 8x6 you can use a div to border the page. for 
displays with res smaller, you're s.o.l. you cannot force the browser to a 
smaller res.

bastien

that's ok, I want it to display 8x6 if you have your display set to that, or if 
you have it set to a higher resolution I want it to display at 8x6, no matter 
if you have 1280 x whatever , you dig
thx



Re: [PHP-DB] html display

2004-12-16 Thread Jochem Maas
sorry but this has nothing to do with:
1. DBs
2. PHP
3. LAMP
what your talking about is rather trivial clientside (browser) content 
styling. making a page display at a fixed width can be done in any 
number of ways, the oldest way would be to use a simple table set at the 
correct width and place all your content inside that, alternatively you 
could look into the possibilities of CSS (which if you use it properly 
should allow you to display pretty much any structural HTML how you want 
- YMMV)

heres an example, (oh and the width is 786 for a reason):
html
head
style
body { margin: 0px; border: 0px; padding: 0px; }
#container {
width: 768px;
text-align: left;
margin-left: auto;
margin-right: auto;
}
/style
/head
body
div id=container
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed 
do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim 
ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut 
aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit 
in voluptate velit esse cillum dolore eu fugiat nulla pariatur. 
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui 
officia deserunt mollit anim id est laborum.
/div
/body
/html

Kevin Russell wrote:
for displays bigger than 8x6 you can use a div to border the page. for 
displays with res smaller, you're s.o.l. you cannot force the browser to a 
smaller res.

bastien

that's ok, I want it to display 8x6 if you have your display set to that, or if 
you have it set to a higher resolution I want it to display at 8x6, no matter 
if you have 1280 x whatever , you dig
thx

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