Re: [PHP-DB] need help with a query
"Mihail Bota" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I do not think it is going to work, you may want to stick with the PHP > script. MySQL says that is going to enable subqueries from version 4.1 and > the most recent release is 4.0.16 or 4.0.17. > > A question and 2 comments: > q: the teams are fixed within league? > c1: it is not clear how you record the goals of a team against of another. > 2. you may want to check the sizes of some fields; some are too big, or > too small. > > Mihai Thanks, Mihail. I'm using PHP 4.3.3 and MySQL 4.0.15-standard (stuck with what my ISP is providing). RE q: I don't understand your question. Do you mean, the teams are fixed for each season? The answer is yes. RE c1: I do not know how I was going to record the records of one team vs another in a specific series. That is a very good point and I don't have an answer. RE c2: I'll check the field sizes, thanks. Regards, Kirk -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] need help with a query
I do not think it is going to work, you may want to stick with the PHP script. MySQL says that is going to enable subqueries from version 4.1 and the most recent release is 4.0.16 or 4.0.17. A question and 2 comments: q: the teams are fixed within league? c1: it is not clear how you record the goals of a team against of another. 2. you may want to check the sizes of some fields; some are too big, or too small. Mihai On Wed, 31 Dec 2003, Kirk Babb wrote: > If (in MySQL) I have to select 'playerID' from the table soccer.players > based on lname='smith', fname='john', and dob='1988-12-02' and THEN update > soccer.teams 'coachID' equal to the result of the select statement, can I do > it all in one query? > > Or must I let my PHP script execute a select, grab the result, and then run > the update statement? > > The scenario is this: I've just created the player record in soccer.players > (it's an adult league, so a player could also be the coach) and need to grab > that playerID to insert into the coachID section of soccer.teams. > > Here's the definitions for my tables if it would help you follow my question > (with thanks to Micah for the structural assistance): > divisions > Table comments : league division names with identifier > > Field Type Null Default > divisionID int(11) No > division_name varchar(15) No > > players > Table comments : player registration and statistical info > > Field Type Null Default > playerID int(11) No > lname varchar(20) No > fname varchar(20) No > teamID int(11) No 0 > dob date No -00-00 > address varchar(40) No > telephone int(9) No 2147483647 > email varchar(40) No > sex enum('m', 'f') No m > yellow int(2) No 0 > red int(2) No 0 > disc_notes text Yes NULL > goals_scored int(2) No 0 > own_goals int(2) No 0 > > teams > Table comments : Team registration and statistical info > > Field Type Null Default > teamID int(11) No > team_name varchar(20) No > pwd varchar(7) No > coachID int(11) No 0 > divisionID int(11) No 0 > paid enum('y', 'n') No n > pmnt_notes text Yes NULL > win int(2) No 0 > loss int(2) No 0 > tie int(2) No 0 > goals_for int(2) No 0 > goals_against int(2) No 0 > > > Thanks for your help! > > Kirk > > -- > 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
[PHP-DB] need help with a query
If (in MySQL) I have to select 'playerID' from the table soccer.players based on lname='smith', fname='john', and dob='1988-12-02' and THEN update soccer.teams 'coachID' equal to the result of the select statement, can I do it all in one query? Or must I let my PHP script execute a select, grab the result, and then run the update statement? The scenario is this: I've just created the player record in soccer.players (it's an adult league, so a player could also be the coach) and need to grab that playerID to insert into the coachID section of soccer.teams. Here's the definitions for my tables if it would help you follow my question (with thanks to Micah for the structural assistance): divisions Table comments : league division names with identifier Field Type Null Default divisionID int(11) No division_name varchar(15) No players Table comments : player registration and statistical info Field Type Null Default playerID int(11) No lname varchar(20) No fname varchar(20) No teamID int(11) No 0 dob date No -00-00 address varchar(40) No telephone int(9) No 2147483647 email varchar(40) No sex enum('m', 'f') No m yellow int(2) No 0 red int(2) No 0 disc_notes text Yes NULL goals_scored int(2) No 0 own_goals int(2) No 0 teams Table comments : Team registration and statistical info Field Type Null Default teamID int(11) No team_name varchar(20) No pwd varchar(7) No coachID int(11) No 0 divisionID int(11) No 0 paid enum('y', 'n') No n pmnt_notes text Yes NULL win int(2) No 0 loss int(2) No 0 tie int(2) No 0 goals_for int(2) No 0 goals_against int(2) No 0 Thanks for your help! Kirk -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] PHP and MSSQL
yes, it's possible. I'm learning php myself. (I'm a CF junkie.) I got this script from somewhere. I have the info on a backup CD at home. I'll post it if you're having problems with the script below. (I did a google for: ODBC connection mySQL, or something similar to that.) The script below is what I adapted for my purposes. You have to go to (I'm using Win2000, yours would be similar, but necessarily the same) START > CONTROL PANEL > ADMINISTRATIVE TOOLS > DATA SOURCES (ODBC) > SYSTEM DSN : ADD [select Access]; enter the name; click "select" and give the path to your db. Once again, if you're not using Win2000 the above will be slightly different. The php is below: "; } // close the connection. important if persistent connection are "On" odbc_close( $cnx); } ?> --glm -Original Message- From: DragonEye WebDesign [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 31, 2003 4:08 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] PHP and MSSQL hi, I have been learning PHP and MySQL from a book that I have bought. I am really pleased with the way these 2 systems work, but I was wondering if MSSQL wouldn't be easier to use, more specifically I was wondering wether I could make an Access Database and connect it to my php website using MSSQL. I heard it would be possible And now I ask the experts... :-) grtz DragonEye -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -Original Message- From: DragonEye WebDesign [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 31, 2003 4:08 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] PHP and MSSQL hi, I have been learning PHP and MySQL from a book that I have bought. I am really pleased with the way these 2 systems work, but I was wondering if MSSQL wouldn't be easier to use, more specifically I was wondering wether I could make an Access Database and connect it to my php website using MSSQL. I heard it would be possible And now I ask the experts... :-) grtz DragonEye -- 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] EMERGENCY!!
El Mié 31 Dic 2003 16:25, escribió: > He surelly has problems with his DB server. > Does the script die? I am outputting mysql_error() nothing is showing up. > > Hows the mysql logs? I don't know where these are. > > is there some kind of high load on the DB server? I am the only one on it right now. Please try to reply in a way that I can see what part of the message is from whom, and reply to the list also. 1) You defenetly need to read the Manuals of your database (MySQL in this case), and try to get help from a MySQL user-list.[1] 2) The load has nothing to do with who is or not on the server. If the MySQL server is on linux, put "top" on a shell from that server and see if any MySQL child loads up. You may have a lock or something that prevents the update from finishing. [1] I am a PostgreSQL user and in the PG lists there has been lots of disscution about how good the tutorials are for the newbies. I personally think that the big problem with newbies is that they just don't read. -- select 'mmarques' || '@' || 'unl.edu.ar' AS email; - Martín Marqués |[EMAIL PROTECTED] Programador, Administrador, DBA | Centro de Telemática Universidad Nacional del Litoral - -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] EMERGENCY!!
El Mié 31 Dic 2003 15:28, Dennis Cole escribió: > I think that it has more to do with the type of fields he is putting it > into: > > -- > I am trying to build a web site for our inventory. I have a mysql DB > that I Connect to. The following code is what I use. The array products > wont go p-past the 61st ish product, when there are hundreds for it to > deal with. > -- He surelly has problems with his DB server. Does the script die? Hows the mysql logs? is there some kind of high load on the DB server? -- select 'mmarques' || '@' || 'unl.edu.ar' AS email; - Martín Marqués |[EMAIL PROTECTED] Programador, Administrador, DBA | Centro de Telemática Universidad Nacional del Litoral - -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] EMERGENCY!!
I think that it has more to do with the type of fields he is putting it into: -- I am trying to build a web site for our inventory. I have a mysql DB that I Connect to. The following code is what I use. The array products wont go p-past the 61st ish product, when there are hundreds for it to deal with. -- Dennis www.oursanford.com -Original Message- From: Martin Marques [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 31, 2003 1:14 PM To: John Greco; [EMAIL PROTECTED] Subject: Re: [PHP-DB] EMERGENCY!! You throw code to the list with no information about what errors or warnings you got. Why do you say it doesn't work? What happens when you run the script? El Mié 31 Dic 2003 12:46, John Greco escribió: > I am trying to build a web site for our inventory. I have a mysql DB that i > connect to. > The following code is what I use. The array products wont go past > > I tried this first: > > $sql5 = "select * from product where whseNum = '".$whseNumber."' order by > prodNum"; > $result5 = mysql_query($sql5, $conn) or die (mysql_errno() . ": " . > mysql_error(). "\n"); > while ($row5 = mysql_fetch_array($result5)) > { > $products[] = $row5['prodNum']; > } >foreach ($products as $prodNum => $value) >{ > $sql4 = "UPDATE product SET physCount='".$_POST[$value]."' WHERE > prodNum='".$value."' AND whseNum='".$whseNumber."'"; > $result4 = mysql_query($sql4, $conn) or die(mysql_errno() . ": " . > mysql_error(). "\n"); > echo ("In the loop: ".$value); >} > > Then I tried this: > $sql5 = "select * from product where whseNum = '".$whseNumber."' order by > prodNum"; >$result5 = mysql_query($sql5, $conn) or die (mysql_errno() . ": " . > mysql_error(). "\n"); >while ($row5 = mysql_fetch_assoc($result5)) > { > $products[] = $row5['prodNum']; > $sql4 = "UPDATE product SET physCount='".$_POST[$value]."' WHERE > prodNum='".$row5['prodNum']."' AND whseNum='".$whseNumber."'"; > $result4 = mysql_query($sql4, $conn) or die(mysql_errno() . ": " . > mysql_error(). "\n"); > echo ("In the loop: ".$row5['prodNum'].""); > } > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- select 'mmarques' || '@' || 'unl.edu.ar' AS email; - Martín Marqués |[EMAIL PROTECTED] Programador, Administrador, DBA | Centro de Telemática Universidad Nacional del Litoral - -- 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.554 / Virus Database: 346 - Release Date: 12/20/2003 Dennis, KC8YHQ www.oursanford.com -Original Message- From: Martin Marques [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 31, 2003 1:14 PM To: John Greco; [EMAIL PROTECTED] Subject: Re: [PHP-DB] EMERGENCY!! You throw code to the list with no information about what errors or warnings you got. Why do you say it doesn't work? What happens when you run the script? El Mié 31 Dic 2003 12:46, John Greco escribió: > I am trying to build a web site for our inventory. I have a mysql DB that i > connect to. > The following code is what I use. The array products wont go past > > I tried this first: > > $sql5 = "select * from product where whseNum = '".$whseNumber."' order by > prodNum"; > $result5 = mysql_query($sql5, $conn) or die (mysql_errno() . ": " . > mysql_error(). "\n"); > while ($row5 = mysql_fetch_array($result5)) > { > $products[] = $row5['prodNum']; > } >foreach ($products as $prodNum => $value) >{ > $sql4 = "UPDATE product SET physCount='".$_POST[$value]."' WHERE > prodNum='".$value."' AND whseNum='".$whseNumber."'"; > $result4 = mysql_query($sql4, $conn) or die(mysql_errno() . ": " . > mysql_error(). "\n"); > echo ("In the loop: ".$value); >} > > Then I tried this: > $sql5 = "select * from product where whseNum = '".$whseNumber."' order by > prodNum"; >$result5 = mysql_query($sql5, $conn) or die (mysql_errno() . ": " . > mysql_error(). "\n"); >while ($row5 = mysql_fetch_assoc($result5)) > { > $products[] = $row5['prodNum']; > $sql4 = "UPDATE product SET physCount='".$_POST[$value]."' WHERE > prodNum='".$row5['prodNum']."' AND whseNum='".$whseNumber."'"; > $result4 = mysql_query($sql4, $conn) or die(mysql_errno() . ": " . > mysql_error(). "\n"); > echo ("In the loop: ".$row5['prodNum'].""); > } > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- select 'mmarques' || '@' || 'unl.edu.ar' AS email; - Martín Marqués
Re: [PHP-DB] EMERGENCY!!
You throw code to the list with no information about what errors or warnings you got. Why do you say it doesn't work? What happens when you run the script? El Mié 31 Dic 2003 12:46, John Greco escribió: > I am trying to build a web site for our inventory. I have a mysql DB that i > connect to. > The following code is what I use. The array products wont go past > > I tried this first: > > $sql5 = "select * from product where whseNum = '".$whseNumber."' order by > prodNum"; > $result5 = mysql_query($sql5, $conn) or die (mysql_errno() . ": " . > mysql_error(). "\n"); > while ($row5 = mysql_fetch_array($result5)) > { > $products[] = $row5['prodNum']; > } >foreach ($products as $prodNum => $value) >{ > $sql4 = "UPDATE product SET physCount='".$_POST[$value]."' WHERE > prodNum='".$value."' AND whseNum='".$whseNumber."'"; > $result4 = mysql_query($sql4, $conn) or die(mysql_errno() . ": " . > mysql_error(). "\n"); > echo ("In the loop: ".$value); >} > > Then I tried this: > $sql5 = "select * from product where whseNum = '".$whseNumber."' order by > prodNum"; >$result5 = mysql_query($sql5, $conn) or die (mysql_errno() . ": " . > mysql_error(). "\n"); >while ($row5 = mysql_fetch_assoc($result5)) > { > $products[] = $row5['prodNum']; > $sql4 = "UPDATE product SET physCount='".$_POST[$value]."' WHERE > prodNum='".$row5['prodNum']."' AND whseNum='".$whseNumber."'"; > $result4 = mysql_query($sql4, $conn) or die(mysql_errno() . ": " . > mysql_error(). "\n"); > echo ("In the loop: ".$row5['prodNum'].""); > } > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- select 'mmarques' || '@' || 'unl.edu.ar' AS email; - Martín Marqués |[EMAIL PROTECTED] Programador, Administrador, DBA | Centro de Telemática Universidad Nacional del Litoral - -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Subject: Categories and Items query
Neil, Just wanted to let you know that your advice worked like a charm! Thanks so much! Ali Neil Smth wrote: At 01:11 31/12/2003 +, you wrote: To: [EMAIL PROTECTED] Message-ID: <[EMAIL PROTECTED]> Date: Tue, 30 Dec 2003 12:30:06 -0500 From: Ali Van Doren <[EMAIL PROTECTED]> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: Categories and Items query $query = "SELECT category, feature_description FROM features as f, feature_categories as fc WHERE f.feature_category_id=fc.feature_category_id AND f.featureset_id = '1' OR f.featureset_id = '3' ORDER BY f.feature_category_id ASC"; So, I actually have two questions: 1) Does anyone know why my query is misbehaving so badly? I think it's because you need to put the OR statements in brackets, which will then return results with AND (f.featureset_id = '1' OR f.featureset_id = '3' ) Where you are getting results more like ... AND f.featureset_id = '1' then *also asking* for additional results matching "f.featureset_id = '3' " Do you see the difference in the way the SQL interprets your query ? Its quite subtle. Anyway usually to avoid confusion in cases like this I would use the IN construct, its less verbose and you can construct an IN list by using PHP's join(",",featureset) function AND f.featureset_id IN ( '1','3' ) Hope that helps. Neil. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Code Problem.... EMERGENCY!!
I am trying to build a web site for our inventory. I have a mysql DB that I Connect to. The following code is what I use. The array products wont go past the 61st ish product, when there are hundreds for it to deal with. I tried this first: $sql5 = "select * from product where whseNum = '".$whseNumber."' order by prodNum"; $result5 = mysql_query($sql5, $conn) or die (mysql_errno() . ": " . mysql_error(). "\n"); while ($row5 = mysql_fetch_array($result5)) { $products[] = $row5['prodNum']; } foreach ($products as $prodNum => $value) { $sql4 = "UPDATE product SET physCount='".$_POST[$value]."' WHERE prodNum='".$value."' AND whseNum='".$whseNumber."'"; $result4 = mysql_query($sql4, $conn) or die(mysql_errno() . ": " . mysql_error(). "\n"); echo ("In the loop: ".$value); } Then I tried this: $sql5 = "select * from product where whseNum = '".$whseNumber."' order by prodNum"; $result5 = mysql_query($sql5, $conn) or die (mysql_errno() . ": " . mysql_error(). "\n"); while ($row5 = mysql_fetch_assoc($result5)) { $products[] = $row5['prodNum']; $sql4 = "UPDATE product SET physCount='".$_POST[$value]."' WHERE prodNum='".$row5['prodNum']."' AND whseNum='".$whseNumber."'"; $result4 = mysql_query($sql4, $conn) or die(mysql_errno() . ": " . mysql_error(). "\n"); echo ("In the loop: ".$row5['prodNum'].""); } ___ John Greco I.T. Department RAB Electric Manufacturing, Inc. Tel: 888 RAB-1000 Fax: 888 RAB-1232 Email: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] EMERGENCY!!
I am trying to build a web site for our inventory. I have a mysql DB that i connect to. The following code is what I use. The array products wont go past I tried this first: $sql5 = "select * from product where whseNum = '".$whseNumber."' order by prodNum"; $result5 = mysql_query($sql5, $conn) or die (mysql_errno() . ": " . mysql_error(). "\n"); while ($row5 = mysql_fetch_array($result5)) { $products[] = $row5['prodNum']; } foreach ($products as $prodNum => $value) { $sql4 = "UPDATE product SET physCount='".$_POST[$value]."' WHERE prodNum='".$value."' AND whseNum='".$whseNumber."'"; $result4 = mysql_query($sql4, $conn) or die(mysql_errno() . ": " . mysql_error(). "\n"); echo ("In the loop: ".$value); } Then I tried this: $sql5 = "select * from product where whseNum = '".$whseNumber."' order by prodNum"; $result5 = mysql_query($sql5, $conn) or die (mysql_errno() . ": " . mysql_error(). "\n"); while ($row5 = mysql_fetch_assoc($result5)) { $products[] = $row5['prodNum']; $sql4 = "UPDATE product SET physCount='".$_POST[$value]."' WHERE prodNum='".$row5['prodNum']."' AND whseNum='".$whseNumber."'"; $result4 = mysql_query($sql4, $conn) or die(mysql_errno() . ": " . mysql_error(). "\n"); echo ("In the loop: ".$row5['prodNum'].""); } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Editing mysql records in "Grids"
Hi, I am trying to install a script to manage small MySQL tables, that I found here... http://www.weberdev.com/get_example.php3?count=3763 1. Instead of Delete button next to each record I will like to have a check box before each record. 2. Instead of Update button next to each record I will like to have a single update button. 3. I do not want the fields table at the top. 4. And if it's possible, I will like to have 2 or 3 blank rows at the end of the table instead of one row. If anyone knows similar script, I will like to install that. What I liked in this script is the "grids" view to update records. You can see the working examle here.. http://shantanuoak.com/admin.php Shantanu Oak [EMAIL PROTECTED] http://www.shantanuoak.com __ Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard http://antispam.yahoo.com/whatsnewfree -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Subject: Categories and Items query
At 01:11 31/12/2003 +, you wrote: To: [EMAIL PROTECTED] Message-ID: <[EMAIL PROTECTED]> Date: Tue, 30 Dec 2003 12:30:06 -0500 From: Ali Van Doren <[EMAIL PROTECTED]> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: Categories and Items query $query = "SELECT category, feature_description FROM features as f, feature_categories as fc WHERE f.feature_category_id=fc.feature_category_id AND f.featureset_id = '1' OR f.featureset_id = '3' ORDER BY f.feature_category_id ASC"; So, I actually have two questions: 1) Does anyone know why my query is misbehaving so badly? I think it's because you need to put the OR statements in brackets, which will then return results with AND (f.featureset_id = '1' OR f.featureset_id = '3' ) Where you are getting results more like ... AND f.featureset_id = '1' then *also asking* for additional results matching "f.featureset_id = '3' " Do you see the difference in the way the SQL interprets your query ? Its quite subtle. Anyway usually to avoid confusion in cases like this I would use the IN construct, its less verbose and you can construct an IN list by using PHP's join(",",featureset) function AND f.featureset_id IN ( '1','3' ) Hope that helps. Neil. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP and MSSQL
hi, I have been learning PHP and MySQL from a book that I have bought. I am really pleased with the way these 2 systems work, but I was wondering if MSSQL wouldn't be easier to use, more specifically I was wondering wether I could make an Access Database and connect it to my php website using MSSQL. I heard it would be possible And now I ask the experts... :-) grtz DragonEye -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php