RE: [PHP-DB] query

2002-12-04 Thread Jason Vincent
Ideally, you would have 3 tables like so...


Projects(with one record per project)
-
projectID   |ProjectName|   etc...
1   my project
2   another project


Users(with one record per user)
---
userID| userName|   etc...
123 Joe Blow
124 Mary Jane


ProjectsVerified

projectID|  userID
1   123
1   124
2   124


In this example, Joe has verified my project only.  Mary Jane has verified
my project and another project.

Whether you use my database or yours, you will need to use SQL's JOIN syntax
to properly extract the information you are looking for.  Read up on SQL and
JOIN types, (LEFT, INNER, OUTER etc.).  They are tricky at first but well
worth it once you figure out what is going on.  Or just repost, and someone
will help you out with it.

J


-Original Message-
From: Natividad Castro [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, December 04, 2002 9:35 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] query


Hi to all,
I'm working in a system where users can post projects. Other users will
verify those projects. What I'm trying to do is once a user verify a project
he/she cannot view it anymore, but I want to keep it available for the other
users that haven't verified it.

I have two tables project and user_verified. On project table I keep all the
projects that users post. On user_verified I keep users who already verified
for a project.

These are the fields for user_vefified table

project_id, username, verified

Everytime a user verifies a project I insert a new record to the
user_verified table.

This the query, but it doesn't work.
It selects the same record from the two tables. e.g. if the records exist
twice on the user_verified table and one on the project table, it will
display three records when I run the the following query:

$sql = SELECT project.project_id, project.project_name,
project.project_desc FROM project, user_verified
   WHERE project.username  user_verified.username AND project.username
 '$PHP_AUTH_USER' AND project.category='$category');

any help is greatly apprecciate it

Thanks in advance
Nato


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




RE: [PHP-DB] Resource id #2

2002-11-26 Thread Jason Vincent

Try this...

either...

while ($row = mysql_fetch_array($result)) {
  $title = $row['Books.Title'];
  $author = $row['Books.Author'];
...

print $title;
}

or...

while ($row = mysql_fetch_array($result)) {
  print $row['Title'];
...
}



-Original Message-
From: The Cossins Fam [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, November 26, 2002 1:10 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Resource id #2


Hello.

I am using MySQL as a database for a departmental library.  I have written a
quick search script, but keep getting resource id #2 as a result to my
search.  I have read the online documentation for the
mysql_fetch_array() function and must say, I don't see that I'm missing
anything.  However, I've only started programming, much less working with
PHP, so perhaps someone can help me out.  Here's my code:

?

$quickSearch = mcse;

$table1 = Books;
$table2 = BookList;
$table3 = BoxSet;
$table4 = Category;
$table5 = Publisher;
$table6 = AuthUsers;
$table7 = CD;

$connection = mysql_connect(localhost, root) or die(Couldn't connect to
the library database.);

$db_select = mysql_select_db(library, $connection) or die(Couldn't select
the library database.);

$search = SELECT * FROM $table1 LEFT JOIN $table2 ON Books.BookListID =
BookList.BookListID
LEFT JOIN $table3 ON Books.BoxSetID = BoxSet.BoxSetID
LEFT JOIN $table4 ON Books.CategoryID = Category.CategoryID
LEFT JOIN $table5 ON Books.PublisherID = Publisher.PublisherID
LEFT JOIN $table6 ON Books.auID = AuthUsers.auID
LEFT JOIN $table7 ON Books.CD = CD.CD_ID
WHERE Books.Title LIKE \%'$quickSearch'%\
OR Books.Author LIKE \%'$quickSearch'%\
OR Books.ISBN LIKE \%'$quickSearch'%\
OR BookList.dbase LIKE \%'$quickSearch'%\
OR BookList.dbase_user LIKE \%'$quickSearch'%\
OR BoxSet.BoxSet LIKE \%'$quickSearch'%\
OR Category.Category LIKE \%'$quickSearch'%\
OR Category.Sub_category LIKE \%'$quickSearch'%\
OR Publisher.Publisher LIKE \%'$quickSearch'%\;

$result = mysql_query($search, $connection) or die(Couldn't search the
library.);

while ($row = mysql_fetch_array($result)) {
$row['Books.Title'];
$row['Books.Author'];
$row['Books.ISBN'];
$row['BookList.dbase'];
$row['BookList.dbase_user'];
$row['BoxSet.BoxSet'];
$row['Category.Category'];
$row['Category.Sub_category'];
$row['Publisher.Publisher'];
$row['AuthUsers.email'];

}


?

I then have some HTML to display the result of the search.  I don't receive
any error messages - I just see an empty table from the HTML code I wrote.
I added an echo of the $result to find the resouce id #2.

Thanks for any help you can provide.

--joel







_
The new MSN 8: advanced junk mail protection and 2 months FREE* 
http://join.msn.com/?page=features/junkmail


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




RE: [PHP-DB] MySQL Problem

2002-11-21 Thread Jason Vincent
Still think we need to see the PHP code before determining that it is an SQL
problem.

Regards,

J


-Original Message-
From: Jason Wong [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, November 21, 2002 11:55 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] MySQL Problem


On Friday 22 November 2002 00:46, Griffiths, Daniel wrote:
 the statement runs without errors, its just the output thats wrong 
 (see the two tables) I'm displaying the results by doing a simple dump 
 of the query, through my own code and have also tried through 
 phpMyAdmin.

Not sure if this could be the problem -- where are you getting MONTH from
and 
does it start at 0 or 1?

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *


/*
I saw Lassie.  It took me four shows to figure out why the hairy kid never
spoke. I mean, he could roll over and all that, but did that deserve a
series? */


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




RE: [PHP-DB] serious help with linking data together...

2002-11-15 Thread Jason Vincent
you haven't really said what the problem is - but this is what I can see...

Functions like COUNT, MAX and MIN etc. are group functions (or aggregate
functions).  For example, select count(*) actually only returns 1 record -
the total count.  When you mix aggregate functions with regular selects
(that return many rows - like select keyword) you are going to get strange
results.

What are you seeing

Regards,

J


-Original Message-
From: Aaron Wolski [mailto:aaronjw;martekbiz.com] 
Sent: Thursday, November 14, 2002 5:17 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] serious help with linking data together...


Hey all,

Been trying too figure this out all day.

First off I'll explain what I am TRYING to do.


I am creating a Search Engine Tracking Report that lists keywords and the
Search Engines used on that keyword along with the count total for that
search Engine - example:


Keyword Search Engine   Count

Web hosting Yahoo
27
Google
20
MSN
12

Web Design  Overture
30
MSN
17



So on and so forth.


Seems simple right? But no not for me!

CODE:

?php

$keyQuery = db_query(SELECT keyword, COUNT(keyword) as kTotal FROM
SiteTrackingTable WHERE $query GROUP BY keyword);
while ($keyResult = db_fetch($keyQuery)) {

if (strlen($keyResult[keyword])  2) {

$refQuery = db_query(SELECT *, COUNT(referer)
as refTotal FROM SiteTrackingTable WHERE keyword=.$keyResult[keyword].
GROUP BY referer ORDER BY refTotal DESC);
$nrows = db_numrows($refQuery);

?

tr valign=top

td class=content2?php echo $keyResult[keyword]; ?/td

td colspan=2

table border=0 cellpadding=0 cellspacing=0 width=250

tr valign=top

tdimg src=../Graphics/spacer.gif  width=150 height=1/td

tdimg src=../Graphics/spacer.gif  width=100 height=1/td

/tr
?php

while ($refResult = db_fetch($refQuery)) {

?

tr valign=top

td class=content2?php echo $refResult[referer]; ?/td

td class=content2 align=center?php echo $refResult[refTotal]; ?/td

/tr
?php

}

?

/table


/td

/tr
?php

}


}

?


If this is too messed up let me know and I'll reformat.

Sorry guy the annoying question guys.

Aaron





RE: [PHP-DB] Email Encryption?

2002-11-15 Thread Jason Vincent
Why email? If the Admin tool uses SSL, that is all you need.

Regards,

J


-Original Message-
From: Aaron Wolski [mailto:aaronjw;martekbiz.com] 
Sent: Friday, November 15, 2002 11:39 AM
To: 'Aaron Wolski'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Email Encryption?


Just thinking here..


PGP is not an option as it would mean EACH user being setup would need the
company's public key to decrypt. Not possible as they setup a few hundred
accounts each month.

Hmm.. anything else?

Argh :(

Aaron

-Original Message-
From: Aaron Wolski [mailto:aaronjw;martekbiz.com] 
Sent: November 15, 2002 11:36 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Email Encryption?

OFFTOPIC
 
Sorry for the off topic guys..
 
But I've just been informed that an application we developed for a client
whereby they use an Admin tool to setup user accounts into their store needs
to have the login (username and password) encrypted.
 
I am thinking PGP for this but to be honest I've never really worked with
PGP and wouldn't have the first clue.
 
Does anyone have any experience with this or can offer and advise at all?
 
Again, sorry for the OT discussion.
 
Aaron



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




RE: [PHP-DB] Email Encryption?

2002-11-15 Thread Jason Vincent
What I was getting it is, have the 'users' log into a secure web page and
create their own user names and passwords (and enter their email address).
Then just have the admin 'approve' the request and this sends them an email
saying that their access has been granted - that way no information is ever
passed via email.

Regards,

Jason Vincent
Voice Architecture, Nortel Networks
(905) 863-7480 (ESN 333)
[EMAIL PROTECTED]


-Original Message-
From: Aaron Wolski [mailto:aaronjw;martekbiz.com] 
Sent: Friday, November 15, 2002 11:47 AM
To: 'Hutchins, Richard'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Email Encryption?


The user account is setup via the Admin util.

The details are emailed to the account holder.

Profile and Login information are contained within.


Aaron

-Original Message-
From: Hutchins, Richard [mailto:Richard.Hutchins;GetingeCastle.com] 
Sent: November 15, 2002 11:43 AM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Email Encryption?

Can you explain how e-mail fits into the Admin solution? What is the e-mail
used for? Setting up the accounts/passwords or sending the account/password
to the user?

 -Original Message-
 From: Aaron Wolski [mailto:aaronjw;martekbiz.com]
 Sent: Friday, November 15, 2002 11:39 AM
 To: 'Aaron Wolski'; [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] Email Encryption?
 
 
 Just thinking here..
 
 
 PGP is not an option as it would mean EACH user being setup would need 
 the company's public key to decrypt. Not possible as they setup a few 
 hundred accounts each month.
 
 Hmm.. anything else?
 
 Argh :(
 
 Aaron
 
 -Original Message-
 From: Aaron Wolski [mailto:aaronjw;martekbiz.com]
 Sent: November 15, 2002 11:36 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Email Encryption?
 
 OFFTOPIC
  
 Sorry for the off topic guys..
  
 But I've just been informed that an application we developed for a 
 client whereby they use an Admin tool to setup user accounts into 
 their store needs to have the login (username and password) encrypted.
  
 I am thinking PGP for this but to be honest I've never really worked 
 with PGP and wouldn't have the first clue.
  
 Does anyone have any experience with this or can offer and advise at 
 all?
  
 Again, sorry for the OT discussion.
  
 Aaron
 
 
 
 --
 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] phpmysqladmin

2002-11-15 Thread Jason Vincent

http://www.phpwizard.net/projects/phpMyAdmin/

yes it is - and it is a great tool

J


-Original Message-
From: Matt Giddings [mailto:cen10761;centurytel.net] 
Sent: Friday, November 15, 2002 12:18 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] phpmysqladmin


Anybody have the url for phpmysqladmin?  I believe phpmysqladmin is a web
interface for mysql.  I'm sure someone will correct me if I'm wrong.
: )

Thanks,
Matt 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.399 / Virus Database: 226 - Release Date: 10/9/2002
 


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




RE: [PHP-DB] Email Encryption?

2002-11-15 Thread Jason Vincent
What does the admin know about the client?  Do their clients have account
numbers for instance?  If so, you could send them and email saying your user
name is the same as your last name, and your password is the same as your
user account number (an obviously don't disclose the account number in the
email)- and have the app force them to change it the first time they log in.
This way, even if the hacker intercepted the email, they would not know the
clients account number from it and therefore not be able to hack in.  Upon
change, have the app email the client (assuming you have their email address
on file) and let then know that someone has changed their account number,
and if it wasn't them... blah blah

Regards,

J


-Original Message-
From: Aaron Wolski [mailto:aaronjw;martekbiz.com] 
Sent: Friday, November 15, 2002 1:18 PM
To: 'Peter Beckman'
Cc: Vincent, Jason [BRAM:1334:EXCH]; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Email Encryption?


My client is the one doing the setup of accounts.

How would the account holder know of his password before it got encrypted?

Hense the email.

Aaron

-Original Message-
From: Peter Beckman [mailto:beckman;purplecow.com] 
Sent: November 15, 2002 12:35 PM
To: Aaron Wolski
Cc: 'Jason Vincent'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Email Encryption?

Why not encrypt the password in the DB?  If they lose their password, it
cannot be sent to them.  They chose it, so it doesn't need to be sent to
them in their email.  If they lose it, it is changed, and they have to
change it again.  That way, only if they are stupid do they have an extra
step.

The passwords in the DB are encrypted, so only if someone gets a hold of the
DB can the passwords be cracked by brute force.

md5 would work fine for this.  It is the same security that FreeBSD uses in
their password file.

Peter

On Fri, 15 Nov 2002, Aaron Wolski wrote:

 Well.

 Its not what they want.. it what one of their clients want (very big 
 corporation with very unrealistic security standards - you'd think
they
 were NASA or something *grumble*)

 Their thought is that someone could hack the received email, login to 
 the store using the publically displayed logins details and reek havoc 
 on the store, etc.

 *shrugs* Sadly this isn't open for debate as a solutions IS required.

 Any thoughts?

 Aaron

 -Original Message-
 From: Jason Vincent [mailto:jayv;nortelnetworks.com]
 Sent: November 15, 2002 11:42 AM
 To: Aaron Wolski; [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] Email Encryption?

 Why email? If the Admin tool uses SSL, that is all you need. Regards,
 J

 -Original Message-
 From: Aaron Wolski [mailto:aaronjw;martekbiz.com]
 Sent: Friday, November 15, 2002 11:39 AM
 To: 'Aaron Wolski'; [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] Email Encryption?

 Just thinking here..

 PGP is not an option as it would mean EACH user being setup would need 
 the company's public key to decrypt. Not possible as they setup a few 
 hundred accounts each month. Hmm.. anything else?
 Argh :(
 Aaron
 -Original Message-
 From: Aaron Wolski [mailto:aaronjw;martekbiz.com]
 Sent: November 15, 2002 11:36 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Email Encryption?
 OFFTOPIC

 Sorry for the off topic guys..

 But I've just been informed that an application we developed for a 
 client whereby they use an Admin tool to setup user accounts into
their
 store needs to have the login (username and password) encrypted.

 I am thinking PGP for this but to be honest I've never really worked 
 with PGP and wouldn't have the first clue.

 Does anyone have any experience with this or can offer and advise at 
 all?

 Again, sorry for the OT discussion.

 Aaron

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



---
Peter BeckmanSystems Engineer, Fairfax Cable Access
Corporation
[EMAIL PROTECTED]
http://www.purplecow.com/

---


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





RE: [PHP-DB] Difference between 2 dates.. thoughts?

2002-11-13 Thread Jason Vincent
You should be able to do this at the database level - of course you never
said what database that is.

Regardless, check your database documentation for the max() and min()
functions - never used these on date but they might work - do you always
want the first record and the last record in the database?  Or do you mean
the first and last record of the record set?  If you always want the first
record inserted and the last record inserted, than use max() and min() in
the unique database key (the unique record number) assuming you have one and
that they are sequential.

Then check for any date functions that might be able to tell the days
elapsed between to dates (in mySQL you might look at the interval function).

Regards,

J


-Original Message-
From: Aaron Wolski [mailto:aaronjw;martekbiz.com] 
Sent: Wednesday, November 13, 2002 11:33 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Difference between 2 dates.. thoughts?


Hi All,
 
First off I have a query like this:
 
SELECT dateinserted FROM SiteTrackingTable;
 
Now. in this query any number of results could be returned 10 or 1000, etc.
 
Is it possible to take the dateinserted value from the first record and then
from the last record and perform some calculation to get the number of days
the record spans?
 
Haven't done something like this before and don't have a clue where to
start. Date sorting,etc I can do just don't know about this one.
 
Thanks for your help!
 
Aaron



RE: [PHP-DB] Difference between 2 dates.. thoughts?

2002-11-13 Thread Jason Vincent
Test whether min() and max() work on date fields - never tried it.  Or check
the documentation on date and time functions for your database - they may
have something that does this.

If not, you could just do an order by date ascending and grab only the first
record, then an order by date descending and grab the first record of that.
Then you would need to use some date function (or php date module) to find
the span.  If you are using mysql, check out the INTERVAL function.

Regards,

J


-Original Message-
From: Aaron Wolski [mailto:aaronjw;martekbiz.com] 
Sent: Wednesday, November 13, 2002 12:27 PM
To: Vincent, Jason [BRAM:1334:EXCH]; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Difference between 2 dates.. thoughts?


Hi There,

Well the first and last record of the results.

So if 1000 records were found... then record #1 and then record #1000 -
perform data calculation between those 2 records (how many days does this
query span).

Know what I am trying to say?

Sorry if its not clear.

Aaron

-Original Message-
From: Jason Vincent [mailto:jayv;nortelnetworks.com] 
Sent: November 13, 2002 12:24 PM
To: Aaron Wolski; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Difference between 2 dates.. thoughts?

You should be able to do this at the database level - of course you never
said what database that is.

Regardless, check your database documentation for the max() and min()
functions - never used these on date but they might work - do you always
want the first record and the last record in the database?  Or do you mean
the first and last record of the record set?  If you always want the first
record inserted and the last record inserted, than use max() and min() in
the unique database key (the unique record number) assuming you have one and
that they are sequential.

Then check for any date functions that might be able to tell the days
elapsed between to dates (in mySQL you might look at the interval function).

Regards,

J


-Original Message-
From: Aaron Wolski [mailto:aaronjw;martekbiz.com] 
Sent: Wednesday, November 13, 2002 11:33 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Difference between 2 dates.. thoughts?


Hi All,
 
First off I have a query like this:
 
SELECT dateinserted FROM SiteTrackingTable;
 
Now. in this query any number of results could be returned 10 or 1000, etc.
 
Is it possible to take the dateinserted value from the first record and then
from the last record and perform some calculation to get the number of days
the record spans?
 
Haven't done something like this before and don't have a clue where to
start. Date sorting,etc I can do just don't know about this one.
 
Thanks for your help!
 
Aaron





[PHP-DB] indexing on existing DB

2002-11-08 Thread Jason Vincent
(I know this is more of a mySQL question than PHP, but allow me this one if
you would...)

In MySQL, is there any difference between creating an index at table
creation time, and creating an index on an existing table?  Does an index
created on an existing table re-index itself after each insert/update, or
does it only index itself once - when you create the index?

Thanks in advance

Regards,

J




RE: [PHP-DB] Pulling apart select list elements

2002-10-03 Thread Jason Vincent

There is another way -- I sometimes do this...

you can have both the id and text in the value like so...

select
option value=1--product1Product 1
option value=2--another productAnother product
etc...

then parse through the value list and split it on --

foreach ($listOfProducts as $prod){
if (!$prod){break;}
list ($productID,$productName) = split(--,$prod);
}


J

-Original Message-
From: John W. Holmes [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, October 03, 2002 7:57 PM
To: 'Hutchins, Richard'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Pulling apart select list elements


 I have a select multiple/select object named list[] that is
passing
 its
 selected contents to an array. That part works fine. I can use a for
loop
 to
 grab all of the selected items. Where I'm stuck is that I want to get
both
 the value AND the text for any given option element and simply
numbering
 the items in the array 1-N based on the number of rows is not
sufficient.
 
 Example:
 
 select name=itemList[] multiple
   option value=101PHP For Dummies/option
   option value=102PHP For Professionals/option
   option value=103PHP For Gurus/option
 /select
 
 I want to be able to be able to get both the value property (101, 102,
 ...)
 AND the text between the option/option tags. Currently, I'm only 
 getting the text between the option/option tags. Is there a PHP 
 function
that
 allows me to get to both?

No, you only get the value= part. I think your confused, or this isn't the
correct code, when you say your are getting what's between option/option
then you're doing something different.

Bottom line, you only get the value part. If you want two values passed,
then use some hidden elements to relate the values.

input type=hidden name=itemListtext[101] value=PHP For Dummies

would relate to your first element. So in PHP, you'd have

$_POST['itemList'][0] == 101
and
$_POST['itemListtext'][$_GET['itemList'][0]] == PHP For Dummies

If you're using your database correctly, all you should need is the number,
anyhow...

---John Holmes...



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




RE: [PHP-DB] Noob questions...

2002-10-02 Thread Jason Vincent

You should ask if your ISP has not already installed a phpMyAdmin that you
can use - save you the bother.

-Original Message-
From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, October 02, 2002 9:57 AM
To: 'Brett Lathrope'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Noob questions...


Give phpMyAdmin a try...

http://www.phpmyadmin.net/

-Original Message-
From: Brett Lathrope [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 02, 2002 8:55 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Noob questions...



Ok, here's my scenario...

My Web Host has all Root Admin control over MySQL and PHP configs (but they
are setup well no complaints there)...I simply have access to 1 DB (already
created) that I can do what I want with (create/delete/update tables).

I'm VERY comfortable in Windows, C/C++, Delphi and SQL.  But I'm a noob to
Unix/Linux, as well as both MySQL and PHP.

I have two books and the online manuals and I'm reading them...unfortunately
almost ALL of them assume you have Root Admin (as well as build) privileges.

Can someone recommend a MySQL Front End, that a) is free and b) a noob can
set up and finally c) allows me to work from a client on MySQL DB on my Web
Host?

Thanks Brett




-- 
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] Difference in time

2002-10-02 Thread Jason Vincent

for mySQL, the table would look like...
 
CREATE TABLE polls(
 pollID INT NOT NULL AUTO_INCREMENT,
 ipAddress VARCHAR (50) NULL,
 insertTime DATETIME NULL,
 etc...
 
 PRIMARY KEY (pollID)
);
 
===
the code would look like...

$statement = select pollID from polls where insertTime  (now() - INTERVAL
1 HOUR);  //see mySQL date time functions for a description of this
$result = mysql_query($statement);
$rowsReturned = mysql_num_rows($result);
 
if($rowsReturned){
 print Sorry you already voted in the last hour;
}else{
 insert into polls (ipAddress,insertTime) values ('$ipAddress',now());
}
 

P.S. - now() is a database function that will insert the time for you
(mySQL is usually -dd-mm hh:mm:ss)

-Original Message-
From: wade [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, October 02, 2002 2:56 PM
To: Vincent, Jason [BRAM:1334:EXCH]
Subject: Re: [PHP-DB] Difference in time


MYSQL 

Here is a sample of what I am doing 
  


$ip = $_SERVER['REMOTE_ADDR']; 
$time_now = mktime(); 
  
// open connection to database 
$connection = mysql_connect($hostname, $user, $pass) or die (Unable
to connect!); 
  
// get the IP and stored DB time 
$query = SELECT ip_address, server_time 
 FROM stats 
WHERE ip_address = '$ip'; 
$result = mysql_db_query($database, $query, $connection) or die
(Error in query: $query.  . mysql_error()); 
  
$row = mysql_fetch_array($result); 
$get_ip = $row['ip_address']; 
$get_server_time = $row['server_time']; 
  
// close connection 
mysql_close($connection); 
mysql_free_result($result); 
  
if ($ip == $get_ip) 
{ 
$connection = mysql_connect($hostname, $user, $pass) or die
(Unable to connect!); 
$query=select * from stats where server_time  'now()- 1
hour' and ip_address = '$ip'; 
$result = mysql_db_query($database, $query, $connection) or
die (Error in query: $query.  . mysql_error()); 
  
$row = mysql_fetch_array($result); 
$get_ip2 = $row['ip_address']; 
$get_server_time2 = $row['server_time']; 
// close connection 
mysql_close($connection); 
mysql_free_result($result); 
  
if ($get_server_time2) 
{ 
echo Sorry cannot vote; 
exit; 
} 
} 


Jason Vincent wrote: 


  

what kind of database are you using? 


-Original Message- 
From: wade [mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] 
Sent: Wednesday, October 02, 2002 2:47 PM 
To: Vincent, Jason [BRAM:1334:EXCH] 
Subject: Re: [PHP-DB] Difference in time 


One question on this issue. What should I store in the database mktime( ).
time( )? 


Jason Vincent wrote: 


 yeah - the mktime function is returning unix style time (seconds since 
 1970) which is why only the last few numbers are changing.  I would 
 recommend letting the database decide who is able to submit... i.e. 
 
 select * from database where lastSubmitDate  'now()- 1 hour' and IP = 
 '$ipaddress' 
 
 if there is a returned record from the database, you know that this 
 person has made a submission in the last hour.  Otherwise, let them 
 submit again 
 
 Obviously, you will need to figure out the sytax for the now() -1 hour 
 part depending on your database. 
 
 -Original Message- 
 From: wade [mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] 
 Sent: Wednesday, October 02, 2002 1:29 PM 
 To: [EMAIL PROTECTED] 
 Subject: [PHP-DB] Difference in time 
 
 Hello all, 
 
 I am fighting a time issue(don't we all). I have a online poll set up. 
 I need a way to stop a person from submitting more than once an hour. 
 As of now I have the time .. mktime( 
 ) .. being stored in a database along 
 with the users IP. 
 
 I want to be able to say if 1 hour has passed from the time .. mktime( 
 ) .. that is stored in the db they can vote once again. This also has 
 to account that if someone goes to the poll tomorrow at the same time 
 (same 
 hour) the script knows it's a different hour and different day. 
 
 Scenario: I submit to the poll at 12:00 PM, one hour from now will be 
 1:00 PM and I can submit again. Now lets say it's 12:00 PM the next 
 day. The database stored time will say 12:00 PM of the day before, It 
 will not let me submit because it thinks that it has to be at least 
 1:00 PM before I can submit again. Which is wrong. 
 
 I was trying to use the mktime( ) function but it keeps giving me 
 these results.(( 1033578795 )) The last few numbers change but the 
 first few (that as suppose to be the hour) does not change? mktime(int 
 hour, int minute, int second, int month, int day, int year). How can I 
 use this mktime( ) function to do what I need it to? Am I going

[PHP-DB] set_magic_quotes_runtime???

2002-09-18 Thread Jason Vincent

So what does set_magic_quotes_runtime(0) do then???  Will it shut off the
automatic backslashing of single quotes at run time or not?  (it certainly
doesn't seem to)

Anyone?

J