Re: [PHP-DB] oddity with insert multiple input fields tomultipletables
On Sat, 2002-08-17 at 21:25, Jason Wong wrote: > You have to check them before inserting. > > if ($value !== "") { > insert_value(); > } > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Okay, so I tried this - if ($date_am || $exercise_am || $reps_am !== "") { $sql_am = "insert into absmachine (today,exercise,reps,comments) values ('$date_am','$exercise_am','$reps_am','$comments_am')"; mysql_query($sql_am) or die ("Error in this query >>$sql<< : " .mysql_error()); } and this - $sql_am = "insert into absmachine (today,exercise,reps,comments) values ('$date_am','$exercise_am','$reps_am','$comments_am')"; if ($date_am || $exercise_am || $reps_am !== "") { mysql_query($sql_am) or die ("Error in this query >>$sql<< : " .mysql_error()); } But I still get empty rows inserted into the tables. -- Chip > > > -Original Message- > > > From: Chip Wiegand [mailto:[EMAIL PROTECTED]] > > > Sent: Sunday, 18 August 2002 7:08 AM > > > To: phpdb > > > Subject: [PHP-DB] oddity with insert multiple input fields to multiple > > > tables > > > > > > > > > > > > I have a web page interface to a mysql database. In this web page I have > > > about a dozen form input fields. On submit these are submitted to > > > multiple tables, a differant table for each input field. If I leave any > > > fields blank, and insert only some of the fields, the database will > > > insert an empty row to all the effected tables that didn't have any data > > > from the input fields. > > > > > > > > > I have another page that generates graphs from the tables, the empty > > > rows show up as breaks in the graphs lines, if I manually delete all the > > > empty rows the graphs work fine. > > > > > > > > > > > > What do I need to do to prevent these empty rows from being written to > > > the tables? > > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > > > /* > Between grand theft and a legal fee, there only stands a law degree. > */ > > > -- > 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] oddity with insert multiple input fields to multipletables
On Sat, 2002-08-17 at 19:49, John Coder wrote: > > This may or may not work but what the h***. If you have multiple insets > commands test for ! isnull() on each input field ,i.e. variable. > > if (! isnull($input_field)) > then "insert_query" > > as I said this will only work with an insert query for each field. I see how that would work with individual insert querys for individual fields, but in my case there are four input fields per query, so it won't work, even then it is possible for one field to be left empty in each query (the comments field). And that is okay. If I try this - if (!isnull($date_am || $exercise_am || $reps_am)) then mysql_query($sql_am) or die ("Error in this query >>$sql<< : " .mysql_error()); I get this error - Parse error: parse error, unexpected T_STRING in /usr/local/apache/htdocs/workout-abs.php on line 111 I have 4 fields, 3 will always be filled, 1 is optional. I thought I would try to test for any of the 3 being empty but it didn't work. -- Chip > On Sat, 2002-08-17 at 17:08, Chip Wiegand wrote: > > I have a web page interface to a mysql database. In this web page I have > > about a dozen form input fields. On submit these are submitted to > > multiple tables, a differant table for each input field. If I leave any > > fields blank, and insert only some of the fields, the database will > > insert an empty row to all the effected tables that didn't have any data > > from the input fields. > > > > I have another page that generates graphs from the tables, the empty > > rows show up as breaks in the graphs lines, if I manually delete all the > > empty rows the graphs work fine. > > > > > > What do I need to do to prevent these empty rows from being written to > > the tables? > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Database abstraction layer needed?
Hello, On 08/17/2002 04:28 PM, Leif K-Brooks wrote: > I'm redoing my web site, and I'm considering using a db abstraction > layer. Would I need one, and should it be db-type specific (like, can > just do one db type)? I don't plan to change database types. If you don't plan to change database types, a database independent abstraction layer is probably not very interesting. So what do you want the abstraction layer to abstract? -- Regards, Manuel Lemos -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] mySQL settings
On Sunday 18 August 2002 09:54, Georgie Casey wrote: > rite, > i run a web server and sell space to workers. my admin setup apache, mysql > and php with all the settings. each customers gets one sql db with a host > acc. the system runs ensim. but now i want one of my accounts do be able to > access the database of another, but it wont let me. what setting do i > change to allow me do this? Try asking on the MySQL mailing list, or read the MySQL manual. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Experiments must be reproducible; they should all fail in the same way. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Comments and table join
I have this query: select avg(article_comment.vote) as avg, article_data.aid, article_data.time, article_data.name, article_data.description from article_data, article_comment where article_comment.aid = article_data.aid AND released > 1 GROUP BY article_data.aid order by time desc One table has article data. The other has article comments (which include a rating). With this query it only returns articles with comments. How can I get it to return all of them? (and return 0 as avg if there are no comments) I am really stuck here. -- JJ Harrison [EMAIL PROTECTED] www.tececo.com -- Please reply on the list/newsgroup unless the reply it OT. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] something is wrong with this query
Thanks I originally wasn't doing a cross-table join with that query so I forgot to put the join in :-} -- JJ Harrison [EMAIL PROTECTED] www.tececo.com -- Please reply on the list/newsgroup unless the reply it OT. "Michael Hazelden" <[EMAIL PROTECTED]> wrote in message C1260EE72F22C44F833D033A17524AD7016A6C68@lhoexc1">news:C1260EE72F22C44F833D033A17524AD7016A6C68@lhoexc1... > Hi there - it's quite simple. > > In this query - you're asking for the average of the vote over the entire > article_comment table - you haven't placed a join between the two tables. > > You need to find your linking field - and join them on that. > > Cheers, > > Michael. > > -Original Message- > From: JJ Harrison [mailto:[EMAIL PROTECTED]] > Sent: 18 August 2002 02:45 > To: [EMAIL PROTECTED] > Subject: [PHP-DB] something is wrong with this query > > > Here the query is: > > select avg(article_comment.vote) as avg, article_data.aid, > article_data.time, article_data.name, article_data.description from > article_data, article_comment where released > 1 GROUP BY article_data.aid > order by time > > It works fine but the average echoed is always the same (which it shouldnt > be). > > > -- > JJ Harrison > [EMAIL PROTECTED] > www.tececo.com > > -- > Please reply on the list/newsgroup unless the reply it OT. > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > _ > This message has been checked for all known viruses by the > MessageLabs Virus Control Centre. > > This message has been checked for all known viruses by the MessageLabs Virus Control Centre. > > > * > > Notice: This email is confidential and may contain copyright material of Ocado Limited (the "Company"). Opinions and views expressed in this message may not necessarily reflect the opinions and views of the Company. > If you are not the intended recipient, please notify us immediately and delete all copies of this message. Please note that it is your responsibility to scan this message for viruses. > > Company reg. no. 3875000. Swallowdale Lane, Hemel Hempstead HP2 7PY > > * -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] oddity with insert multiple input fields to multipletables
> > -Original Message- > > From: Chip Wiegand [mailto:[EMAIL PROTECTED]] > > Sent: Sunday, 18 August 2002 7:08 AM > > To: phpdb > > Subject: [PHP-DB] oddity with insert multiple input fields to multiple > > tables > > > > > > > > I have a web page interface to a mysql database. In this web page I have > > about a dozen form input fields. On submit these are submitted to > > multiple tables, a differant table for each input field. If I leave any > > fields blank, and insert only some of the fields, the database will > > insert an empty row to all the effected tables that didn't have any data > > from the input fields. > > > > > > I have another page that generates graphs from the tables, the empty > > rows show up as breaks in the graphs lines, if I manually delete all the > > empty rows the graphs work fine. > > > > > > > > What do I need to do to prevent these empty rows from being written to > > the tables? You have to check them before inserting. if ($value !== "") { insert_value(); } -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Between grand theft and a legal fee, there only stands a law degree. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] oddity with insert multiple input fields to multipletables
On Sat, 2002-08-17 at 17:08, Chip Wiegand wrote: > I have a web page interface to a mysql database. In this web page I have > about a dozen form input fields. On submit these are submitted to > multiple tables, a differant table for each input field. If I leave any > fields blank, and insert only some of the fields, the database will > insert an empty row to all the effected tables that didn't have any data > from the input fields. > > I have another page that generates graphs from the tables, the empty > rows show up as breaks in the graphs lines, if I manually delete all the > empty rows the graphs work fine. > > > What do I need to do to prevent these empty rows from being written to > the tables? > This may or may not work but what the h***. If you have multiple insets commands test for ! isnull() on each input field ,i.e. variable. if (! isnull($input_field)) then "insert_query" as I said this will only work with an insert query for each field. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] something is wrong with this query
Hi there - it's quite simple. In this query - you're asking for the average of the vote over the entire article_comment table - you haven't placed a join between the two tables. You need to find your linking field - and join them on that. Cheers, Michael. -Original Message- From: JJ Harrison [mailto:[EMAIL PROTECTED]] Sent: 18 August 2002 02:45 To: [EMAIL PROTECTED] Subject: [PHP-DB] something is wrong with this query Here the query is: select avg(article_comment.vote) as avg, article_data.aid, article_data.time, article_data.name, article_data.description from article_data, article_comment where released > 1 GROUP BY article_data.aid order by time It works fine but the average echoed is always the same (which it shouldnt be). -- JJ Harrison [EMAIL PROTECTED] www.tececo.com -- Please reply on the list/newsgroup unless the reply it OT. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ This message has been checked for all known viruses by the MessageLabs Virus Control Centre. This message has been checked for all known viruses by the MessageLabs Virus Control Centre. * Notice: This email is confidential and may contain copyright material of Ocado Limited (the "Company"). Opinions and views expressed in this message may not necessarily reflect the opinions and views of the Company. If you are not the intended recipient, please notify us immediately and delete all copies of this message. Please note that it is your responsibility to scan this message for viruses. Company reg. no. 3875000. Swallowdale Lane, Hemel Hempstead HP2 7PY * -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] mySQL settings
rite, i run a web server and sell space to workers. my admin setup apache, mysql and php with all the settings. each customers gets one sql db with a host acc. the system runs ensim. but now i want one of my accounts do be able to access the database of another, but it wont let me. what setting do i change to allow me do this? -- Regards, Georgie Casey [EMAIL PROTECTED] *** http://www.filmfind.tv Online Film Production Directory *** -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] something is wrong with this query
Here the query is: select avg(article_comment.vote) as avg, article_data.aid, article_data.time, article_data.name, article_data.description from article_data, article_comment where released > 1 GROUP BY article_data.aid order by time It works fine but the average echoed is always the same (which it shouldnt be). -- JJ Harrison [EMAIL PROTECTED] www.tececo.com -- Please reply on the list/newsgroup unless the reply it OT. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] installing to connect to a remote database server
You need to have the postgresql client library (called libpq) and its associated header files installed on the machine you are compiling PHP on. -Rasmus On Sat, 17 Aug 2002, Brian Noecker wrote: > Newbie here. > > I need to install php with postgres support. Problem is I need to have it > connect to a non-local database. Now, the pgconnect function seems to allow > for that, but the install wants local files. > > Can someone point me in the right direction here? > > Thanks, > Brian > > -- > 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] installing to connect to a remote database server
Newbie here. I need to install php with postgres support. Problem is I need to have it connect to a non-local database. Now, the pgconnect function seems to allow for that, but the install wants local files. Can someone point me in the right direction here? Thanks, Brian -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] oddity with insert multiple input fields to multipletables
Hmmm... OK this may a long way around but if when you are generating your graph, if the value returned is then get the next value minus it from the last good value and store it as a value. Get the last the last good, minus the calculated value and use that as the missing value. Put this all into an array then plot from that. ie get array of values 3,4,5,3,0,3,0,1 etc work through array checking values each side if a value is 0. Get the difference and replace 0 with the difference. Hope that's makes sense. I'm only a beginner is this area so someone else will probably have a better way. Howard On Sat, 2002-08-17 at 15:44, Howard Picken wrote: > What about setting all fields have a default value, say 0, that > way you won't have a null but still a zero value. > > Howard That would just make the graphs drop to zero for those dates, which would not look so great. Idealy, pressing submit on the web form would send only the field(s) with data, and not empty fields. -- Chip > -Original Message- > From: Chip Wiegand [mailto:[EMAIL PROTECTED]] > Sent: Sunday, 18 August 2002 7:08 AM > To: phpdb > Subject: [PHP-DB] oddity with insert multiple input fields to multiple > tables > > > I have a web page interface to a mysql database. In this web page I have > about a dozen form input fields. On submit these are submitted to > multiple tables, a differant table for each input field. If I leave any > fields blank, and insert only some of the fields, the database will > insert an empty row to all the effected tables that didn't have any data > from the input fields. > > I have another page that generates graphs from the tables, the empty > rows show up as breaks in the graphs lines, if I manually delete all the > empty rows the graphs work fine. > > > What do I need to do to prevent these empty rows from being written to > the tables? > > -- > chip w > www.wiegand.org > [EMAIL PROTECTED] > > (my web server died and the hard drive crashed hard, and is running from > an incomplete backup on another machine, what a drag) :-( > > > -- > 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] Sybase ASE (linux) - Intermittent connection errors
My Linux box is setup with Sybase ASE 11.9.2-3 (same for the common files) and the openclient is 11.1.1-3. The server I'm connecting to is running 11.9.2.5. phpinfo shows sybase_ct support. PHP version is 4.1.2. I'm getting intermittent connection failures on various queries. Maybe 1 out of 6 times there will be a failure. Here's the error message: - ct_send(): network packet layer: internal net library error: Net-Lib protocol driver call to write data failed - Any idea what this means and what steps I can take to fix it? I'd hate to release an application that will have a 1 in 5 chance of failing any query. The machine connecting to the Sybase server is behind a firewall but I've opened port 2500. Maybe another port needs to be opened? Any suggestions would be appreciated. Jim
[PHP-DB] Sybase ASE (linux) - Intermittent connection errors
My Linux box is setup with Sybase ASE 11.9.2-3 (same for the common files) and the openclient is 11.1.1-3. The server I'm connecting to is running 11.9.2.5. phpinfo shows sybase_ct support. PHP version is 4.1.2. I'm getting intermittent connection failures on various queries. Maybe 1 out of 6 times there will be a failure. Here's the error message: - ct_send(): network packet layer: internal net library error: Net-Lib protocol driver call to write data failed - Any idea what this means and what steps I can take to fix it? I'd hate to release an application that will have a 1 in 5 chance of failing any query. The machine connecting to the Sybase server is behind a firewall but I've opened port 2500. Maybe another port needs to be opened? Any suggestions would be appreciated. Jim
[PHP-DB] oddity with insert multiple input fields to multiple tables
I have a web page interface to a mysql database. In this web page I have about a dozen form input fields. On submit these are submitted to multiple tables, a differant table for each input field. If I leave any fields blank, and insert only some of the fields, the database will insert an empty row to all the effected tables that didn't have any data from the input fields. I have another page that generates graphs from the tables, the empty rows show up as breaks in the graphs lines, if I manually delete all the empty rows the graphs work fine. What do I need to do to prevent these empty rows from being written to the tables? -- chip w www.wiegand.org [EMAIL PROTECTED] (my web server died and the hard drive crashed hard, and is running from an incomplete backup on another machine, what a drag) :-( -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Database abstraction layer needed?
My current website is www.ecritters.biz. I think I need one mostly for counting how many queries a page uses, for changing stuff about how queries are executed (like doing something with the errors on every query), etc. MET wrote: >What's your current website? Why do you think you need one? > >~MET > >-Original Message- >From: Leif K-Brooks [mailto:[EMAIL PROTECTED]] >Sent: Saturday, August 17, 2002 3:28 PM >To: [EMAIL PROTECTED] >Subject: [PHP-DB] Database abstraction layer needed? > > >I'm redoing my web site, and I'm considering using a db abstraction >layer. Would I need one, and should it be db-type specific (like, can >just do one db type)? I don't plan to change database types. > > > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Database abstraction layer needed?
What's your current website? Why do you think you need one? ~MET -Original Message- From: Leif K-Brooks [mailto:[EMAIL PROTECTED]] Sent: Saturday, August 17, 2002 3:28 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Database abstraction layer needed? I'm redoing my web site, and I'm considering using a db abstraction layer. Would I need one, and should it be db-type specific (like, can just do one db type)? I don't plan to change database types. -- 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] Database abstraction layer needed?
I'm redoing my web site, and I'm considering using a db abstraction layer. Would I need one, and should it be db-type specific (like, can just do one db type)? I don't plan to change database types. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Connect to telnet
I want connect cisco router over telnet connection a need send char CTRL-Z for update change from DB and save and exit. I do not know how Scan code or CHR() have combination from keyboard CTRL + Z. Plese help me. My code: <% $ctrlz=???; $fp = fsockopen ($myIPadress, 23, $errno, $errstr, 30); if (!$fp) { echo "$errstr ($errno)\n"; } else { fputs ($fp, "ena\npassword\nusername tomas password pass\n".CHR($ctrlz)."write\nexit\n"); while (!feof($fp)) { $text=fgets ($fp,128); echo $text; } fclose ($fp); } %> Tomas
RE: [PHP-DB] how to insert radiobutton value into mysql database
On 17-Aug-02 bo wrote: > $insertQuery = "INSERT INTO tablename VALUES ( \"{$Seeking}\", ^^ ('$Seeking',...)"; > > )"; > > (and in the future how do I retrieve those from mySQL and output to the > webpage?) $selectQuery ="SELECT * FROM tablename WHERE rule" take the mysql_db_query-command. Regards, Ruprecht P. S. for direct reply remember - because of some spam, mails from hotmail were automaticly filter out by maildrop on my mta. -- Ruprecht Helms - IT-Service & Softwareentwicklung == E-Mail: Ruprecht Helms <[EMAIL PROTECTED]> Date: 17-Aug-02 Time: 11:48:53 == Homepage: http://www.rheyn.de email: [EMAIL PROTECTED] Phone + Fax +49[0]7621 16 99 16 This message was sent by XFMail -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] how to insert radiobutton value into mysql database?
here is a block of code inside a form Record Contract Pub Contract Live Gigs three radio button with the same name but different value, my question is how to insert the value that user clicked when processing the form? I tried to write one, but it didnt' seem to work: $insertQuery = "INSERT INTO tablename VALUES ( \"{$Seeking}\", . )"; (and in the future how do I retrieve those from mySQL and output to the webpage?) Thank you and any help or info will be much appreciated. Bo -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php