Shelley wrote:
Hi all,
I made a post a week ago to ask for the idea of the fastest way to get
table records.
Fyi,
http://phparch.cn/index.php/mysql/35-MySQL-programming/126-fastest-way-to-get-total-records-from-a-table
Hi Shelly,
I question your mysql database setup. I have a log table
- Original Message -
From: Chris [EMAIL PROTECTED]
Date: Wednesday, March 26, 2008 2:18 am
Subject: Re: [PHP-DB] numeric string to single digit array
Richard Dunne wrote:
Sorry for the top-posting, it's my mail client, not my design.
I honestly have not even looked at myphpadmin
I ran this
$query =Select answer from answers where studentID ='A123456789';
$result = mysql_query($query,$connection);
$resultArray = str_split($result,1);
$count = count($resultArray);
Where's the fetch?
|$result = mysql_query(SELECT answer FROM answers WHERE studentID =
- Original Message -
From: Evert Lammerts [EMAIL PROTECTED]
Date: Wednesday, March 26, 2008 3:12 pm
Subject: Re: [PHP-DB] numeric string to single digit array
I ran this
$query =Select answer from answers where studentID ='A123456789';
$result =
- Original Message -
From: Evert Lammerts [EMAIL PROTECTED]
Date: Wednesday, March 26, 2008 3:39 pm
Subject: Re: [PHP-DB] numeric string to single digit array
PHP is telling me that the resource I am using for
mysql_fetch_assoc is invalid:
$query =Select answer from answers
PHP is telling me that the resource I am using for mysql_fetch_assoc is invalid:
$query =Select answer from answers where studentID ='A123456789';
$result = mysql_query($query,$connection);
$count=0;
while($row = mysql_fetch_assoc($result));
{
$count++;
}
echo $count;
Are you sure your
This is my code. The only error is at line 15 as I stated above.
1 ?PHP
2 DEFINE (host,localhost);
3 DEFINE (user,root);
4 DEFINE (password,password);
5 DEFINE (database,questions);
6
7 $connection=mysql_connect(host,user,password) or die ('Could not connect'
.mysql_error() );
8
9
Evert Lammerts wrote:
This is my code. The only error is at line 15 as I stated above.
1 ?PHP
2 DEFINE (host,localhost);
3 DEFINE (user,root);
4 DEFINE (password,password);
5 DEFINE (database,questions);
6
7 $connection=mysql_connect(host,user,password) or die ('Could not
connect'
- Original Message -
From: Evert Lammerts [EMAIL PROTECTED]
Date: Wednesday, March 26, 2008 4:04 pm
Subject: Re: [PHP-DB] numeric string to single digit array
This is my code. The only error is at line 15 as I stated above.
1 ?PHP
2 DEFINE (host,localhost);
3 DEFINE
I found the following function at http://us.php.net/html_entity_decode. This
looks exactly like what I need to filter out information in a text field that's
been copied from Word. The endash or #8211 is not being accepted and my
processing page is halting. My question to you is where in my
OK. Tried that and count comes back as 1.
So your query returns only one record. Try
$query =Select answer from answers;
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
On Mar 26, 2008, at 12:30 PM, Evert Lammerts wrote:
OK. Tried that and count comes back as 1.
So your query returns only one record. Try
$query =Select answer from answers;
Why not do a var_dump() on $result to verify that it
is a mysql result resource and then verify the count
of rows
- Original Message -
From: Evert Lammerts [EMAIL PROTECTED]
Date: Wednesday, March 26, 2008 4:30 pm
Subject: Re: [PHP-DB] numeric string to single digit array
OK. Tried that and count comes back as 1.
So your query returns only one record. Try
$query =Select answer
Tried that as well and got the same result.
I tried Select count(answer) as total from answers where studentID='A123456789';
from the CLI and got total = 2 as a result.
So, we got rid of the Invalid Resource error and we know that the
student id you use occurs in both rows in your table
- Original Message -
From: Evert Lammerts [EMAIL PROTECTED]
Date: Wednesday, March 26, 2008 5:22 pm
Subject: Re: [PHP-DB] numeric string to single digit array
Tried that as well and got the same result.
I tried Select count(answer) as total from answers where
Using this extract from
http://ie.php.net/manual/en/control-structures.foreach.php
Amaroq
09-Mar-2008 06:40
Even if an array has only one value, it is still an array and foreach will run
it.
?php
$arr[] = I'm an array.;
if(is_array($arr))
{
foreach($arr as $val)
{
echo $val;
Not sure if this is relevant anymore, but...
i.e. 1223123 into ['1','2,','2','3','1,'2','3'] ?
$num = 1223123;
$nums = array_filter(preg_split('//', $nums));
Or you can use this function.
It's probably better since the array_filter will probably get rid of any 0's
in the string.
function
Roberto Mansfield wrote:
Shelley wrote:
Hi all,
I made a post a week ago to ask for the idea of the fastest way to get
table records.
Fyi,
http://phparch.cn/index.php/mysql/35-MySQL-programming/126-fastest-way-to-get-total-records-from-a-table
Hi Shelly,
I question your mysql database
Richard Dunne wrote:
Using this extract from
http://ie.php.net/manual/en/control-structures.foreach.php
Amaroq
09-Mar-2008 06:40
Even if an array has only one value, it is still an array and foreach will run it.
?php
$arr[] = I'm an array.;
if(is_array($arr))
{
foreach($arr as $val)
I did var_dump on the result resource and I got resource(5) of type (mysql
result).
---BeginMessage---
On Mar 26, 2008, at 12:30 PM, Evert Lammerts wrote:
OK. Tried that and count comes back as 1.
So your query returns only one record. Try
$query =Select answer from answers;
Why not
Yes, Chris. You are right. I think I mentioned in the archive that the table
is Innodb engined.
Maybe Roberto didn't notice that.
On Thu, Mar 27, 2008 at 7:26 AM, Chris [EMAIL PROTECTED] wrote:
Roberto Mansfield wrote:
Shelley wrote:
Hi all,
I made a post a week ago to ask for the
Does that mean MySQL is slow?
Currently one practice I am using is: get $m = $userId%256, then store
$userId's information in table_$m.
Then the table with more than 20, 000, 000 records is split into 256 tables,
and that can speed up the query.
I want to listen to your opinion about that.
Thank you very much, Chris. :)
Fyi,
On Wed, Mar 26, 2008 at 1:27 PM, Chris [EMAIL PROTECTED] wrote:
Shelley wrote:
+--+---+--+-+---++
| Field| Type | Null | Key | Default
| Extra
mysql explain select count(*) from message;
++-+-+---+---++-+--+--+-+
| id | select_type | table | type | possible_keys | key| key_len
| ref | rows | Extra |
Actually, I wonder how facebook is dealing with this matter. Somebody knows?
There's lots of info here:
http://highscalability.com/
about various websites (some using mysql, some using postgres, some
using oracle etc).
--
Postgresql php tutorials
http://www.designmagick.com/
--
PHP
On Thu, Mar 27, 2008 at 10:03 AM, Chris [EMAIL PROTECTED] wrote:
mysql explain select count(*) from message;
++-+-+---+---++-+--+--+-+
| id | select_type | table | type | possible_keys | key| key_len
On Thu, Mar 27, 2008 at 10:06 AM, Chris [EMAIL PROTECTED] wrote:
Actually, I wonder how facebook is dealing with this matter. Somebody
knows?
There's lots of info here:
http://highscalability.com/
about various websites (some using mysql, some using postgres, some using
oracle etc).
That's never going to be fast because you're using innodb tables.
Should I change it to MyISAM ones?
It depends.
Do you need or use transactions? You can't change - myisam doesn't
support them.
No. That's only part of it. I have a cron job, which get the total
visits often.
If
On Thu, Mar 27, 2008 at 10:40 AM, Chris [EMAIL PROTECTED] wrote:
That's never going to be fast because you're using innodb tables.
Should I change it to MyISAM ones?
It depends.
Do you need or use transactions? You can't change - myisam doesn't support
them.
I haven't tried
Good idea. But I wonder whether calling the trigger each insert will
loose any performance.
It's going to affect things slightly but whether it'll be noticable only
you can answer by testing.
Another option I sometimes see is set up a replicated slave and run your
reports off that instead
30 matches
Mail list logo