Re: [PHP-DB] VAR_DUMP INTO PHP VARIABLES

2014-06-19 Thread Toby Hart Dyke


If you have the response in a variable, $response:

$responseCode = $response[return]['responsecode'];
$responseMessage = $response[return]['responseMessage'];
$transactionID = $response[return]['transactionID'];

This isn't really the right list to ask this question - nothing to do 
with databases!


  Toby


On 6/19/2014 1:40 AM, Oriole Computing wrote:

dear List,

we have the following var_dump output from a soap response

array(1) {
   [return]=
   array(3) {
 [responseCode]=
 string(1) 3
 [responseMessage]=
 string(39) Duplicate RequestID, Transaction failed
 [transactionID]=
 string(21) 104454061823201453721
   }
}


could you advise us how we can get responseCode, responseMessage and
transactionID into individual php variables?


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



Re: [PHP-DB] VAR_DUMP INTO PHP VARIABLES

2014-06-19 Thread Toby Hart Dyke



My error! This:

$responseCode = $result[return]['responsecode'];

should have been

$responseCode = $result['return']['responsecode'];


The other responses have been rather more elegant, though I think my 
solution is a little more readable - i.e., I had to think about what was 
happening for those ones!


  Toby

On 6/19/2014 9:50 AM, Oriole Computing wrote:

Hi Toby,

my response is in variable $result so i run the code as below

$responseCode = $result[return]['responsecode'];

but getting this error: PHP Parse error:  syntax error, unexpected
T_RETURN, expecting ']

Warm Regards



*SUPPORT TEAMORIOLE COMPUTING*

*1938 B1 MUNGWI ROAD*

*LUSAKAZAMBIA*

*Skype:* oriolecomputing | *Url:* oriolecomputing.blogspot.com
http://generalcomputing.blogspot.com/


On Thu, Jun 19, 2014 at 12:23 PM, Pritoj Singh prit...@gmail.com wrote:


foreach($arr['return'] as $key=$val){
$$key=$val;
}


On Thu, Jun 19, 2014 at 3:48 PM, Toby Hart Dyke t...@hartdyke.com wrote:


If you have the response in a variable, $response:

$responseCode = $response[return]['responsecode'];
$responseMessage = $response[return]['responseMessage'];
$transactionID = $response[return]['transactionID'];





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



Re: [PHP-DB] Re: mysql query

2013-08-22 Thread Toby Hart Dyke


Notepad++ will do syntax highlighting. Go to Language  P  PHP with a 
PHP file open, and see the colours change! It should be automatic - are 
you using something other than 'php' as a file extension?


  Toby

On 8/22/2013 5:27 PM, Vinay Kannan wrote:

Jim, I know this is a stupid question to be asking this far into PHP
Development, maybe was a bit lazy, or just got too used to Notepad++, which
editor for PHP are you using? The feature which you mentioned for a good
php editor, sounds exciting, offcourse i would be looking only at the free
ones :D


On Thu, Aug 22, 2013 at 9:24 PM, Jim Giner jim.gi...@albanyhandball.comwrote:





  Also - Ethan - if you used an editor that was designed for php you
probably would have seen these missing $ signs since a good one would
highlight php syntax and the lack of the $ would have produced a different
color than you expected.





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



Re: [PHP-DB] mysql query

2013-08-21 Thread Toby Hart Dyke


1) What is the error message?

2) This has an error:

values ('$upc', $qnt,'$mnf','$itm', odrpt, 0, $stk)

Missing '$' in front of 'odrpt'.

  Toby


On 8/22/2013 12:48 AM, Ethan Rosenberg wrote:

Dear List -

I can't figure this out

mysql describe Inventory;
+-+-+--+-+-+---+
| Field   | Type| Null | Key | Default | Extra |
+-+-+--+-+-+---+
| UPC | varchar(14) | YES  | | NULL |   |
| quant   | int(5)  | NO   | | NULL |   |
| manuf   | varchar(20) | YES  | | NULL |   |
| item| varchar(50) | YES  | | NULL |   |
| orderpt | tinyint(4)  | NO   | | NULL |   |
| ordrpt_flag | tinyint(3)  | YES  | | NULL |   |
| stock   | int(3)  | YES  | | NULL |   |
+-+-+--+-+-+---+

Here are code snippets -

  $upc   = $_SESSION['UPC'];
  $qnt   = $_POST['quant'];
  $mnf   = $_POST['manuf'];
  $itm   = $_POST['item'];
  $odrpt = $_POST['oderpt'];
  $opf   = $_POST['ordrpt_flag'];
  $stk= $_POST['stock'];

  $sql2 = insert into Inventory (UPC, quant, 
manuf, item, orderpt, ordrpt_flag, stock)
.values ('$upc', $qnt,'$mnf','$itm', 
odrpt, 0, $stk);

  $result2 = mysqli_query(cxn, $sql2);
  echo '$sql2br /';
  print_r($sql2);
  echo br /$upc $qnt $mnf $itm $odrpt $opf 
$stkkbr /;

  if (!$result2)
die('Could not enter data: ' . 
mysqli_error());


The mysql query fails.  I cannot figure out why.  It works from the 
command line.


TIA

Ethan







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



Re: [PHP-DB] Re: Problem with query

2013-06-25 Thread Toby Hart Dyke


What Jim means is here in the manual:

http://www.php.net/manual/en/language.types.array.php#language.types.array.donts

In a nutshell:

Always use quotes around a string literal array index. For example, 
/$foo['bar']/ is correct, while /$foo[bar]/ is not.


The reason is that without the quotes, you are generating an undefined 
constant (bar) rather than using a string index ('bar'). It works, but 
could have side effects in the future, so it's bad form to do it.


As for general politeness, you seem to be unaware of recent history in 
this (an associated) groups. The OP has often committed the ultimate 
sine. Not posting slightly wild code (we've all been/are there!) He 
doesn't seem to listen or learn too well. Many posters (including Jim) 
have offered a lot of of extremely good (and detailed) advice which 
seems to be rarely taken...


  Toby


On 6/25/2013 7:32 AM, OJFR wrote:

Yeah, Jim, please explain what u mean by Per the manual, associative arrays
using string indices should always use ' ' around them.  They work (as
mentioned in the manual) but are wrong. As long as I remember  I could use
associative arrays in that way (ex. $_SESSION['Cust_Num']). There's another
way to do that using string indices? Why do you say it's wrong? It's
obsolete?

I would like to make a call to all the members of this mailing list:
knowledge is a wonderful gift so, why we don't share it politely and
efficiency. Jim, I will take you as an example. You start saying  Against
my better judgement, here I go again.




Re: [PHP-DB] Re: Problem with query

2013-06-25 Thread Toby Hart Dyke


The original post is here:

http://news.php.net/php.db/48751

On 6/25/2013 1:02 PM, Michael Oki wrote:

I'm sorry I've not been following the last three responses. In a nutshell,
what EXACTLY does the poster of this issue want?


On 25 June 2013 11:06, Toby Hart Dyke t...@hartdyke.com wrote:


What Jim means is here in the manual:

http://www.php.net/manual/en/**language.types.array.php#**
language.types.array.dontshttp://www.php.net/manual/en/language.types.array.php#language.types.array.donts

In a nutshell:

Always use quotes around a string literal array index. For example,
/$foo['bar']/ is correct, while /$foo[bar]/ is not.

The reason is that without the quotes, you are generating an undefined
constant (bar) rather than using a string index ('bar'). It works, but
could have side effects in the future, so it's bad form to do it.

As for general politeness, you seem to be unaware of recent history in
this (an associated) groups. The OP has often committed the ultimate sine.
Not posting slightly wild code (we've all been/are there!) He doesn't seem
to listen or learn too well. Many posters (including Jim) have offered a
lot of of extremely good (and detailed) advice which seems to be rarely
taken...

   Toby



On 6/25/2013 7:32 AM, OJFR wrote:


Yeah, Jim, please explain what u mean by Per the manual, associative
arrays
using string indices should always use ' ' around them.  They work (as
mentioned in the manual) but are wrong. As long as I remember  I could
use
associative arrays in that way (ex. $_SESSION['Cust_Num']). There's
another
way to do that using string indices? Why do you say it's wrong? It's
obsolete?

I would like to make a call to all the members of this mailing list:
knowledge is a wonderful gift so, why we don't share it politely and
efficiency. Jim, I will take you as an example. You start saying  Against
my better judgement, here I go again.






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



Re: [PHP-DB] Probleme upper accents

2013-04-05 Thread Toby Hart Dyke


It looks similar to this bug: http://bugs.php.net/bug.php?id=54379 - 
possibly fixed in a later version? Your PHP is pretty elderly.


  Toby


On 4/5/2013 1:38 PM, André LAGADEC wrote:

Hi,

On my application PHP with Oracle database, all work fine with 
Oracle9i client, but when I test with Oracle11gR2 client

I get warning with PDO driver.
*Warning*: PDOStatement::fetch() [function.PDOStatement-fetch 
http://vanves23/function.PDOStatement-fetch]: column 0 data was too 
large for buffer and was truncated to fit it in

with this request
 SELECT DISTINCT UPPER(SUBSTR(NOM, 1, 1)) AS INITIALE, NOM
   FROM MY_TABLE ORDER BY INITIALE ;

The field NOM contain in first character upper character with accent 
like this


É

Î

Here are my configuration :
   - Apache2.2.21
   - Php-5.1.4 with PDO Oracle
   - Client Oracle 11.2.0.1
   - Base Oracle 11.2.0.1



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



Re: [PHP-DB] Saving Image in mySQL

2013-03-20 Thread Toby Hart Dyke


You're right - you're pulling $file out of thin air. Once uploaded, the 
file is stored in $_FILES['file']['tmp_name'], and you need to manually 
read the data into $file yourself. Something like:


  file_get_contents($_FILES['file']['tmp_name'])

  Toby


On 3/19/2013 8:15 PM, Ron Piggott wrote:

Hi All
I don’t understand how to save an image to a mySQL table based on the following 
form. I am trying to do this using Prepared Statements.  All the fields except 
the image file itself save in the database.  Right now I have $file as the 
variable when binding the values.  What should it be?  Ron



# bind variables

 $stmt-bindValue(':caption', 'Test Caption', PDO::PARAM_STR);
 $stmt-bindValue(':image_type', $_FILES[file][type], 
PDO::PARAM_STR);
 $stmt-bindValue(':image_size', $_FILES[file][size], 
PDO::PARAM_INT);
 $stmt-bindValue(':image_name', $_FILES[file][name], 
PDO::PARAM_STR);
 $stmt-bindValue(':image', $file, PDO::PARAM_STR);
 




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



Re: [PHP-DB] Another PDO ?

2012-09-10 Thread Toby Hart Dyke


On 9/10/2012 4:54 PM, Jim Giner wrote:

On 9/10/2012 11:10 AM, Lester Caine wrote:

Jim Giner wrote:

On 9/10/2012 10:49 AM, Bastien Koert wrote:

On Mon, Sep 10, 2012 at 9:48 AM, Jim Giner
jim.gi...@albanyhandball.com wrote:
Reading up on the pdostatement class.  Wondering what the intent 
of the

columnCount function is.  I mean, aren't the number of columns in a
result
known when you write the query?  Granted, you might have some very
complex
query that you may not know the number, but for most queries you
will know
the columns you are expecting.  So - what am I not seeing?

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



It might be for those cases where you run a select * from ...


But - again - one already knows how many fields are in that table when
one
writes the query...


You do not necessarily KNOW how many fields. You know how many fields
should be in the version of the database you are coding for, so any
difference would flag a problem. Also you may not ACTUALLY have the
schema for a database in which case a count of the fields found is
useful for further processing those fields.

Another area is when you are working with fabricated joined queries
where duplicate field names between tables will give a reduced number of
final fields in the result.

Of cause it IS often better to work with named fields rather than using
'*' which does allow better handing of the process anyway.

I find it difficult to fathom a scenario where I am able to write 
queries against a db but not have access to the layouts.  Makes it 
kind of hard to know what I'm going to get back  but I guess it 
must occur somewhere since someone decided this function was necessary.


You have access to the source table layouts, but it is possible to do 
pivot table type queries where the resultant table bears no resemblance 
to any of the source tables, and the number of columns in your result 
depends on the data.


  Toby


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



RE: [PHP-DB] convert special characters.

2012-08-10 Thread Toby Hart Dyke


 -Original Message-
 From: Karl DeSaulniers [mailto:k...@designdrumm.com]
 Sent: Friday, August 10, 2012 12:08 AM
 To: php-db@lists.php.net
 Subject: Re: [PHP-DB] convert special characters.
 
 
 On Aug 9, 2012, at 5:08 PM, Toby Hart Dyke wrote:
 
 
 
  -Original Message-
  From: Karl DeSaulniers [mailto:k...@designdrumm.com]
  Sent: Thursday, August 09, 2012 10:19 PM
  To: php-db@lists.php.net
  Subject: Re: [PHP-DB] convert special characters.
 
 
  On Aug 9, 2012, at 5:41 AM, Karl DeSaulniers wrote:
 
 
  On Aug 9, 2012, at 5:37 AM, Karl DeSaulniers wrote:
 
  Help!
 
  How do I get special characters to convert correctly when inserting
  and reading from my database.
  For example.
 
  é = eacute;
  ë = euml;
 
  I keep getting
 
  ë and é
 
  using htmlentities, htmlspecialchars, etc...
 
  Any pointers? Please!
  Going bald over here.
 
  here is my funcitons
 
  function stringToMysqlFormat($original_input) {
  //for inserting the data with special characters INTO
  mysql
  $html_encoded =
  htmlentities(mysql_real_escape_string($original_input));
  return $html_encoded;
  }
  function mysqlToHTMLFormat($encoded) {
  //for displaying the data FROM mysql
  $html_decoded =
  html_entity_decode(stripslashes($encoded));
  return $html_decoded;
  }
 
  TIA,
 
  Karl DeSaulniers
  Design Drumm
  http://designdrumm.com
 
 
 
  using UTF-8
 
 
  Karl DeSaulniers
  Design Drumm
  http://designdrumm.com
 
 
  --
  PHP Database Mailing List (http://www.php.net/) To unsubscribe,
  visit:
  http://www.php.net/unsub.php
 
 
 
  No one?
  Not even a link I can go look this up myself with?
 
  I have successfuly converted before, but this time the company is in
  the netherlands and their special characters are doing this.
  Also, I have the database set to UTF-8, but when I check the charset:
 
  $charset = mysql_client_encoding($con);
 
  it returns latin1?
 
  Can someone tell me what I am doing wrong here?
  Not looking for someone to do it for me.
  Just some help figuring out which way to look.
 
  Why is htmlentities() converting wrong?
 
  Hope someone out there can help.
 
  You probably aren't setting your database connection to UTF-8. Try
  doing this before you do anything with the database, after you have
  connected:
 
  mysql_query(SET character_set_results=utf8, $dbcnx);
  mb_language('uni'); mb_internal_encoding('UTF-8');
  mysql_query(SET character_set_results=utf8, $dbcnx);
 
   Toby
 
 
 
 
 No, I hadn't done that! Ok, this is a good point to start from.
 Do I set mysql_query(SET character_set_results=utf8, $dbcnx);  twice?

Ah - the perils of copying and pasting, and not actually checking...

The short answer is - I don't know, probably not. Also, the $dbcnx is the
database connection you have already set up with mysql_connect().

To be honest, you should probably give this a read:

http://www.php.net/manual/en/mysqlinfo.concepts.charset.php

If I had the time right now, I would ;-)

  Toby



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



RE: [PHP-DB] convert special characters.

2012-08-09 Thread Toby Hart Dyke


 -Original Message-
 From: Karl DeSaulniers [mailto:k...@designdrumm.com]
 Sent: Thursday, August 09, 2012 10:19 PM
 To: php-db@lists.php.net
 Subject: Re: [PHP-DB] convert special characters.
 
 
 On Aug 9, 2012, at 5:41 AM, Karl DeSaulniers wrote:
 
 
  On Aug 9, 2012, at 5:37 AM, Karl DeSaulniers wrote:
 
  Help!
 
  How do I get special characters to convert correctly when inserting
  and reading from my database.
  For example.
 
  é = eacute;
  ë = euml;
 
  I keep getting
 
  ë and é
 
  using htmlentities, htmlspecialchars, etc...
 
  Any pointers? Please!
  Going bald over here.
 
  here is my funcitons
 
  function stringToMysqlFormat($original_input) {
   //for inserting the data with special characters INTO
  mysql
   $html_encoded =
  htmlentities(mysql_real_escape_string($original_input));
   return $html_encoded;
  }
  function mysqlToHTMLFormat($encoded) {
   //for displaying the data FROM mysql
   $html_decoded =
  html_entity_decode(stripslashes($encoded));
   return $html_decoded;
  }
 
  TIA,
 
  Karl DeSaulniers
  Design Drumm
  http://designdrumm.com
 
 
 
  using UTF-8
 
 
  Karl DeSaulniers
  Design Drumm
  http://designdrumm.com
 
 
  --
  PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit:
  http://www.php.net/unsub.php
 
 
 
 No one?
 Not even a link I can go look this up myself with?
 
 I have successfuly converted before, but this time the company is in the
 netherlands and their special characters are doing this.
 Also, I have the database set to UTF-8, but when I check the charset:
 
 $charset = mysql_client_encoding($con);
 
 it returns latin1?
 
 Can someone tell me what I am doing wrong here?
 Not looking for someone to do it for me.
 Just some help figuring out which way to look.
 
 Why is htmlentities() converting wrong?
 
 Hope someone out there can help.

You probably aren't setting your database connection to UTF-8. Try doing
this before you do anything with the database, after you have connected:

mysql_query(SET character_set_results=utf8, $dbcnx);
mb_language('uni'); mb_internal_encoding('UTF-8');
mysql_query(SET character_set_results=utf8, $dbcnx);

  Toby



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



RE: [PHP-DB] Re: Multiple Access to Database

2012-01-15 Thread Toby Hart Dyke
..and when you've read all that, go here:

http://www.mysql.com/downloads/workbench/

Much easier than doing it all on the command line!

  Toby

-Original Message-
From: David Robley [mailto:robl...@aapt.net.au] 
Sent: Sunday, January 15, 2012 10:46 AM
To: php-db@lists.php.net
Subject: [PHP-DB] Re: Multiple Access to Database

Ethan Rosenberg wrote:

 Dear List -
 
 I have a database:

snip

 
 I want Bob to have access to all tables and fields, with all privileges.
 I want John to have read access to  Visit3: fields [Site, MedRec, 
 Weight, BMI]
 
 1] How do I do it?
 2] In the case that I have two users with write access to a table, how 
 do I lock the tables/fields so that the two users can not change the 
 same varible at the same time?
 
 Thanks.
 
 Ethan

Start with http://dev.mysql.com/doc/refman/5.5/en/privilege-system.html



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



RE: [PHP-DB] Simple MySQL sample code runs out of memory

2011-10-27 Thread Toby Hart Dyke


-Original Message-
From: p...@umpquanet.com [mailto:p...@umpquanet.com] 
Sent: Thursday, October 27, 2011 8:00 PM
To: php-db@lists.php.net
Subject: [PHP-DB] Simple MySQL sample code runs out of memory

Running PHP 5.3.5 on FreeBSD 8.2 connecting to a MySQL 5.1.55 server.

snip
$row = mysql_fetch_array( $result );
while ($row) {
...
/snip

Your while() condition will always be true, so that loop will run forever.
Until you run out of memory.

What you probably meant was  to replace those two lines with something like
this:

while($row = mysql_fetch_array( $result ) ) {

A new row is fetched each time the while loop goes through another
iteration, until you run out of rows and the condition evaluates to false.

  Toby




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



RE: [PHP-DB] Re: SELECT

2011-10-17 Thread Toby Hart Dyke

Though the operators are = and =, not = and =.

  Toby

-Original Message-
From: Jim Giner [mailto:jim.gi...@albanyhandball.com] 
Sent: Monday, October 17, 2011 1:58 PM
To: php-db@lists.php.net
Subject: [PHP-DB] Re: SELECT

I would do it this way:

Where
  $sel_d = (the day # you want)
  $sel_m = (the month # you want)

The where clause would be:

Where  (start_month = $sel_m and start_day = $sel_d) and
 (end_month = $sel_m and end_day = $sel_d)



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



RE: [PHP-DB] SELECT syntax

2011-10-12 Thread Toby Hart Dyke

Not terribly elegant, but this should work:

SELECT `trivia_answer_1` AS `trivia_answer` FROM `Bible_trivia` WHERE `answer`=1
UNION
SELECT `trivia_answer_2` AS `trivia_answer` FROM `Bible_trivia` WHERE `answer`=2
UNION
SELECT `trivia_answer_3` AS `trivia_answer` FROM `Bible_trivia` WHERE `answer`=3
UNION
SELECT `trivia_answer_4` AS `trivia_answer` FROM `Bible_trivia` WHERE 
`answer`=4;

I have to say that it's likely that your design may not be the most optimal. 
What happens if you want 5 answers? Or 6?

  Toby


-Original Message-
From: Ron Piggott [mailto:ron.pigg...@actsministries.org] 
Sent: Wednesday, October 12, 2011 3:25 PM
To: php-db@lists.php.net
Subject: [PHP-DB] SELECT syntax


In my Bible_Trivia table I have the columns

`trivia_answer_1`, `trivia_answer_2`, `trivia_answer_3`, `trivia_answer_4`, 
`answer`

`answer` is an integer always with a value of 1 to 4. Is there a way to use the 
value of `answer` to only select the correct trivia answer?

This doesn’t work, but this is the idea I am trying to achieve:

SELECT `trivia_answer_`answer`` FROM `Bible_trivia`

Thanks in advance,

Ron



www.TheVerseOfTheDay.info 


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



RE: [PHP-DB] Working with large datasets

2011-10-10 Thread Toby Hart Dyke

It sounds as though you don't have an index on the right field. 8 million
records should be no problem if you have the right indexes applied, and
you're not trying to do anything too complicated.

  Toby

-Original Message-
From: Jason Pruim [mailto:li...@pruimphotography.com] 
Sent: Monday, October 10, 2011 11:30 AM
To: php-db@lists.php.net
Subject: [PHP-DB] Working with large datasets

Hey everyone,


I am working with a database that has close to 8 million records in it and
it will be growing. I have a state field in the data, and I am attempting to
test some query's on it, all but 2 records right now have the same state.

My test info won't get pulled up... I believe it keeps timing out the
connection.

Is there any advice for working with large datasets? I'm wanting this to be
able to load quickly.

Thanks in advance! 


Jason Pruim
li...@pruimphotography.com


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



RE: [PHP-DB] Working with large datasets

2011-10-10 Thread Toby Hart Dyke

You have a field in your WHERE clause that isn't indexed - you need an
index. Try something like this:

ALTER TABLE `Database`.`Table` ADD INDEX `state`(`state`);

Think about it -  you're asking for the rows that have a certain value in
the 'state' field. If you don't provide the database with an index, it has
to do a full table scan to retrieve the results.

  Toby


-Original Message-
From: Jason Pruim [mailto:pru...@gmail.com] 
Sent: Monday, October 10, 2011 2:37 PM
To: Jim Giner
Cc: php-db@lists.php.net
Subject: Re: [PHP-DB] Working with large datasets


RIght now though I only have 1 state inputed to work with though. I may need
to just increase the max execution time as well... But it still runs too
slowly ... Even from the commandline searching for a simple: SELECT * from
Table WHERE state=test; takes 56.96 seconds to search and returns only 2
records with 4 columns... Could this just be a hardware problem?

Here is the structure of the table Im working with:

++-+--+-+-++
| Field  | Type| Null | Key | Default | Extra  |
++-+--+-+-++
| ID| int(11)| NO   | PRI | NULL| auto_increment |
| phone| text  | NO   | MUL | NULL||
| config | text  | NO   |   | NULL||
| state   | text  | YES || NULL||
++-+--+-+-++



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



RE: [PHP-DB] Left Join

2011-08-07 Thread Toby Hart Dyke

Is the design under your control? If so, you need to change it. Your
store_list.store_name field breaks the first rule of relational databases -
it isn't atomic. That means that you have two pieces of information there -
the store name and store address. You even have a '~' there to separate them
(nice try, but no).

It's not clear what the function of the 'stores' table is, but there's a
nasty smell coming from there as well (and a field with tilde-separated data
too!)

If this *is* your design, then you might want to show what the source data
looks like. If it's not your design, you have my permission to tell the
owner off ;-)

Not that this really has anything to do with PHP, but I won't say anything
if you won't.

  Toby


-Original Message-
From: Chris Stinemetz [mailto:chrisstinem...@gmail.com] 
Sent: Sunday, August 07, 2011 9:33 PM
To: Peter Lind
Cc: php-db@lists.php.net
Subject: Re: [PHP-DB] Left Join

On Sun, Aug 7, 2011 at 3:00 PM, Peter Lind peter.e.l...@gmail.com wrote:

 Maybe it's just me, but I can't see anything that would work as

foreign key for you to join on - neither table seems to have a foreign
 key


 Sorry for my ignorance. How do I create the foreign key? The two columns
from each table that have a similar relationship are stores.store_mar and
store_list.id_market. Once the foreign key is build what would be the
correct syntax to achieve my query?

Thank you very much,

  Chris






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



Re: [PHP-DB] PHP4 vs PHP5

2011-05-01 Thread Toby Hart Dyke


See:

http://us2.php.net/manual/en/migration5.php

That gives details of migration from PHP4 to PHP5. There are also guides 
for migration between each major point release:


http://us2.php.net/manual/en/migration51.php
http://us2.php.net/manual/en/migration52.php
http://us2.php.net/manual/en/migration53.php

As to whether you will need to rewrite, it all depends on the features 
you have used. For example, if you used any of PHP4's OOP features, you 
are in for a major rewrite. I would definitely get away from PHP4 - it 
is no longer supported.


  Toby

On 4/30/2011 10:31 PM, Dr Vijay Kumar wrote:

We have developed a software using PHP 4. Can Someone advise if it i run it
on PHP5 or keep using PHP4 or is there any need to re-write code for using
PHP5.



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



Re: [PHP-DB] combining the results of mysql query and finding the unique tuples in php

2011-01-07 Thread Toby Hart Dyke

On 1/7/2011 12:10 AM, Fahim M wrote:

Hi
I have a certain number of mysql tables(relation), say 50, some of them
having 5 fields and some with 6 fields. a particular search item may be
found in multiple tables with multiple rows. I am using a loop to find all
those.
My problem is I want to first combine all those results and then find all
the unique entries. (the query results may overlap).


What is the best way to do it?

If you're looking for unique results, do  a UNION query for all the 
tables. You'll need to add a dummy field for the 5-field tables, and 
make sure the field names are the same (use oldfieldname AS 
newfieldname to make sure everything ends up the correct result 
column). UNION queries automatically remove duplicates.


  Toby

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



Re: [PHP-DB] Two forms on one page

2011-01-03 Thread Toby Hart Dyke

On 1/3/2011 10:52 PM, Ethan Rosenberg wrote:

Dear List -

I would like to have two(2) forms in one PHP script.  I would like to 
have the forms appear sequentially; ie, that the first form would 
appear, the data would be entered, and then the second form would 
appear, the data would be entered, and the script would exit.


The code below displays both forms simultaneously.  After the data is 
entered for the first form, the second form appears again.  After the 
data is entered for the second form, the script displays the statement 
 from the first form.


Would you please help me correct the script so that it will perform as 
required.


If you're trying to do this without actually submitting the first form, 
then you'll have to use JavaScript  to hide/show the second form. 
Personally, I'd use jQuery/jQuery UI to get a date picker on the first 
text box, then after a date is entered, display the second box.


  Toby


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



Re: [PHP-DB] Resetting auto_increment

2010-12-14 Thread Toby Hart Dyke

On 12/14/2010 1:02 PM, Ethan Rosenberg wrote:

At 12:38 PM 12/14/2010, Daniel Brown wrote:
On Tue, Dec 14, 2010 at 12:34, Ethan Rosenberg eth...@earthlink.net 
wrote:

 Dear List -

 Thanks for all your help.

 How do I reset auto_increment so that the primary key will start 
from 1.
  The primary key is now 2421.  I have deleted all the data in the 
table and
 started over, and the primary key just increments from its previous 
value.

  Setting auto_increment=0 does not work for me, why I don't know.

UPDATE tablename AUTO_INCREMENT=1;

--
/Daniel P. Brown
Network Infrastructure Manager
Documentation, Webmaster Teams
http://www.php.net/


==
Daniel -

Thanks.

This is what I get -

mysql update Visit3 auto_increment=1;
ERROR 1064 (42000): You have an error in your SQL syntax; check the 
manual that corresponds to your MySQL server version for the right 
syntax to use near '=1' at line 1




Use  'ALTER tablename AUTO_INCREMENT=1' rather than 'UPDATE tablename 
AUTO_INCREMENT=1'.


  Toby


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