Re: [PHP-DB] Clueless abt Error with MySql

2003-09-08 Thread John Coder
On Mon, 2003-09-08 at 19:56, Robin Kopetzky wrote:
 Good Evening!
 
 I have installed Mysql from RedHat 8.0 and am having difficulties starting
 mysql. I check the my.cnf file and it appears fine as all files it calls for
 are in the right directories. When I attempt to start mysql, I get a cannot
 connect through mysql.sock. What is causing this or put more simply, where
 did I screw up??
 Where is it looking for mysql.sock? I believe with rpm based install it
should be in /var/lib/mysql.
if it's looking in tmp just do a symlink to /tmp/mysql.sock and that
should take care of that prob.

John Coder

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



[PHP-DB] array question

2003-06-02 Thread John Coder
After Wracking my brain for too long on this I decided to give in and ask.
I have holes in an array that came from a database. I put the holes there with 
unset some values so no prob. Now I need to fill the holes. Below is what I 
have and what I need for further manipulations.

Array
(
[0] = Array
(
[0] = Completed
)

[1] = Array
(
[1] = In Progress
)

[2] = Array
(
[0] = Completed
)

[3] = Array
(
[0] = Completed
[1] = In Progress
[3] = Deferred
)
 What I need is:
Array
(
[0] = Array
(
[0] = Completed
)

[1] = Array
(
[0] = In Progress
)

[2] = Array
(
[0] = Completed
)

[3] = Array
(
[0] = Completed
[1] = In Progress
[2] = Deferred
)
Hope this makes sense

John Coder

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



Re: [PHP-DB] Drawing chart

2003-01-01 Thread John Coder
On Wed, 2003-01-01 at 18:27, Matthias Steiner wrote:
 I'd like to have PHP drawing a chart based on temperature data in a mySQL
 database.
 
 Before I start inventing the wheel: does anybody know about finished code
 which produces a *.png-Chart from a table of values in a database?

I've already reinvented the wheel and it's at 

http://www.php.net/manual/en/function.imagefilledarc.php 
in the user comment section.

John Coder


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




Re: [PHP-DB] Drawing chart

2003-01-01 Thread John Coder
On Wed, 2003-01-01 at 21:37, John Coder wrote:
 On Wed, 2003-01-01 at 18:27, Matthias Steiner wrote:
  I'd like to have PHP drawing a chart based on temperature data in a mySQL
  database.
  
  Before I start inventing the wheel: does anybody know about finished code
  which produces a *.png-Chart from a table of values in a database?
 
 I've already reinvented the wheel and it's at 
 
 http://www.php.net/manual/en/function.imagefilledarc.php 
 in the user comment section.
 
 John Coder

 This is a for a pie chart which may or may not help.

John Coder


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




Re: [PHP-DB] a newbie in deep need for help

2002-12-27 Thread John Coder
On Fri, 2002-12-27 at 04:19, Ehab El Maraghy wrote:
 Hi everybody
 I have installed php4 and mysql on IIs winxp
 I am trying to retrieve a password and print it using a query which is
 written as followos
 
 $query2 = select passwd from user where username = '$username';
 $result = mysql_result($query2);
 echo centerBOld Password was $result /B/center;
 
 am I using mysql_result right or is there another function to print this
 password taking in consideration that it just prints Old Password was and
 that's it
 
If I'm not mistaken mysql_result() takes 3 arguments. try:

$select = select passwd from user where username = '$username';
$query2 = mysql_query($select);
$result=mysql_result($query2,0,0);
//the zeroes being the position of row and column i.e. row0 and column 0
echo $result;

John


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




RE: [PHP-DB] image size

2002-12-27 Thread John Coder


Hi guys,
Do you know any methods or code for finding out the images width 
height either with php or javascript
I have a little trouble manipulating the big images. Also, I don't keep
the images in the database, are files on a server.

look at 
http://www.php.net/manual/en/function.getimagesize.php

John Coder
Thanks,
Petre NICOARA



-- 
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] foreach loop from MySQL select query to HTML selectlist

2002-11-27 Thread John Coder
On Wed, 2002-11-27 at 23:33, Gavin Amm wrote:
 Hi,
 
 I'm trying to pick up data from my MySQL database, use a foreach loop to
 extact the data from the result  put that data into a select list.
 
 I have tried the following code with  without the $row = ... line, both
 unsucessfully:
 
 ?PHP
 $db = mysql_connect(myhost, username, );
 mysql_select_db(mydatabase, $db);
 
 ## FETCH INFO
 $sql_dept = SELECT dept FROM content GROUP BY dept;
 $sql_deptsub = SELECT deptsub FROM content GROUP BY deptsub;
 
 mysql_close($db);

How can run a query when it's closed? move this to after the select and
see if it works.
 ?
 
 
 select name=dept
   option-select-/option
 ?PHP
   $result = mysql_query($sql_dept, $db);
   $row = mysql_fetch_array($result);
   foreach ($row as $value) {echo option
 value=\$value\$value/option\n;}
 ?
 /select

Put your mysql_close here if you want to close it.

John Coder


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




Re: [PHP-DB] boolean instead of array

2002-11-03 Thread John Coder
On Sun, 2002-11-03 at 01:44, Jason Wong wrote:
 On Sunday 03 November 2002 10:23, John Coder wrote:
  I seem to somehow get an boolean instead of an array from a
  mysql_fetch_row function and I have no idea how.
  Here's the code;
 
 Try adding some error checking into your code (see manual examples) and using 
 mysql_error() to find out what's going.
 

What error checking to insert into this code I'm clueless. I found out
why I wasn't getting an array by inserting gettype and finding out it's
a boolean type instead of array but past that checking out why It's
boolean type I have no idea how to begin.

John Coder



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




Re: [PHP-DB] boolean instead of array

2002-11-03 Thread John Coder
On Sun, 2002-11-03 at 15:01, Jason Wong wrote:
 On Sunday 03 November 2002 20:58, John Coder wrote:
   Try adding some error checking into your code (see manual examples) and
   using mysql_error() to find out what's going.
 
  What error checking to insert into this code I'm clueless. I found out
 
 Again, have a look at the examples in the manual (the MySQL functions 
 section). The example which starts the chapter shows quite explicitly how you 
 should
 
   (i) establish a connection to the mysql server
  (ii) select a database to query
 (iii) perform a query
  (iv) display the results of the query
 
 And for good measure you should alter the die() statements to incorporate a 
 mysql generated error message:
 
  die( . mysql_error());
 This all I have done and it generates no errors since it returns a
value althogh a boolean type as opposed to Array. Out of 4 different
queries this one is the one that returns a boolean. when I said I have
no idea how to generate an error message I meant how to generate a error
message concerning wrong type of return not no return. 
Sorry if I wasn't clear enough before.

John Coder
 PS everything goes at it should without this query. it's actually shoes
the same with or without the query. but this query is just to generate a
list of names for a graph. the graph itself is generated but the names
aren't





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




Re: [PHP-DB] mysql_connect problem rh7.3

2002-11-02 Thread John Coder
While Micah is correct,  you do have mysql support on php but  as a dbs
not the built in php fuctions. Therefore you must use the dbx functions
instead.

John Coder
On Sat, 2002-11-02 at 14:35, Micah Stevens wrote:
 
 It doesn't appear you have the PHP MySQL functions installed. When you run 
 phpinfo() you should get something like:
 
 mysql
 MySQL Supportenabled
 Active Persistent Links1
 Active Links1
 Client API version3.23.39
 MYSQL_MODULE_TYPEbuiltin
 MYSQL_SOCKET/var/lib/mysql/mysql.sock
 MYSQL_INCLUDE
 MYSQL_LIBS
 
 The command I've always used for this during compile time is --with-mysql 
 without any options. I'm not sure what =shared, /tmp does, but apparently 
 it's not doing the trick.
 
 -Micah
 
 
 At 03:32 PM 11/2/2002 +0100, Wouter wrote:
 Hello,
 
 I've a rather complete php install on redhat 7.3, yet I cant't get php to 
 connect to mysql. I get:
 
  Fatal error: Call to undefined function: mysql_connect() in
  ...
 
 It seems that the necessary packages are installed:
 
 [rootaxon ~]# rpm -qa | grep php
 php-4.1.2-7.3.4
 php-mysql-4.1.2-7.3.4
 asp2php-0.76.2-1
 php-devel-4.1.2-7.3.4
 php-ldap-4.1.2-7.3.4
 php-imap-4.1.2-7.3.4
 [rootaxon ~]# rpm -qa | gi mysql
 mysql-3.23.49-3
 mysql-server-3.23.49-3
 php-mysql-4.1.2-7.3.4
 mysql-devel-3.23.49-3
 mysqlclient9-3.23.22-6
 
 
 I've attached the start of phpinfo() at the end...
 
 Any ideas? Maybe php.ini needs some change, but I can't figure which one..
 
 Thanks,
 Wouter
 
 
 PHP Version 4.1.2
 
 System Linux stripples.devel.redhat.com 2.4.18-11smp #1 SMP Thu Aug 15 
 06:41:59 EDT 2002 i686 unknown
 Build Date Aug 21 2002
 Configure Command  './configure' 'i386-redhat-linux' '--prefix=/usr' 
 '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' 
 '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' 
 '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' 
 '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' 
 '--infodir=/usr/share/info' '--prefix=/usr' '--with-config-file-path=/etc' 
 '--enable-force-cgi-redirect' '--disable-debug' '--enable-pic' 
 '--disable-rpath' '--enable-inline-optimization' '--with-bz2' '--with-db3' 
 '--with-curl' '--with-dom=/usr' '--with-exec-dir=/usr/bin' 
 '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-gd' 
 '--enable-gd-native-ttf' '--with-ttf' '--with-gdbm' '--with-gettext' 
 '--with-ncurses' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' 
 '--with-mm' '--with-openssl' '--with-png' '--with-pspell' 
 '--with-regex=system' '--with-xml' '--with-expat-dir=/usr' '--with-zlib' 
 '--with-layout=GNU' '--enable-bcmath' '--enable-debugger' '--enable-exif' 
 '--enable-ftp' '--enable-magic-quotes' '--enable-safe-mode' 
 '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' 
 '--enable-discard-path' '--enable-track-vars' '--enable-trans-sid' 
 '--enable-yp' '--enable-wddx' '--without-oci8' '--with-imap=shared' 
 '--with-imap-ssl' '--with-kerberos=/usr/kerberos' '--with-ldap=shared' 
 '--with-mysql=shared,/usr' '--with-pgsql=shared' '--with-snmp=shared,/usr' 
 '--with-snmp=shared' '--enable-ucd-snmp-hack' '--with-unixODBC=shared' 
 '--enable-memory-limit' '--enable-bcmath' '--enable-shmop' 
 '--enable-versioning' '--enable-calendar' '--enable-dbx' '--enable-dio' 
 '--enable-mbstring' '--enable-mbstr-enc-trans' '--with-apxs=/usr/sbin/apxs'

snip

 dbx
 dbx support enabled
 dbx version 1.0.0
 supported databases MySQLbr /ODBCbr /PostgreSQLbr /Microsoft SQL 
 Serverbr /FrontBase
 



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




[PHP-DB] boolean instead of array

2002-11-02 Thread John Coder
I seem to somehow get an boolean instead of an array from a
mysql_fetch_row function and I have no idea how.
Here's the code;

?
snip

$names=mysql_query(select name from dept join picdata where 
dept.deptid=picdata.deptid limit 5);

print $names.p;
//offending query

snip
$resets=mysql_query(select sum(reset) from Tmp group by deptid order
by deptid limit 5);
snip

while($c=mysql_fetch_row($names));
{
//$a[]=$c[0]; commented out for troubleshooting
$y=gettype($c);
print $y.P;
}

while($e=mysql_fetch_row($resets))
 {
  $z=gettype($e);
  print $z.br;
 //$b[]=$e[0]; commented out for troubleshooting
 }

Here's the output from a terminal:

select name from dept join picdata where picdata.deptid=dept.deptid
limit 5;
+-+
| name|
+-+
| BodyWatch   |
| BreakThroughGallery |
| TempGallery |
| KidZone |
| Lobby   |
+-+
5 rows in set (0.01 sec)

here's the output from the browser:

Resource id #3
boolean
array
array
array
array
array


Any suggestions as to what I'm doing wrong?

John Coder






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




[PHP-DB] boolean instead of array update

2002-11-02 Thread John Coder
the deptid in both Tmp and picdata are the same so it nakes no diff
which I use the output is the same Boolean each time I just noticed that
the tables were diff names but data and structure is the same.





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




RE: [PHP-DB] string

2002-10-31 Thread John Coder
Didn't even think of looking for a mysql function  to accomplish this.
Thanks.


On Thu, 2002-10-31 at 20:52, Beau Lebens wrote:
 you can do this as a part of your db query
 
 check the string functions available for your rdbms.
 
 mysql would use something like;
 
 SELECT SUBSTRING(monthname(blah), 0, 3) AS monthAbbrev FROM tablename
 
 from memory
 
 HTH
 
 beau
 
 // -Original Message-
 // From: John Coder [mailto:jcoder;insightbb.com]
 // Sent: Friday, 1 November 2002 9:47 AM
 // To: [EMAIL PROTECTED]
 // Subject: [PHP-DB] string
 // 
 // 
 // I want to list months found in db by the first three letters as in an
 // abbrevaition of the months i.e.:
 // Jan
 // Feb
 // Mar
 // Apr 
 // and so forth 
 // I can get the names by monthname(blah) but am stuck on converting
 // strings to first three letters Ive been trying explode(,$blah) but
 // that doesn't work. I'm at a loss here I can't find the correct string
 // function for this. help would be greatly appreciated.
 // 
 // John Coder
 // 
 // 
 // 
 // 
 // -- 
 // 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 Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Pedigree question

2002-10-06 Thread John Coder

On Sun, 2002-10-06 at 21:21, Russell Griechen wrote:

 I would like to have someone comment on whether the 2 tables mentioned would
 suffice and what functions...or code would be better to apply.
 Michael Koifler  sp?  in a book is purported to have a solution for
 heirarchical display...but I am over budget now on this project so if any
 one has seen this book and could help I would appreciate the code...until I
 can afford the book.
 see the tables in the original post below.
the book is MySQL by Koffler and I think you can download most of his
code at his site which is www.Koffler.cc I beleive.

John Coder



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




Re: [PHP-DB] incrememnting an array

2002-09-24 Thread John Coder

On Fri, 2002-09-20 at 16:49, John Coder wrote:
 On Fri, 2002-09-20 at 05:41, Martin Adler wrote:
  
  I hope the little script bellow helps you
  
  greet
  Martin
  
  ?
  $arr = array('a','b','c','d','e','f','g','h');
  
  $arr2[] = $x = array_shift($arr);
  $arr2[] = $y = array_shift($arr);
  $arr2[] = $y;
  
  while($arr)
  {
  $arr2[] = $x.$y .= array_shift($arr);
  $arr2[] = $x.$y;
  }
  
  echo implode(',',$arr2);
  
  echo 'pre';
  print_r($arr2);
  echo '/pre';
  ?
 Unfortunately this concatates the numbers instead of summing them I need
 it to sum them.even if I type cast it to int it still concatates them.
 what I need is from the array:
 array(0,23,2,15,1,14,1,43,22) 
 a new array having:
 array(0,23,23,25,25,40,40,41,41,55,55,98,98,120)
 think of angle and ) being the beginning 23 being the end then 23 being
 the begging of an angle haveing 2 degress so I need it to go to 25 and
 so forth. hope this explains it better.
  
Getting back to those that helped. I ende up splitting the arrays one
for start and one for end. I then added 0 to start and subtracted the
last from start. here is the code I ended up with:
$a=array();
while($d=mysql_fetch_array($start_angle_query))
 {
 $a[]=$d[0];
 }
//copies mysql_fetch_array into an array
$b=array();
$b =$a; // make two arrays one for start of angle 2nd for end of angle
$degree_adjuster=360/array_sum($b); //constant for circle
array_unshift($a,0 ); // add 0 for start angle
$start_angle=array(); // new array to hold values for start vector
$end_angle=array();  //new array to hold values for end vector
array_pop($a); //trim one array for start so numbers don't end on 360
while($a) //iterate till array is empty
{
array_push($start_angle,(end($start_angle)+ $a[0]));

/*enter numbers in array $start_angle adding the last number in array
and adding the
first number from modified original array*/

array_shift($a);//delete first value of array
}
while($b)
{
array_push($end_angle,(end($end_angle)+$b[0]));
array_shift($b);
}


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




Re: [PHP-DB] SQL file,

2002-09-21 Thread John Coder

from the mysql invoked by ? while in the mysql client  the command \. is
what you use. the blurb after is Execute a SQL script file. Takes a
file name as an argument. Dump a file with phpMyAdmin you get a sql
file. at least in Windows you do so I assume you do in non windows OS'es
also.

John
On Sat, 2002-09-21 at 09:27, Brad Bonkoski wrote:
 I don't think it quite works that way through PHP.  You could send the
 _contents_ of the file through PHP, like open the file, and read it into a
 buffer, and send that as a query.  I actually create the files and then go into
 my database system (MySQL -or- PostgreSQL) and then execute a command.  I think
 for MySQL it is:
 mysql \i name_of_file
 and then that will step through the file executing the SQL statements.
 -Brad
 
 Bryan McLemore wrote:
 
  So I would send the file through with a sql query?
 
  -Bryan
  - Original Message -
  From: Brad Bonkoski [EMAIL PROTECTED]
  To: Bryan McLemore [EMAIL PROTECTED]
  Cc: PHP DB LIST [EMAIL PROTECTED]
  Sent: Saturday, September 21, 2002 8:18 AM
  Subject: Re: [PHP-DB] SQL file,
 
   Typically, it is a text file that has SQL in it.
   Like:
   CREATE DATABASE some_name (
   ID int NOT NULL AUTO_INCREMENT PRIMARY KEY,
   NAME varchar(30),
   etc
  
   Usually they are used to store the database information, and can be used
  in many of the database systems.  Within the database itself, there is a
  command to insert from a file.  Not sure off the top of my head, but the
  help menu should provide that
   information, then the database would go through your file and execute
  those commands as if you were entering them in manually on the command line.
  Espescially helpful for huge tables where you might be open to a typo, and
  have to start all over.
   HTH
   -Brad
  
   Bryan McLemore wrote:
  
in an example I saw in a book while I was leafing through it at barnes
  and nobles I saw a .sql file.  It appeared to have the schema for a db in
  it.  I was wondering what exactly what it is and how one could use it in a
  php application like he was doing.
   
Thanks,
Bryan
  



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




Re: [PHP-DB] incrememnting an array

2002-09-20 Thread John Coder

On Fri, 2002-09-20 at 05:41, Martin Adler wrote:
 
 I hope the little script bellow helps you
 
 greet
 Martin
 
 ?
 $arr = array('a','b','c','d','e','f','g','h');
 
 $arr2[] = $x = array_shift($arr);
 $arr2[] = $y = array_shift($arr);
 $arr2[] = $y;
 
 while($arr)
 {
 $arr2[] = $x.$y .= array_shift($arr);
 $arr2[] = $x.$y;
 }
 
 echo implode(',',$arr2);
 
 echo 'pre';
 print_r($arr2);
 echo '/pre';
 ?
Unfortunately this concatates the numbers instead of summing them I need
it to sum them.even if I type cast it to int it still concatates them.
what I need is from the array:
array(0,23,2,15,1,14,1,43,22) 
a new array having:
array(0,23,23,25,25,40,40,41,41,55,55,98,98,120)
think of angle and ) being the beginning 23 being the end then 23 being
the begging of an angle haveing 2 degress so I need it to go to 25 and
so forth. hope this explains it better.
 
 
 - Original Message -
 From: John Coder [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Friday, September 20, 2002 8:19 AM
 Subject: [PHP-DB] incrememnting an array
 
 
 hi all
 this is what I would like to do. I have a dynamically generated array from a
 database and I wnat to do a piechart from it . for example the array would
 hold (a,b,c,d,e,f,g,h) sometimes more sometimes less . I need to get the
 values of a,b,b,a+b,a+b,a+b+c,a+b+c,a+b+c+d, and son on these are for the
 values of the angles for the pie chart on imagefilledarc(). And for the life
 of me I can't figure out how to do it.
 
 any help would be greatly appreciated
 
 John Coder





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




Re: [PHP-DB] How do I submit data AND send user to other page?

2002-08-26 Thread John Coder

On Mon, 2002-08-26 at 13:25, Gerd Ulrich wrote:
 Hello, I want to build a questionaire where the user is guided through five
 pages of questions. How can I program PHP that the user gets to the second
 page after pushing the Submit-Button?
 My solution printed here doesn't work.
 Any hints are greatly apreciated!
 
 S. Maier
 
 ?php
 if ($submit) {
  // process form
 require ('.htmypasswd');
 $verbnr = mysql_connect ($dbhost,$dbuser,$dbpasswd);
 $db = mysql_connect($dbhost,$dbuser,$dbpasswd);
 mysql_select_db(pretest,$db);
 $sql = INSERT INTO frage3 (a1,a2,a3,be_fe01,be_fe02) VALUES
 ('$a1','$a2','$a3','$be_fe01','$be_fe02');
 $result = mysql_query($sql);
 header (Location: http://www.example.com;);
 exit;
 } else{
   // display form
 ?

easiest way I know to do it is in your form action . as in form
action=new_page.php you then can put the above code on that page and
it will process it and still print out the page you want.



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

2002-08-18 Thread John Coder

On Sun, 2002-08-18 at 21:21, Chip Wiegand wrote:
 On Sun, 2002-08-18 at 01:20, Joni Järvinen wrote:
   if (!isnull($date_am || $exercise_am || $reps_am)) then
   mysql_query($sql_am) or die
   (Error in this query $sql :  .mysql_error());
  
  Try:
  
  if(!isnull($date_am)  !isnull($exercise_am)  !isnull($reps_am))
  
  This should IMO work :)
  
  -Joni-
 
 I was looking at the php manual and noticed the function is actually
 is_null, not isnull. Yet it still does not work, I tried this:
 
   $sql_am = insert into absmachine (today,exercise,reps,comments)
 values ('$date_am','$exercise_am','$reps_am','$comments_am');
 if(!is_null($date_am))
   mysql_query($sql_am) or die (Error in this query $sql : 
 .mysql_error()); 
 
 And it still inserts the row no matter what, as long as submit is
 pressed a row is written, with or without any data.
 
Try unset($sql_am) as the result of your is_null() test. you should get
a warning but not a fat error
Otherwise you will have to seperate the inserts I think into 4 diff
queries unless you put the variables to input into an array and then
iterate through the array. Yeah finally got to use iterate!!! too much
reading of Flatterland, just like Flatland only more so

John


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

2002-08-17 Thread John Coder

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] PHP4/mssql_query INSERT problems

2002-07-15 Thread John Coder

On Mon, 2002-07-15 at 21:01, Salve Tinkerworth wrote:
 Why do I keep getting messages like:
 
 INSERT INTO OPS (CampaignID,[Description],PhoneInventory,URLInventory)
 VALUES (463,'In and Out','','')
 Warning: MS SQL message: Line 1: Incorrect syntax near '463'. (severity 15)
 in c:\inetpub\wwwroot\intranet2\ccp\campaign_edit.html on line 62
 
 Warning: MS SQL: Query failed in
 c:\inetpub\wwwroot\intranet2\ccp\campaign_edit.html on line 62
 
 for a simple insert like:
 
 $sql2=INSERT INTO OPS
 (CampaignID,[Description],PhoneInventory,URLInventory) VALUES
 ($new_campaignid,'$Description','$PhoneInventory','$URLInventory');


Try ('$new_campaignid',) instead

snip



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




[Fwd: Re: [PHP-DB] Having more problems]

2002-07-07 Thread John Coder




---BeginMessage---

On Sun, 2002-07-07 at 01:07, Shiloh Madsen wrote:
 The newbie is still having troubles heh. Maybe some kind soul can tell 
 me what im doing wrong this time. This is the code for a page I am 
 working on. When I try to bring up the page in a browser, I just get a white page, 
instead of having the HTML display. Anyone able to tell me why?
 
 
 
 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
 
 html
 head
 titleLogin Page/title
 /head
 ?php
 $dbhost = 127.0.0.1;
 $dbuser = root;
 $db = LoginInfo;
 
 $LoginDB=@mysql_connect($dbhost, $dbuser, $dbpass);
your  supresses error messages from php
 if (! $LoginDB) {
try 
if (! isset($LoginDB))
die(mysql_error());
instead
 print pUnable to connect to the database server at this time./p;
 exit();
 } else {
 mysql_select_db(GameDB,$LoginDB);
 if (! mysql_select_db(GameDB) )
same as above your  supresses error messages from php
again try 
$ConnDB=mysql_select_db(GameDB)
if(! isset(($ConnDB))
die(mysql_error());
 print pUnable to locate the Game Database./p;
 exit();
 }
 ?
 style type=text/css
 body { color: white; background: black; }
 /style
 p align=Centerimg src=Banner.png width=666 height=103 
 alt=DD Resource Page border=0/p
 brbrbrbr
 form name=Login method=Post action=?echo $PHP_SELF?
 p align=Center
 Login: input type=text name=User Name
 Password: input type=password name=Password
 input type=submit name=Submit value=Submit
 /p
 
 /form
 
 ?php
 }
 ?
 
 /html
 
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 



---End Message---

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


Re: [PHP-DB] A real question this time...

2002-07-05 Thread John Coder

On Fri, 2002-07-05 at 14:43, NIPP, SCOTT V (SBCSI) wrote:

 
 mysql_select_db($database, $Test);
 $query_SA = SELECT sbcuid FROM contacts_sa;
 $SA = mysql_query($query_SA, $Test) or die(mysql_error());
 $PASS = $SA;

snip

I think here is your problem you have the select element name pass just
as you have the select query name pass it seems that php might
initialize the variable to the select element name instead of the query
.
 $passed = select size=\1\ name=\pass\\n;
 $passed .= optionSA UID/option\n;
 $passed .= option--/option\n;
 while($name = mysql_fetch_row($PASS)) {
   $passed .= option$name[0]/option\n;
 }
 



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