[PHP] frustrating problem

2003-01-06 Thread Matthew K. Gold
I hope that I can explain this problem in a logical and clear way.

In MySQL, I have two tables for information::

foo, which contains
FooID, FooLName, FooFName

and

foocontact, which contains
FooID, FooContactID, FooEmail, FooPhone, FooAddress1, etc.

Honestly, I can't remember why I split up the names and contact info into
two separate tables, but that's the way it is...

In the first hundred or so entries of foocontact, FooID and FooContactID are
identical (both columns are auto-increment).  But because I've occasionally
had problems loading data into the database, and have had to reload some
entries while delete or forgetting to delete others, the numbers are now out
of synch.  For some entries, that doesn't seem to be a problem (I might have
fixed them by hand at an earlier date, but I can't remember), but for
others, it might be.

That may not matter, though.  What I'd like to do is call up info from both
foo and foocontact using only the FooID, which is passed in the url.

I can't understand, though, why the where clause in the folllowing line
isn't working the way I want it to:

SELECT FooLName, FooPhone, FooEmail
FROM foo, foocontact
WHERE foocontact.FooID=$FooID and foo.FooID=$FooID;


I've also tried:

WHERE foocontact.FooID=$FooID and foo.FooID=foocontact.FooID;

any idea why that doesn't work?  does any of this make sense?  sorry if it
doesn't, and thanks in advance for your help.

Matt




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




[PHP] what is http://127.0.0.1?

2002-07-27 Thread Matthew K. Gold

ever since I put up a personal firewall, when I start MySQL I''ve been
getting alerts that MySQL is trying to access this ip address when I start
it...

what, exactly, is it, and is there any reason why MySQL would need to access
the internet if I have apache on my own machine?

thanks,

Matt


- Original Message -
From: Jadiel Flores [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, July 26, 2002 6:33 PM
Subject: Re: [PHP] Installed PHP on home Win98se, now how can I get browser
to see it?


 Obiously you need a WebServer too, you can install Apache or Personal Web
 Server, and configure php to work with it, next you can browse you own
 server with the address http://localhost or http://127.0.0.1, maybe you
 will have to install mysql for windows too if you wanna work with
databases
 too.

 Jadiel

 At 03:18 PM 7/26/2002 -0700, you wrote:
 Hello,
 
 I just installed the nice and easy one click PHP install to my Windows
 98se machine.
 
 I just want to be able to test and practice My basic PHP /MySQL stuff
 without up loading.
 
 So now what do I do.
 
 I ran the php info scripts and got bunch of weird messages.
 
 How do I get the PHP to work in my browsers IE, NN just as it does when
 uploaded to my hosting co's servers?
 
 Thanks,
 -Marcus
 
 --

|||
|||
 
 Marcus Unlimited
 http://marcusunlimited.com
 Multimedia Internet Design and Education

|||
|||
 
 ---
 Also visit:
 -  http://www.chromaticus.com
 -  http://ampcast.com/chromaticus
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

 Jadiel Flores
 -
 http://www.abargon.com
 [EMAIL PROTECTED]
 (52-55) 52-29-80-34



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


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




Re: [PHP] sessions

2002-07-26 Thread Matthew K. Gold

re php info:

put this into a file, put it on your server, and call up the page in a
browser:

?php
phpinfo();
?

it will show the settings for php on your server.  As Jim suggested below,
you should check the register_globals setting.  If register_globals is on,
you'll need to use the _Get function.  see more on this by looking up
register_globals and _Get in the php manual at php.net

hth

matt

- Original Message -
From: Tyler Durdin [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, July 26, 2002 2:00 PM
Subject: Re: [PHP] sessions


 I don't know. Tell me where I would find it and I'll look  : -)
 Sorry, pretty new to all of this.

 Do you have register globals off?
 
 Jim Grill
 Support
 Web-1 Hosting
 http://www.web-1hosting.net
 - Original Message -
 From: Tyler Durdin [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Friday, July 26, 2002 12:33 PM
 Subject: [PHP] sessions
 
 
   I used this logout page using sessions a while ago and it used to work
   great, but now it doesn't work. The only thing i have changed is my
 version
   of php. Can someone take a look and see what i have to change?
  
   ?
   session_start();
  
   $old_user = $valid_user;
   $result = session_unregister(valid_user);
   session_destroy();
  
   ?
  
   then a little further down i have this
  
   php?
   if (!empty($old_user)) {
if ($result) {
   echo Logged out.br;
} else {
   echo Could not log you out.br;
}
   } else {
   echo You have not logged in; therefore, you cannot logout.br;
   }
   ?
   It seems to log me out still, but it always gives me the you have not
   logged in; therefor, you cannot logout message. i also checked it
with
 a
   script to see if my original sessions were actually registering and it
   seemed that they were. i am stumped. Any ideas would be greatly
 appreciated.
   Thanks.
  
  
  
   _
   MSN Photos is the easiest way to share and print your photos:
   http://photos.msn.com/support/worldwide.aspx
  
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
  
  




 _
 MSN Photos is the easiest way to share and print your photos:
 http://photos.msn.com/support/worldwide.aspx


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


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




[PHP] Re: arrays, variables, and register_globals--solved--thank you

2002-07-25 Thread Matthew K. Gold

Thank you very much, David--you understood the problem exactly and your
solution worked perfectly!

I'd like to add a comment about mysql_data_seek to the php manual entry on
mysql_fetch_row, because I would think that this might be a common
problem...

Matt

- Original Message -
From: David Robley [EMAIL PROTECTED]
To: GOLD, MATTHEW [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Thursday, July 25, 2002 5:37 AM
Subject: RE: [PHP-DB] Re: arrays, variables, and register_globals



 So what you want to do is print a field from the first row extracted from
the table, then
 loop through all the rows and print several fields? I think you want
mysql_data_seek.

 Whenever you do a mysql_fetch_row, php grabs the current row from the
result set, and
 shifts a pointer to the next record in the result set. In this case it
seems you need to
 print from the first record, then reset the pointer to the first record
and print from all
 records found. So:

 $row = mysql_fetch_row ($result))
 print ($row[4]);

 mysql_data_seek($result, 0);  // Add this

 while ($row = mysql_fetch_row ($result))

 Unless I misunderstand what you are trying to do

 Cheers
 --
 David Robley
 Temporary Kiwi!
 Quod subigo farinam

 I've been to a film festival in the South of France, said Tom cannily.



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




Re: [PHP] How come this will echo No or nothing?

2002-07-14 Thread Matthew K. Gold

this is from the O'Reilly _Programming PHP_ (Rasmus Lerdorf  Kevin Tatroe):

Because echo is not a true function, you can't use it as part of a larger
expression:

// parse error
if (echo(test)) {
   echo(it worked!;
}

Such errors are easily remedied, though, by using the print() or printf()
functions.

p. 76


Here's how I solved a similar problem:

 if ( $foo != '' ) print ( yes);


and then just add the else statement...

best,

Matt


- Original Message -
From: César Aracena [EMAIL PROTECTED]
To: 'JJ Harrison' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Sunday, July 14, 2002 5:42 AM
Subject: RE: [PHP] How come this will echo No or nothing?


 I've come up with this before and solved it like this (guess it'll
 work):

 if($row['plevel'] == '0'){
 echo 'No';
 } else if($row['plevel'] != '0'){
 echo 'Yes';
 }

 Notice the *ELSE IF* instead of a simple else statement. Try it.

 C.

  -Original Message-
  From: JJ Harrison [mailto:[EMAIL PROTECTED]]
  Sent: Saturday, July 13, 2002 1:01 AM
  To: [EMAIL PROTECTED]
  Subject: [PHP] How come this will echo No or nothing?
 
  here is the portion of the script:
 
if($row['plevel'] == '0'){
echo 'No';
} else {
echo 'Yes';
}
 
  here is my table structure dump:
 
  #
  # Table structure for table `docs`
  #
 
  CREATE TABLE docs (
id int(11) unsigned NOT NULL auto_increment,
name varchar(200) NOT NULL default '',
note varchar(200) NOT NULL default '',
author varchar(200) NOT NULL default '',
path varchar(200) NOT NULL default '',
plevel tinyint(3) NOT NULL default '0',
type char(3) NOT NULL default '',
cat tinyint(3) NOT NULL default '0',
file_size int(11) unsigned NOT NULL default '0',
date int(11) unsigned NOT NULL default '0',
PRIMARY KEY  (id)
  ) TYPE=MyISAM;
 
  the row plevel is either 0 or 1.
 
  why won't this script echo Yes?
 
  The reason that the plevel is set in numbers is because I may add
 higher
  ones later.
 
  --
  JJ Harrison
  [EMAIL PROTECTED]
  www.tececo.com
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php



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


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




[PHP] is_null question

2002-07-12 Thread Matthew K. Gold

Hi Everyone,

Here's my problem:  I'd like to make the printing of some text dependent on
whether or not a variable is null.  In the following example, when $row[1]
is null, what gets printed on the page is Email: .  I'd like the
script to not print Email: if row[1] is null.

It looks like I should be using is_null(), but I'm not sure how to use it,
especially since all of this is embedded in a print statement.

while ($row = mysql_fetch_row ($result))
{
 print (\ttr bgcolor=\#ff9900\\n\t\tth$row[0]/th\n/tr\n\ttr
class=\default\ bgcolor=\#ff\\n\t\ttdp$row[10]/ppEmail: a
href=\mailto:$row[1]\;$row[1]/abr /Phone: $row[2]/p\n\npAddress:
$row[3]br /$row[4]br /$row[5] $row[6] $row[7]/p pURL: a
href=\$row[8]\ target=\_blank\$row[8]/a/p/td/tr);
}


Instead of just printing Email: $row[1], I'd like to test whether it's null
first--maybe something like this?

if (is_null($row[1])) print   else print (Email: $row[0])

but can I put that line inside of another print statement?  if so, do I have
to escape the quotation marks?  Please forgive my confusion--I'm new to
programming in general and PHP in particular.

Thanks in advance for your help.

best,

Matt


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




Re: [PHP] Re: Development Tools

2002-07-10 Thread Matthew K. Gold

The difference between Dreamweaver and Homesite is that Homesite is easier
to
customize, and it doesn't mess with your code the way that Dreamweaver does.
If you're happy with Dreamweaver, you should stick with it.  But if you want
more control over your code, you
should consider switching.

Of course, Macromedia recently bought Allaire, so who knows what the next
version of Homesite will look like...

Matt


- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, July 10, 2002 3:39 PM
Subject: [PHP] Re: Development Tools


 For those of you using HomeSite, is it worthwhile for me to install it if
I
 already have DreamWeaver 4 on my PC?  Someone said HomeSite is basically
 DreamWeaver without the UI interface so I'm wondering if it's possible to
use
 DreamWeaver the same way I would Homesite.

 Jesse

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




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




Re: [PHP] how to resort results of a query

2002-07-05 Thread Matthew K. Gold

Thanks very much for your response, Chris--it sounds like that's exactly
what I need to do.

I'm sorry to trouble you further, but if you have a second, can you give me
some advice on how to store results in a temporary table with the columns
indexed?  I'm very new to PHP, and I'm not sure how to go about it.

Thanks in advance.

best,

Matt


- Original Message -
From: Chris Hewitt [EMAIL PROTECTED]
To: Matthew K. Gold [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Friday, July 05, 2002 7:34 AM
Subject: Re: [PHP] how to resort results of a query


 Matthew,

 Its a new query unless you want to sort using php routines. For a small
 amount of data this is fine but for large amounts there is a performance
 hit. Your choice as to the balance with the amount of data you have.

 Where I have a lot of data, extracted from a very large amount of data,
 I store my results in a new, temporary, table that has each field
 indexed. I make the column headings on my html page into links that
 extract the data from the temporary table, ordered by that column. As
 its multi-user, I have a field in the temporary table with the username
 so that each user gets their own data (its first part of the indices too).

 Hope this helps
 Chris

 Matthew K. Gold wrote:

 Hi,
 
 How can I set things up so that a user can resort the results of a query?
 
 Also, how can I make certain columns into links?  I'm making a site that
 will list college courses.  When users decide to browse listings by
 discipline, or college, I'd like the titles of the courses to be links to
 fuller descriptions of those courses.  But I'm
 not sure how to do that.
 
 thanks in advance for your help.
 
 best,
 
 Matt
 
 
 



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




[PHP] how to resort results of a query

2002-07-05 Thread Matthew K. Gold

Hi,

How can I set things up so that a user can resort the results of a query?

Also, how can I make certain columns into links?  I'm making a site that
will list college courses.  When users decide to browse listings by
discipline, or college, I'd like the titles of the courses to be links to
fuller descriptions of those courses.  But I'm
not sure how to do that.

thanks in advance for your help.

best,

Matt



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