Re: [PHP-DB] Help. Mysql Query optimisation not very clever?

2004-07-17 Thread Pablo M. Rivas
Hello Ross,

why don't use: explain select .
and you'll see what mysql is "thinking"... ;)



-- 
Best regards,
 Pablo

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



Re: [PHP-DB] Help. Mysql Query optimisation not very clever?

2004-07-16 Thread Jason Wong
On Saturday 17 July 2004 09:31, Ross Honniball wrote:
> Attention all Sql gurus,
>
> Is there a way to FORCE mysql resolve specific conditions within a query
> before wasting it's time trying to resolve other conditions?

  www.mysql.com

-- 
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
--
/*
All I can think of is a platter of organic PRUNE CRISPS being trampled
by an army of swarthy, Italian LOUNGE SINGERS ...
*/

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



[PHP-DB] Help. Mysql Query optimisation not very clever?

2004-07-16 Thread Ross Honniball
Attention all Sql gurus,
Is there a way to FORCE mysql resolve specific conditions within a query 
before wasting it's time trying to resolve other conditions?

I THINK mssql is behaving foolishly in the way it goes about resolving the 
following situation.

Tables :
BN_SupMast : Reference table joined by SupCode field
 \ /
  |
  |
BN_StkMast : Master table with 20,000 records
  |
  |
 / \
BN_StkLevl : Exactly 2 records per BN_StkMast table; Joined by StkCode
When I execute a query explicitly specifying BN_StkMast key, it works 
perfectly as expected.

EXAMPLE OF QUERY THAT WORKS FINE :
   $Q = "select * from BN_StkLevl as sl, BN_StkMast as sm, BN_SupMast as 
sup where"

only dif.--->   ." sm.StkCode='0005'"
." and sl.StkCode=sm.StkCode"
." and sm.StkSupplierUsual=sup.SupCode"
If, instead, I execute a query with a more vague condition on the 
BN_StkMast table, the entire system hangs. I'm guessing this is because 
mySql is first resolving the condition that links all the BN_SupMast 
records against all the BN_StkMast records? I can't think why else it would 
hang.

EXAMPLE OF QUERY THAT HANGS:
   $Q = "select * from BN_StkLevl as sl, BN_StkMast as sm, BN_SupMast as 
sup where"

only dif.--->   ." sm.StkDescription like 'age%'"
." and sl.StkCode=sm.StkCode"
." and sm.StkSupplierUsual=sup.SupCode"
In case you are thinking that this query might just return truck-loads of 
results, this is not the case. If I REMOVE the BN_StkLevl table from the 
above queries, then both work fine (also, if I remove BN_SupMast they both 
work fine). It must be MySql somehow doing something odd.

Sorry for being so long-winded, but can any one help?
Thanks ... Ross
. Ross Honniball  JCU Bookshop Cairns Supervisor
. James Cook Uni, McGreggor Rd, Smithfield, Qld. 4878, Australia
. Ph:07.4042.1157  Fx:07.4042.1158   Em:[EMAIL PROTECTED]
. There are no problems. Only solutions.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] HELP: mySQL table name

2004-04-06 Thread John W. Holmes
From: "Adrian Donoiu" <[EMAIL PROTECTED]>

> I need information about how can I get the table name from this query :
>  select * from test_table as t
> when I use :
>  $field=mysql_fetch_field($result, $i);
>$field->table return the name of the table as "t" but I need the real
> name of the table "test_table".
> How can I do it?

You can't. If you alias the table as "t", then that's the table name. Either
don't use an alias or write a function that'll parse the query to retrieve
the table name.

---John Holmes...

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



[PHP-DB] HELP: mySQL table name

2004-04-06 Thread Adrian Donoiu
I need information about how can I get the table name from this query :

 

 select * from test_table as t

 

when I use :

 

 $field=mysql_fetch_field($result, $i);

 

   $field->table return the name of the table as "t" but I need the real
name of the table "test_table".

 

How can I do it?

 

Thanks

 

Adrian D.

[EMAIL PROTECTED]

 



RE: [PHP-DB] Help MySQL server has gone away

2002-10-01 Thread joakim . andersson

I do not think php is the problem here.
Take a look here
http://www.mysql.com/documentation/mysql/bychapter/manual_Problems.html#Gone
_away
There are some good pointers on what to do...

Regards
Joakim

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




[PHP-DB] Help MySQL server has gone away

2002-09-30 Thread Anthony

ok, I have a script that takes files from a HTTP post and loads them 
into a mySQL database.  Whenever I try to load a file greater than a meg 
ot two, I get mySQL error #2006, MySQL server has gone away.  I checked 
upload_max_filesize in php.ini and that's not the problem, also 
MAX_FILE_SIZE input tag is not the problem.  Anyone have any ideas?

Here the basic code that does the upload.  There is some other code that 
collects other info and some error checking.  I'm not hitting max 
execution time.  So what gives?  Thanks in advance for your help.

BTW, PHP 4.2.1, my SQL 3.23.49-nt

$f1=fopen($_FILES['newfile']['tmp_name'], "r");
$file=fread($f1, $_FILES['newfile']['size']);
$file=AddSlashes($file);
$insertQuery = "INSERT INTO media_files SET
 shortdesc='{$_POST['short']}',  
longdesc='{$_POST['longdesc']}',
username='{$_POST['user']}',
mimetype='{$_FILES['newfile']['type']}',
filedata='{$file}', 
filesize='{$_FILES['newfile']['size']}',
filename='{$_FILES['newfile']['name']}', 
uploaded=CURDATE(),
 category1='{$_POST['gen']}',  
  category2='{$_POST['category']}' 
";

Please help.  Thanks.
- Anthony


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




RE: [PHP-DB] HELP! (mysql)

2001-10-25 Thread Beau Lebens

if you have phpMyAdmin then just use that (if you don't then you *really*
should :)

otherwise, yeah just use mysql_query()

or use the command line

of course the second 2 options assume you can construct the SQL command to
do it, using phpMyAdmin you won't really need to know.

/beau

// -Original Message-
// From: Duncan Abbott [mailto:[EMAIL PROTECTED]]
// Sent: Friday, 26 October 2001 9:17 AM
// To: [EMAIL PROTECTED]
// Subject: [PHP-DB] HELP! (mysql)
// 
// 
// hello,
// 
// can one of you clever people guys 30 seconds to help a lady...?
// 
// can someone just tell me the best way to create a new table 
// in a mysql
// database?
// should i use the mysql_query() function?
// 
// thank you boys,
// 
// xxx
// 
// 
// 
// -- 
// 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] HELP! (mysql)

2001-10-25 Thread Duncan Abbott

hello,

can one of you clever people guys 30 seconds to help a lady...?

can someone just tell me the best way to create a new table in a mysql
database?
should i use the mysql_query() function?

thank you boys,

xxx



-- 
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] Help ! MySQL Problem

2001-03-08 Thread Rosen

Thanks, but the idea is to transfer data between two tables with
same structure.

Rosen Marinov


""karakedi"" <[EMAIL PROTECTED]> wrote in message
987ggc$mca$[EMAIL PROTECTED]">news:987ggc$mca$[EMAIL PROTECTED]...
> ok you must get your variables like row1, row2 etc from anywherelse then
try
> this format too insert them at your db
>
> mysql_connect("localhost","username","password")
> or die ("cant connect database");
>
> @mysql_select_db("databasename")
> or die("cant connect database");
>
> mysql_query("INSERT INTO yourtablename(row1, row2, row3)
> VALUES ('$row1', '$row2', '$row3') ")
>
>
> ""Rosen"" <[EMAIL PROTECTED]> wrote in message
> 987flt$h2r$[EMAIL PROTECTED]">news:987flt$h2r$[EMAIL PROTECTED]...
> > Hi,
> > I'm using MySQL database and I try:
> > "
> > insert into roubr('id','pos','name') values ( select id,pos,name from
> > requestroubr)
> >
> > "
> >
> > and it don't work !
> >
> > Please help!
> > Rosen Marinov
> >
> >
> >
> > --
> > 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 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] Help ! MySQL Problem

2001-03-08 Thread Rosen

Thanks, but it doesn't work !



"Brinzoi Constantin Aurelian" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> On Thu, 8 Mar 2001, Rosen wrote:
>
> > Hi,
> > I'm using MySQL database and I try:
> > "
> > insert into roubr('id','pos','name') values ( select id,pos,name from
> > requestroubr)
> >
> > "
>
> Try this:
> insert into roubr(id,pos,name) values select id,pos,name from requestroubr
>
> I hope this will work !
>
> Best regards
> Constantin Brinzoi
>
> >
> > and it don't work !
> >
> > Please help!
> > Rosen Marinov
> >
> >
> >
> > --
> > 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 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] Help ! MySQL Problem

2001-03-08 Thread karakedi

ok you must get your variables like row1, row2 etc from anywherelse then try
this format too insert them at your db

mysql_connect("localhost","username","password")
or die ("cant connect database");

@mysql_select_db("databasename")
or die("cant connect database");

mysql_query("INSERT INTO yourtablename(row1, row2, row3)
VALUES ('$row1', '$row2', '$row3') ")


""Rosen"" <[EMAIL PROTECTED]> wrote in message
987flt$h2r$[EMAIL PROTECTED]">news:987flt$h2r$[EMAIL PROTECTED]...
> Hi,
> I'm using MySQL database and I try:
> "
> insert into roubr('id','pos','name') values ( select id,pos,name from
> requestroubr)
>
> "
>
> and it don't work !
>
> Please help!
> Rosen Marinov
>
>
>
> --
> 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]




Re: [PHP-DB] Help ! MySQL Problem

2001-03-08 Thread Brinzoi Constantin Aurelian

On Thu, 8 Mar 2001, Rosen wrote:

> Hi,
> I'm using MySQL database and I try:
> "
> insert into roubr('id','pos','name') values ( select id,pos,name from
> requestroubr)
> 
> "

Try this:
insert into roubr(id,pos,name) values select id,pos,name from requestroubr

I hope this will work !

Best regards
Constantin Brinzoi

> 
> and it don't work !
> 
> Please help!
> Rosen Marinov
> 
> 
> 
> -- 
> 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] Help ! MySQL Problem

2001-03-08 Thread Rosen

Hi,
I'm using MySQL database and I try:
"
insert into roubr('id','pos','name') values ( select id,pos,name from
requestroubr)

"

and it don't work !

Please help!
Rosen Marinov



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