[PHP-DB] DISTINCT Question

2002-04-20 Thread Jeff Oien

How can I do a query for a distinct field plus get the info from
other fields? I tried this:
select DISTINCT email, name_first, name_last, id from applicants;
and it gave me everything. Thanks.
Jeff Oien

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




RE: [PHP-DB] MySQL to Email and Line Breaks

2002-04-14 Thread Jeff Oien

How do I get it to do that? I tried replacing \n with \r\n but it's not
even finding any \n. This is really puzzling me. If I copy the data
from the database field using MySQL-Front and paste it into a word 
processor it will have the line breaks retained. But what is it in the 
data that shows these breaks? I can't find any \n in the data. Then 
when it's sent via email of course there are no line breaks displayed.
Jeff Oien

> Hiya,
> 
> If I remember correctly, you much send both \r and \n to terminate a line 
> on an e-mail, regardless of the platform. This should include the header 
> aswell.
> 
> At 12:00 14/04/2002 +0100, DL Neil wrote:
> >Jeff,
> >
> > > I have a form where someone enters the body of an email message
> > > into a  part of a form to be sent out to a list. Then a
> >script
> > > retrieves the body and sends it via email. However I can't get line
> >breaks
> > > to show up (I'm using MS Outlook) even if I enter the \n into the
> >textarea
> > > form and those \n show up in the database data. I must be missing
> > > something. Thanks for any help.
> >
> >
> >Line Breaks across different OpSys:
> >
> >*nix: newline character
> >Mac: carriage return character
> >Windows: both CR and LF
> >
> >LF = Newline/Line Break/Line Feed = ASCII chr(10)
> >CR = Carriage Return = ASCII chr(13)
> >
> >Regards,
> >=dn
> >
> >
> >--
> >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] Re: MySQL to Email and Line Breaks

2002-04-13 Thread Jeff Oien

I tried wrap=hard already. I should have mentioned that. Sorry if this is
off topic.
Jeff Oien

> You need a wrap= within your textarea.. You may need a couple if the
> browsers haven't come together on it yet.. But you can check it out here:
> 
> http://www.blooberry.com/indexdot/html/tagpages/t/textarea.htm
> 
> Just scroll down to wrap and check it out..
> 
> BTW, this seems like HTML help rather than PHP help..
> 
> Later,
> 
> Bob Weaver
> 
> "Jeff Oien" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > I have a form where someone enters the body of an email message
> > into a  part of a form to be sent out to a list. Then a script
> > retrieves the body and sends it via email. However I can't get line breaks
> > to show up (I'm using MS Outlook) even if I enter the \n into the textarea
> > form and those \n show up in the database data. I must be missing
> > something. Thanks for any help.
> > Jeff Oien
> 
> 
> 
> -- 
> 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] MySQL to Email and Line Breaks

2002-04-13 Thread Jeff Oien

This isn't what I'm looking for because the output is to email not HTML.
What I would like is the natural line breaks in the form input to be 
preserved and then result in line breaks in the email without having
to add any \n, which didn't work anyway.
Jeff Oien

> check out nl2br() function [newline to break]
> http://www.php.net/manual/en/function.nl2br.php
> 
> olinux
> 
> 
> 
>  Jeff Oien  wrote: I have a form where someone enters
> the body of an email messageinto a part of a form to
> be sent out to a list. Then a script retrieves the
> body and sends it via email. However I can't get line
> breaksto show up (I'm using MS Outlook) even if I
> enter the \n into the textarea form and those \n show
> up in the database data. I must be missing something.
> Thanks for any help.Jeff Oien

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




[PHP-DB] MySQL to Email and Line Breaks

2002-04-13 Thread Jeff Oien

I have a form where someone enters the body of an email message
into a  part of a form to be sent out to a list. Then a script 
retrieves the body and sends it via email. However I can't get line breaks
to show up (I'm using MS Outlook) even if I enter the \n into the textarea 
form and those \n show up in the database data. I must be missing 
something. Thanks for any help.
Jeff Oien

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




RE: [PHP-DB] Re: Speed Up Code?

2002-03-25 Thread Jeff Oien

Fantastic! I'm going to have to study the code more to really understand
it. Thanks for the help. I had to change the code just a little for it to work:

$sql = "SELECT u.id, u.username, u.album_title, 
date_format(MAX(f.date), '%b %D, %Y') as date1, 
COUNT(*) AS cnt FROM Chart_Users AS u
INNER JOIN Chart_Files AS f USING (id) 
GROUP BY f.id ORDER BY u.album_title ASC";

$result = @mysql_query($sql,$connection) 
or die(" Couldn't execute query.");

while ($row = mysql_fetch_array($result)) {
$id = $row['id'];
$username = $row['username'];
$title1 = $row['album_title'];
$title = stripslashes($title1);
$date1 = $row['date1'];
$cnt = $row['cnt'];

$display_block .= "
$title 
$cnt$date1";
}

> Hi Jeff,
> 
> the most important rule you should follow: don't query the database
> in a loop to avoid a join! The following lines (maybe some changes
> are necesary) will do the same job as your code, but considerable faster. 
> Especially if 'id' is an index in both tables.
> 
> Lutz
> 
> 
> $sql = 'SELECT u.id, u.username, u.album_title,'
> .' date_format(MAX(f.date), '%b. %D, %Y') as date1,'
> .' COUNT(*) AS cnt'
>.' FROM Chart_Users AS u'
>   .' INNER JOIN Chart_Files AS f USING (id)'
>   .' GROUP BY f.id'
>   .' ORDER BY u.album_title ASC';
> 
> $result = @mysql_query($sql,$connection) or die(" Couldn't execute query.");
> 
> while ($row = mysql_fetch_array($result)) {
> $id = $row['id'];
> $username = $row['username'];
> $title1 = $row['album_title'];
> $title = stripslashes($title1);
> $date1 = $row['date1'];
> 
> $display_block .= " $href=\"display_album.php?id=$id\">$title  align=\"left\">$cnt$date1";
> }
> 
> 
> [EMAIL PROTECTED] (Jeff Oien) writes:
> 
> > Here is some code I have for an index page of people who post
> > charts on the Web, kind of like Yahoo Photos or something.
> > It displays the album title, number of images and date of last
> > upload. The page takes about 5-6 seconds to load which is all
> > in the queries I'm sure. Is there a way I can make this more efficient?
> > http://www.webdesigns1.com/temp/code.txt
> > Jeff
> > 
> > --
> > 
> > $table_name = "Chart_Users";
> > $sql = "SELECT * FROM $table_name order by album_title";
> > $result = @mysql_query($sql,$connection) or die(" Couldn't execute query.");
> > //if(! $result = mysql_query($sql,$connection)) {
> >   //print("ERROR ".mysql_errno().": 
> ".mysql_error()."\n$sql\n");
> > //  }
> > 
> > while ($row = mysql_fetch_array($result)) {
> > $id = $row['id'];
> > $username = $row['username'];
> > $title1 = $row['album_title'];
> > $title = stripslashes($title1);
> > 
> > $sql1 = "SELECT COUNT(*) FROM Chart_Files where id = '$id'";
> > $result1 = @mysql_query($sql1,$connection) or die(" Couldn't 
> execute query.");
> > //if(! $result = mysql_query($sql1,$connection)) {
> > //print("ERROR ".mysql_errno().": 
> ".mysql_error()."\n$sql\n");
> > //}
> > $count = mysql_result($result1,0,"count(*)");
> > 
> > $sql2 = "SELECT date_format(date, '%b. %D, 
> %Y') as date1 FROM Chart_Files where
> > id = '$id' order by photoid desc limit 1";
> > $result2 = @mysql_query($sql2,$connection) 
> or die(" Couldn't execute query.");
> > $row = mysql_fetch_array($result2);
> > $date1 = $row['date1'];
> > 
> > if ($count > 0) {
> > 
> > $display_block .= " > href=\"display_album.php?id=$id\">$title  > align=\"left\">$count$date1";
> > }
> > }
> 
> -- 
> 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] Speed Up Code?

2002-03-24 Thread Jeff Oien

Here is some code I have for an index page of people who post
charts on the Web, kind of like Yahoo Photos or something.
It displays the album title, number of images and date of last
upload. The page takes about 5-6 seconds to load which is all
in the queries I'm sure. Is there a way I can make this more efficient?
http://www.webdesigns1.com/temp/code.txt
Jeff

--

$table_name = "Chart_Users";
$sql = "SELECT * FROM $table_name order by album_title";
$result = @mysql_query($sql,$connection) or die(" Couldn't execute query.");
//if(! $result = mysql_query($sql,$connection)) {
  //print("ERROR ".mysql_errno().": ".mysql_error()."\n$sql\n");
//  }

while ($row = mysql_fetch_array($result)) {
$id = $row['id'];
$username = $row['username'];
$title1 = $row['album_title'];
$title = stripslashes($title1);

$sql1 = "SELECT COUNT(*) FROM Chart_Files where id = '$id'";
$result1 = @mysql_query($sql1,$connection) or die(" Couldn't execute 
query.");
//if(! $result = mysql_query($sql1,$connection)) {
//print("ERROR ".mysql_errno().": ".mysql_error()."\n$sql\n");
//}
$count = mysql_result($result1,0,"count(*)");

$sql2 = "SELECT date_format(date, '%b. %D, %Y') as 
date1 FROM Chart_Files where
id = '$id' order by photoid desc limit 1";
$result2 = @mysql_query($sql2,$connection) or die(" 
Couldn't execute query.");
$row = mysql_fetch_array($result2);
$date1 = $row['date1'];

if ($count > 0) {

$display_block .= "$title $count$date1";
}
}


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




[PHP-DB] GREATEST, LEAST

2002-03-11 Thread Jeff Oien

Could anyone give me an example of how to use GREATEST
and LEAST in a MySQL query. I want to look through the 
last 15 records in a certain field and find the highest and/or 
lowest number. Thanks.
Jeff Oien

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




[PHP-DB] Unwanted Column Updating

2001-11-03 Thread Jeff Oien

I have this which inserts a stock trade entry:

$sql1 = "INSERT INTO $table_name 
(stock, shares, LorS, type, price1, time1) VALUES
(\"$stock\", \"$shares\", \"$LorS\", \"$type\", \"$price1\", NOW())";

With price1 being the entry price and time1 the date/time of entry. 
Then when I exit the trade it will do this:

$sql1 = "update $table_name set stock = '$stock', 
shares = '$shares', LorS = '$LorS', type = '$type', 
price1 = '$price1', price2 = '$price2', time2 = NOW() where id = '$id'";

However, time1 is being updated to be the same as time2 after 
the exit and I don't want it to be. Am I missing something?
Jeff Oien

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] Previous | Next (Again)

2001-08-31 Thread Jeff Oien

OK, I see what you're saying and the O'Reilly link from someone
else was very helpful, however I think there still must be a simpler way to
do it. I don't need to have the reorder picture function. Each picture record
has an id field which is linked to their username (in another table) and a photo_id
which is unique for every photo in the database. What if I selected all the photo_ids
for a particular user and put them in an array and also counted them (the total).
Then the array would have photo_id[0], photo_id[1] etc. When the page is
displayed, I could somehow find out which number of the array the current
photo is and make it +1 to get the number of the order starting with 1. Then
for the Next page, it would display the photo_id[] +1. That was hard to explain
I hope it made sense.

Do you think this would work? If so, how do I loop through the photo_id column
and put them into an array? Thanks for the help.
Jeff Oien

> I don't know of a way to do the insert in a single query (anyone?!?) with
> this... but
>
> assuming the fields in pic are
> id int PRI
> location varchar(30)
> picnumber int
> user varchar(20)
>
> $query = "Select max(picnumber) from pics where user=\"$user\"";
> $dbq = mysql_query($query,$dblink) or die("D'OH!");
>
> $picnum = mysql_result($dbq,0) + 1;
>
> $query = "Insert into pics values (\"\",\"$fileloc\",$picnum,\"$user\");
> $dbq = mysql_query($query,$dblink) or die("Great Googley Moogley!");
>
> Should get the new pic at the top (or bottom depending on how you look at
> it)
> of the order.
>
> Now if someone tells your program to delete the pic, I would call a function
> which
> would unlink the file then do
>
> //$id should be passed to function DeletePic()
> $query = "Select picnumber from pics where id = $id";
> $dbq = mysql_query($query,$dblink) or die("Looks like I picked the wrong day
> to quit smoking!");
>
> $number = mysql_result($dbq,0);
>
> $query = "Update pics set picnumber=picnumber-1 where user=\"$user\" and
> picnumber > $number";
> $dbq = mysql_query($query,$dblink) or die("Looks like I picked the wrong day
> to quit smoking!");
>
> $query = "Delete from pics where id=$id";
> $dbq = mysql_query($query,$dblink) or die("Looks like I picked the wrong day
> to start coding!");
>
> Get the idea?  Then if they wanted to rearrange the pics, you could just
> swap the picnumbers of the
> two pics they want to swap... or do something similar to the update line
> above.
>
> Sheridan Saint-Michel
> Website Administrator
> FoxJet, an ITW Company
> www.foxjet.com
>
>
> - Original Message -
> From: "Jeff Oien" <[EMAIL PROTECTED]>
> To: "PHP-DB" <[EMAIL PROTECTED]>
> Sent: Friday, August 31, 2001 1:38 PM
> Subject: RE: [PHP-DB] Previous | Next (Again)
>
>
> > Sorry but I'm just not getting this. I'm not sure how to get the order
> > of the pics in the first place or what do with the picnumber
> > column. If someone deletes a pic wouldn't the picnumbers higher than
> > it also need to be changed? I'm understanding everything else, even
> > the password stuff but this I'm just clueless.
> > Jeff Oien
> >
> > > I would add the field "picnumber int" or something to your DB.
> > > This is where the pic falls in the order of pics in the album.
> > >
> > > The the previous and next should be as simple as doing
> > > select picnumber,piclocation from album where user=$user and
> > > (picnumber=$number-1 or picnumber=$number+1);
> > >
> > > Then just check numrows.  If two make both prev and next links,
> > > if one make prev link if $return[0] < $number else make next link.
> > >
> > > If none, no links.
> > >
> > > This way, if the person wants to change the order of their pictures
> > > it is quite easy to write a function that allows them to swap the place
> > > of two pics.
> > >
> > > Make sense?
> > >
> > > Sheridan Saint-Michel
> > > Website Administrator
> > > FoxJet, an ITW Company
> > > www.foxjet.com
> > >
> > >
> > > - Original Message -
> > > From: "Jeff Oien" <[EMAIL PROTECTED]>
> > > To: "PHP-DB" <[EMAIL PROTECTED]>
> > > Sent: Thursday, August 30, 2001 8:18 PM
> > > Subject: [PHP-DB] Previous | Next (Again)
> > >
> > >
> > > > I'm having a hard time figu

RE: [PHP-DB] Previous | Next (Again)

2001-08-31 Thread Jeff Oien

Sorry but I'm just not getting this. I'm not sure how to get the order
of the pics in the first place or what do with the picnumber
column. If someone deletes a pic wouldn't the picnumbers higher than
it also need to be changed? I'm understanding everything else, even
the password stuff but this I'm just clueless.
Jeff Oien

> I would add the field "picnumber int" or something to your DB.
> This is where the pic falls in the order of pics in the album.
> 
> The the previous and next should be as simple as doing
> select picnumber,piclocation from album where user=$user and
> (picnumber=$number-1 or picnumber=$number+1);
> 
> Then just check numrows.  If two make both prev and next links,
> if one make prev link if $return[0] < $number else make next link.
> 
> If none, no links.
> 
> This way, if the person wants to change the order of their pictures
> it is quite easy to write a function that allows them to swap the place
> of two pics.
> 
> Make sense?
> 
> Sheridan Saint-Michel
> Website Administrator
> FoxJet, an ITW Company
> www.foxjet.com
> 
> 
> - Original Message -
> From: "Jeff Oien" <[EMAIL PROTECTED]>
> To: "PHP-DB" <[EMAIL PROTECTED]>
> Sent: Thursday, August 30, 2001 8:18 PM
> Subject: [PHP-DB] Previous | Next (Again)
> 
> 
> > I'm having a hard time figuring this out. I have a photo album that
> displays
> > one image at a time. I want to have Previous and Next links for images in
> > a users album. This was suggested:
> > http://www.phpbuilder.com/columns/rod2221.php3
> > but it seems to be more for a number of results instead of one.
> >
> > At first I used the id field which is auto_increment and did -1 for
> > previous +1 for next but then realized if they delete an image in
> > the album the id field is no longer successive by 1. I can count
> > the number of images in an album but not sure how to know which
> > is the first, which is the second etc. and know which the current
> > one is if the id field has gaps in it. Not sure if that made any sense.
> > Jeff Oien
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] Password Question

2001-08-31 Thread Jeff Oien

I like the new password idea. How do I make sure it's them who's creating
a new password so that someone else doesn't maliciously change their
password? If someone knew someone's username and e-mail address
I would think they could change it. Thanks.
Jeff

> This doesn't seem to solve his problem of encryption, however. If you really
> want secure encryption, you'll be using one-way encryption, which means it
> cannot be decoded/decrypted/unencrypted/whatever. If you want to use this
> method, then instead of sending them their password, it would be best to
> create a NEW password, send it via e-mail, then encrypt and store the new
> password in the database, overwriting the old one.
> 
> If you only want mild security on the passwords, you can always use some
> encode() and decode()  like base64 encoding/decoding. It's not really
> "security" but it might discourage some script kiddies or hacker wannabes.
> Or you can be a little more creative and create your own password
> encryption/decryption, which would be a bit harder to break, depending on
> the level of complexity of the algorithm.
> 
> - Jonathan
> 
> 
> "Russ Michell" <[EMAIL PROTECTED]> wrote in message
> news:SIMEON.10108311759.J@k1c. anglia.ac.uk...
> > Have a registration screen that inserts their names, email etc *and* their
> choice of username +
> > password:
> >
> > $sql = "INSERT INTO  (username,realname,password,email) VALUES
> > ('$username',$realname',password('$password'),'$email')";
> > $result = mysql_query($sql,$connect);
> >
> > //and do a check if the username chosen exists already:
> >
> > $chksql = "SELECT username FROM  WHERE username='$username'";
> > $chkresult = mysql_query($chksql,$connect);
> > $check = mysql_num_rows($chkresult);
> > if ($check == 0)
> > echo "this username already exists, select another.";
> > }
> > else {
> > echo "continue!";
> > }
> >
> > if they have fogotton their password after registering, then have a link
> that sets a variable, and
> > check or this variable at the top of the page:
> >
> > go here to retrieve lost
> password
> >
> > if '$id' is set then have the user input their password and email address
> (the one they registered
> > with) and query the database for a username on the basis of the inputted
> info, and email it using
> > mail() to that email address!
> >
> > Use the same method for a lost username, they can then input their
> password and email and the
> > system will mail them the lost details!
> >
> > Good luck!
> > Russ
> >
> > On Fri, 31 Aug 2001 10:38:53 -0500 Jeff Oien <[EMAIL PROTECTED]> wrote:
> >
> > > I would like users to be able to request to have their password
> > > sent to their email address if they forget it. I would also like it
> > > encrypted in the database though. How is this best handled?
> > >
> > > The security isn't real important. But I let users choose their
> > > own password and if they use a password they use for other
> > > things I think it would be best for it to be encrypted.
> > > Jeff Oien
> > >
> > > --
> > > PHP Database Mailing List (http://www.php.net/)
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> > >
> >
> > #---#
> >
> >   "Believe nothing - consider everything"
> >
> >   Russ Michell
> >   Anglia Polytechnic University Webteam
> >   Room 1C 'The Eastings' East Road, Cambridge
> >
> >   e: [EMAIL PROTECTED]
> >   w: www.apu.ac.uk/webteam
> >   t: +44 (0)1223 363271 x 2331
> >
> >   www.theruss.com
> >
> > #---#
> >
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Password Question

2001-08-31 Thread Jeff Oien

I would like users to be able to request to have their password
sent to their email address if they forget it. I would also like it
encrypted in the database though. How is this best handled?

The security isn't real important. But I let users choose their
own password and if they use a password they use for other
things I think it would be best for it to be encrypted.
Jeff Oien

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Previous | Next (Again)

2001-08-30 Thread Jeff Oien

I'm having a hard time figuring this out. I have a photo album that displays
one image at a time. I want to have Previous and Next links for images in
a users album. This was suggested:
http://www.phpbuilder.com/columns/rod2221.php3
but it seems to be more for a number of results instead of one.

At first I used the id field which is auto_increment and did -1 for
previous +1 for next but then realized if they delete an image in
the album the id field is no longer successive by 1. I can count
the number of images in an album but not sure how to know which
is the first, which is the second etc. and know which the current
one is if the id field has gaps in it. Not sure if that made any sense.
Jeff Oien

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Date_Format Question

2001-08-30 Thread Jeff Oien

Thanks for the help Christopher and boclair. I think my problem was
putting single quotes around the field name within the parenthesis:
select date_format('creation_date', '%b %D, %Y') from Chart_Users;

This works:
select date_format(creation_date, '%M %D, %Y') from Chart_Users;
or
select date_format(creation_date, '%M %D, %Y') as creation from Chart_Users;
Jeff Oien

> Jeff,
> 
> mysql> select now();
> +-+
> | now()   |
> +-+
> | 2001-08-29 21:21:50 |
> +-+
> 1 row in set (0.00 sec)
> 
> mysql> SELECT DATE_FORMAT(NOW(), '%b %D, %Y') AS 'Formatted Current Time';
> ++
> | Formatted Current Time |
> ++
> | Aug 29th, 2001 |
> ++
> 1 row in set (0.00 sec)
> 
> mysql> SELECT DATE_FORMAT(NOW(), '%M %d, %Y') 'Formatted Current Time';
> ++
> | Formatted Current Time |
> ++
> | August 29, 2001|
> ++
> 1 row in set (0.00 sec)
> 
> OR. [this ex: assumes you have the connection string established]
> 
> $strSQL = "SELECT DATE_FORMAT(NOW(), '%M %d, %Y') 'Formatted Current Time'";
> $results = mysql_query($strSQL, $db) or die("Cannot execute $strSQL");
> 
> list($formattedDate) = mysql_fetch_array($results);
> 
> and you're done!
> 
> HTH,
> 
> Christopher Oson
> 
> -Original Message-
> From: Jeff Oien [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 29, 2001 8:29 PM
> To: PHP-DB
> Subject: RE: [PHP-DB] Date_Format Question
> 
> 
> Isn't that what I tried?
> Jeff Oien
> 
> > Although it might be better to format the date in php, don't forget you
> can
> > also do date formating in the select string.  The date format functions
> for
> > mySQL can me found here:
> >
> > http://www.mysql.com/doc/D/a/Date_and_time_functions.html
> >
> > Hope this helps,
> >
> >
> >
> > -Original Message-
> > From: Jeff Oien [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, August 29, 2001 8:07 PM
> > To: PHP-DB
> > Subject: [PHP-DB] Date_Format Question
> >
> >
> > I have a date like this in date format in MySQL
> > 2001-08-29
> >
> > and I want it to say
> > August 29, 2001
> >
> > I tried this and it didn't work.
> > select date_format('creation_date', '%b %D, %Y') from Chart_Users;
> >
> > Could you tell me what I'm doing wrong or how I should do this? Thanks.
> > Jeff Oien
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> >
> 
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] Date_Format Question

2001-08-29 Thread Jeff Oien

Isn't that what I tried?
Jeff Oien

> Although it might be better to format the date in php, don't forget you can
> also do date formating in the select string.  The date format functions for
> mySQL can me found here:
> 
> http://www.mysql.com/doc/D/a/Date_and_time_functions.html
> 
> Hope this helps,
> 
> 
> 
> -Original Message-
> From: Jeff Oien [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 29, 2001 8:07 PM
> To: PHP-DB
> Subject: [PHP-DB] Date_Format Question
> 
> 
> I have a date like this in date format in MySQL
> 2001-08-29
> 
> and I want it to say
> August 29, 2001
> 
> I tried this and it didn't work.
> select date_format('creation_date', '%b %D, %Y') from Chart_Users;
> 
> Could you tell me what I'm doing wrong or how I should do this? Thanks.
> Jeff Oien
> 
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Date_Format Question

2001-08-29 Thread Jeff Oien

I have a date like this in date format in MySQL
2001-08-29

and I want it to say
August 29, 2001

I tried this and it didn't work. 
select date_format('creation_date', '%b %D, %Y') from Chart_Users;

Could you tell me what I'm doing wrong or how I should do this? Thanks.
Jeff Oien

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] Photo Album Schema

2001-08-21 Thread Jeff Oien

I should have said photo_filename. That was what I intended to do.
Would you suggest one directory for all photos or separate directories
for each user? 
Jeff Oien

> Rick: I don't see any .php tags there... plus just because someone
> else has done it doesn't mean he can't do it as well  =)
> 
> Jeff: The only critique I would give from the description you have
> given us thus far is the fact that you appear to be storing the photo 
> in the DB.
> 
> The biggest bottleneck in a server-side script is usually the DB calls.
> With this in mind, you want to limit these calls as much as possible.
> 
> I would suggest setting up a naming and/or directory scheme to store
> the pictures on the website, and then store the URL of the picture in the
> DB, rather than the image itself.
> 
> Then when outputing the page just do something like
> 
> echo "";
> 
> Sheridan Saint-Michel
> Website Administrator
> FoxJet, an ITW Company
> www.foxjet.com
> 
> - Original Message - 
> From: "Rick Emery" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>; "PHP-DB" <[EMAIL PROTECTED]>
> Sent: Tuesday, August 21, 2001 10:19 AM
> Subject: RE: [PHP-DB] Photo Album Schema
> 
> 
> > This has been done.  see http://www.photopoint.com
> > 
> > This is a free service available to the public.
> > 
> > rick
> > 
> > Richard Emery
> > Excel Communications, Inc.
> > IT Sr. Project Manager
> > (972) 478-3398
> > (972) 944-0542 (pager)
> > 
> > There is no "trying"...
> > There is only "Do" or "Not Do"
> > 
> > 
> > 
> > -Original Message-
> > From: Jeff Oien [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, August 21, 2001 10:12 AM
> > To: PHP-DB
> > Subject: [PHP-DB] Photo Album Schema
> > 
> > 
> > I want to make a photo album that will have users who sign up
> > to create an album and then have the albums open to the public.
> > I was thinking of doing it like this but I've never done a relational
> > database before so if anyone thinks of anything I should change
> > please let me know. Thanks.
> > Jeff Oien
> > 
> > Table1:
> > -username
> > -password
> > -album_title
> > -creation_date
> > -id
> > 
> > Table2:
> > -id (from Table1)
> > -photo (jpg or gif)
> > -date
> > -photo_title
> > -description (limited length)
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] Photo Album Schema

2001-08-21 Thread Jeff Oien

Thanks for the suggestion but this is a personal project to be used
for learning and as a place for friends to post photos with only the features
that we all want.
Jeff Oien

> This has been done.  see http://www.photopoint.com
> 
> This is a free service available to the public.
> 
> rick
> 
> Richard Emery
> Excel Communications, Inc.
> IT Sr. Project Manager
> (972) 478-3398
> (972) 944-0542 (pager)
> 
> There is no "trying"...
> There is only "Do" or "Not Do"
> 
> 
> 
> -Original Message-
> From: Jeff Oien [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, August 21, 2001 10:12 AM
> To: PHP-DB
> Subject: [PHP-DB] Photo Album Schema
> 
> 
> I want to make a photo album that will have users who sign up
> to create an album and then have the albums open to the public.
> I was thinking of doing it like this but I've never done a relational
> database before so if anyone thinks of anything I should change
> please let me know. Thanks.
> Jeff Oien
> 
> Table1:
> -username
> -password
> -album_title
> -creation_date
> -id
> 
> Table2:
> -id (from Table1)
> -photo (jpg or gif)
> -date
> -photo_title
> -description (limited length)
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Photo Album Schema

2001-08-21 Thread Jeff Oien

I want to make a photo album that will have users who sign up
to create an album and then have the albums open to the public.
I was thinking of doing it like this but I've never done a relational
database before so if anyone thinks of anything I should change
please let me know. Thanks.
Jeff Oien

Table1:
-username
-password
-album_title
-creation_date
-id

Table2:
-id (from Table1)
-photo (jpg or gif)
-date
-photo_title
-description (limited length)

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] Re: Query and Date problem

2001-08-15 Thread Jeff Oien

> "Jeff Oien" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > I want to retrieve the last 15 days of data from a certain time but
> > not today's. I have this but it's still giving me today's data:
> >
> > $today = date("Y-m-d");
> > $sql = "SELECT volume, date, time, id
> > FROM $table_name
> > where time = $time1 and date != $today ORDER by id desc LIMIT 15";
> >
> > (date != $today) code in question
> >
> > When I print $today it's: 2001-08-15 and the date field in the database
> > is also displaying as 2001-08-15. Any suggestions? Thanks in advance.
> > Jeff Oien
> 
> ... I would not depend on id being monotonic
> (it probably will be, but I would still not
> depend on it).
> 
> How 'bout
> 
> SELECT volume,date,time,id
> FROM $table
> WHERE time=$time1
> ORDER BY date DESC
> LIMIT 1,15
> 
> What are you storing time as - a timestamp
> rounded down to the last half-hour?

That works also, thanks. The cron job runs on the half hour so the
timestamp is always HH00 or HH30. I check to see what time it is
now and then finds the data from the same half hour time period for
the last 15 days.
Jeff Oien 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] Query and Date problem

2001-08-15 Thread Jeff Oien

That did it. Anybody know why?
Jeff Oien

> Not sure if this will make a difference, but try putting single quotes
> around $today:
> date != '$today'
> 
> - Jonathan
> 
> 
> -Original Message-
> From: Jeff Oien [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 15, 2001 10:18 AM
> To: PHP-DB
> Subject: [PHP-DB] Query and Date problem
> 
> 
> I want to retrieve the last 15 days of data from a certain time but 
> not today's. I have this but it's still giving me today's data:
> 
> $today = date("Y-m-d");
> $sql = "SELECT volume, date, time, id 
> FROM $table_name 
> where time = $time1 and date != $today ORDER by id desc LIMIT 15";
> 
> (date != $today) code in question
> 
> When I print $today it's: 2001-08-15 and the date field in the database
> is also displaying as 2001-08-15. Any suggestions? Thanks in advance.
> Jeff Oien
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Query and Date problem

2001-08-15 Thread Jeff Oien

I want to retrieve the last 15 days of data from a certain time but 
not today's. I have this but it's still giving me today's data:

$today = date("Y-m-d");
$sql = "SELECT volume, date, time, id 
FROM $table_name 
where time = $time1 and date != $today ORDER by id desc LIMIT 15";

(date != $today) code in question

When I print $today it's: 2001-08-15 and the date field in the database
is also displaying as 2001-08-15. Any suggestions? Thanks in advance.
Jeff Oien

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] Averaging Numbers

2001-08-15 Thread Jeff Oien

That's exactly what I needed. Thanks. I'm absolutely awful with math
and this is my first time averaging numbers from a database. 
Jeff Oien
 
> Maybe I am missing the complexity but I would just add them all up as 
> you retrieve them (or where you are printing them out) and then when you 
> finish the loop divide the total by the number of of number you are 
> averaging over have (i.e this would be 15 if you are taking 15 days).
> 
> something like:
> 
> $sum = 0;
> for  i=0 to i=15
> {
> $valueRetrieved = retrieve result of row i
> $sum += $valueRetrieved
> }
> $average = $sum/15
> 
> hope this helps
> andre
> 
> Jeff Oien wrote:
> 
> >I'm having a hard time learning how to get an average. I have a database
> >that gets a number and inserts in into a MySQL database every 1/2 hour
> >during the day. For the current half hour, I want to get the last 15 days
> >numbers for the same time as the time it is now. I can retrieve and display
> >the numbers fine, I just don't know how to go about putting these all into
> >variables or an array or if I can do this within a query and then take an 
> >average for them. Hope that made sense. Thanks.
> >Jeff Oien
> >
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] Averaging Numbers

2001-08-15 Thread Jeff Oien

> I'm real sorry to say I don't know the answer to your question unless 
> there's a php function to get an average (or write one yourself) but 
> you say you've managed to get a script/process to run in conjunction 
> with your database every half an hour...how do you do this!? I've been 
> wanting something like this for months.
> 
> Cheers (and apologies!)
> Russ

I have a cron job that runs on a Unix server that runs a PHP file that
gets a number from a Web site and inserts it into the database.
Jeff Oien

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Averaging Numbers

2001-08-15 Thread Jeff Oien

I'm having a hard time learning how to get an average. I have a database
that gets a number and inserts in into a MySQL database every 1/2 hour
during the day. For the current half hour, I want to get the last 15 days
numbers for the same time as the time it is now. I can retrieve and display
the numbers fine, I just don't know how to go about putting these all into
variables or an array or if I can do this within a query and then take an 
average for them. Hope that made sense. Thanks.
Jeff Oien

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Inserting NULL?

2001-08-03 Thread Jeff Oien

I have a variable that is either Yes or No. I would like
NULL to be inserted if it's No. Can I do this?

if ($variable == 'No') {
$variable = 'NULL';
}

then INSERT it.

Thanks.
Jeff Oien

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Limit Select Field Characters?

2001-08-01 Thread Jeff Oien

I have a timestamp field that looks like this
0109011754
but I only want to compare
010801
when doing a SELECT. Is there a way I can do this? Thanks.
Jeff Oien


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] MySQL Timestamp

2001-07-18 Thread Jeff Oien

Thanks. I was using MySQL by DuBois book as a reference.
Jeff
 
> According to the manual, 12 is YYMMDDHHMMSS and 14 is MMDDHHMMSS.
> 
> http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html#DATETIME
> 
> 
> "Jeff Oien" <[EMAIL PROTECTED]> wrote:
> I have a field that's timestamp(12) which should be MMDDhhmm
> but what I'm getting is
> 010718125000
> 
> what I was expecting was
> 200107181250
> 
> How can I get what I was expecting? Thanks.
> Jeff Oien
> 
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] MySQL Timestamp

2001-07-18 Thread Jeff Oien

I have a field that's timestamp(12) which should be MMDDhhmm
but what I'm getting is
010718125000

what I was expecting was
200107181250

How can I get what I was expecting? Thanks.
Jeff Oien

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Only Insert on Error?

2001-07-18 Thread Jeff Oien

I can't figure this out. The first code works as far as inserting into a
MySQL database with the !result error checking. The second with the
error code commented out doesn't. I can't figure out why.
Jeff Oien

if ($M_First_Name) {
$sql = "INSERT INTO $table_name
(First_Name, Last_Name, Family_Position, Address, Address1, City, State, Zip, Email,
Home_Phone, Work_Phone, Coop_Month, Timestamp) VALUES
(\"$M_First_Name\", \"$M_Last_Name\", \"$MatherFamilyPosition\", \"$M_Address1\",
\"$M_Address2\", \"$M_City\", \"$M_State\", \"$M_Zip\", \"$M_Email\", \"$M_H_Phone\",
\"$M_W_Phone\", \"$coopmonth\", \"NOW()\")";
if(! $result = mysql_query($sql,$connection)) {
print("ERROR ".mysql_errno().": ".mysql_error()."\n$sql\n");
}
}



if ($M_First_Name) {
$sql = "INSERT INTO $table_name
(First_Name, Last_Name, Family_Position, Address, Address1, City, State, Zip, Email,
Home_Phone, Work_Phone, Coop_Month, Timestamp) VALUES
(\"$M_First_Name\", \"$M_Last_Name\", \"$MatherFamilyPosition\", \"$M_Address1\",
\"$M_Address2\", \"$M_City\", \"$M_State\", \"$M_Zip\", \"$M_Email\", \"$M_H_Phone\",
\"$M_W_Phone\", \"$coopmonth\", \"NOW()\")";
//  if(! $result = mysql_query($sql,$connection)) {
//  print("ERROR ".mysql_errno().": ".mysql_error()."\n$sql\n");
//  }
}


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] Inserting Variable Variable?

2001-07-18 Thread Jeff Oien

I found a solution but not sure if it's the most efficient.

I need to first define a simpler variable:

$C_First_Name  = "${"C_First_Name".$x}";

then INSERT VALUE $C_First_Name.
Jeff Oien

> Hi Jeff.
>
> $varname  = "C_First_Name".$x;
>
> // e.g. if $x == 3 then ...
> echo $$varname; // ... prints the content of $C_First_Name3
>
> Hope this is what you wanted ?!
>
> Greetinx,
>   Mike
>
> Michael Rudel
> - Web-Development, Systemadministration -
>
> Besuchen Sie uns am 20. und 21. August 2001 auf der
> online-marketing-düsseldorf in Halle 1 Stand E 16
> ___
>
> Suchtreffer AG
> Bleicherstraße 20
> D-78467 Konstanz
> Germany
> fon: +49-(0)7531-89207-17
> fax: +49-(0)7531-89207-13
> e-mail: mailto:[EMAIL PROTECTED]
> internet: http://www.suchtreffer.de
> ___
>
> > -Original Message-
> > From: Jeff Oien [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, July 18, 2001 4:24 PM
> > To: PHP-DB
> > Subject: [PHP-DB] Inserting Variable Variable?
> >
> >
> > I want to INSERT a variable like this using MySQL. If I use this
> >
> > \"(${"C_First_Name"}.$x)\",
> > or
> > \"(${C_First_Name}.$x)\",
> > or
> > \"${C_First_Name}.$x\",
> >
> > only the $x gets interpolated in the insertion. If I use
> >
> > \"${"C_First_Name$x"}\",
> >
> > only $C_First_Name get interpolated. Any solutions? Thanks.
> > Jeff Oien
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail:
> > [EMAIL PROTECTED]
> >
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] Inserting Variable Variable?

2001-07-18 Thread Jeff Oien

Hi, I'm not quite getting it. If $x is 1 here is what happens.

$varname  = "C_First_Name".$x;
echo $$varname;

then $$varname prints as $C_First_Name1. However $C_First_Name1
prints the contents of the variable.
Jeff Oien

> Hi Jeff.
> 
> $varname  = "C_First_Name".$x;
> 
> // e.g. if $x == 3 then ...
> echo $$varname; // ... prints the content of $C_First_Name3
> 
> Hope this is what you wanted ?!
> 
> Greetinx,
>   Mike
> 
> Michael Rudel
> - Web-Development, Systemadministration -

> >
> > I want to INSERT a variable like this using MySQL. If I use this
> >
> > \"(${"C_First_Name"}.$x)\",
> > or
> > \"(${C_First_Name}.$x)\",
> > or
> > \"${C_First_Name}.$x\",
> >
> > only the $x gets interpolated in the insertion. If I use
> >
> > \"${"C_First_Name$x"}\",
> >
> > only $C_First_Name get interpolated. Any solutions? Thanks.
> > Jeff Oien
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail:
> > [EMAIL PROTECTED]
> >
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Inserting Variable Variable?

2001-07-18 Thread Jeff Oien

I want to INSERT a variable like this using MySQL. If I use this 

\"(${"C_First_Name"}.$x)\",
or
\"(${C_First_Name}.$x)\",
or 
\"${C_First_Name}.$x\",

only the $x gets interpolated in the insertion. If I use

\"${"C_First_Name$x"}\",

only $C_First_Name get interpolated. Any solutions? Thanks.
Jeff Oien

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Alternating Values

2001-07-09 Thread Jeff Oien

I'm trying to figure out the best way to do this.

People will be signing up online and their info will be put into
a database. They will be assigned a room and each successive
person will be assigned a different room. There are different categories
for each group of people also. So there will be:

Group1
-Rm101
-Rm102
-Rm103

Group2
-Rm300
-Rm301

etc. 

They need to have an equal amount of people in each room so
the first person in Group1 would Rm101, next person Rm102 etc.

Would it be best to retrieve the last person from the Group, find
out what room number they have, then if last in Group1 is Rm101, 
this person be assigned Rm102 with that equation being in the PHP
script? If that's the case would I retrieve all the records for Group1 and
find the largest ID (auto_increment type)? Thanks.
Jeff Oien

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] MySQL Connect Problem

2001-05-18 Thread Jeff Oien

I found a "solution." I uninstalled (and deleted the ini file) MySQL 
v. 3.23.36 and installed v. 3.23.38 and now it works. I have no
idea why. But I learned some things in the process. Thank you 
very much for all the help.
Jeff Oien

> Where you have your variable set to "password" just put "" that means there
> is no password other whys your saying your password is password
> ""Jeff Oien"" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > I tried your code and got this:
> >
> > Warning: Can't connect to MySQL server on 'localhost'
> >
> > Also tried ip address of my machine. So at least maybe that narrows
> > down the problem.
> > Jeff Oien
> >
> > > Hi Jeff,
> > > I am using Windows, but am a beginner.  Here is some code I use maybe it
> > > will help
> > >
> > > I use this in my navigation pages:
> > >
> > > 
> > >
> > >  > >
> > > mysql_pconnect("$host","$user","$password")
> > > or die("Unable to connect to SQL server");
> > > mysql_select_db("$dbasename") or die("Unable to select database");
> > > ?>
> > >
> > > and here is db_details.php
> > >
> > >  > > $host="host.name.com";
> > > $user="user_id";
> > > $password="password";
> > > $dbasename="database_name";
> > > ?>
> > > By using the include it means if I go LIVE with a site I only have to
> change
> > > one file db_details.php
> > > The reason I don't do it all in one is that it didn't like "." in IP
> > > addresses for some reason ( I think it thought it was the beginning of a
> > > string)
> > > On my windows machine my db_details would look like this
> > >  > > $host="localhost";
> > > $user="";
> > > $password="";
> > > $dbasename="database_name";
> > > ?>
> > > You shouldn't need a password.
> > > I hope this helps
> > > All the Best
> > > Lisa
> > >
> > > -Original Message-
> > > From: Jeff Oien [mailto:[EMAIL PROTECTED]]
> > > Sent: Thursday, May 17, 2001 2:16 PM
> > > To: PHP-DB
> > > Subject: RE: [PHP-DB] MySQL Connect Problem
> > >
> > >
> > > I'm on Windows 2000.
> > > Jeff
> > >
> > > > Jeff,
> > > >
> > > > If you are on unix/linux use the command id to see who you are.
> > > > You can only use jeff in your connect string if jeff is a user in your
> > > mysql
> > > > database.
> > > >
> > > > If you are root when you are running mysql then you should probably
> set a
> > > > password for root in the database.
> > > >
> > > > Wayne
> > > >
> > > >
> > > > On Thu, 17 May 2001 13:20, Jeff Oien wrote:
> > > > > > > Here is sample code:
> > > > > > >  > > > > > > $connection = @mysql_connect("localhost", "jeff", "*")
> > > > > > > or die("Couldn't connect.");
> > > > > > > if ($connection) {
> > > > > > > $msg = "success!";
> > > > > > > }
> > > > > > > ?>
> > > > > > >
> > > > > > > This is on my machine only used by me. I also tried connecting
> to
> > > > > > > IP address and 127.0.0.1 and it still won't work. Thanks.
> > > > > > > Jeff Oien
> > > > > >
> > > > > > Are your the 'root' rather than 'jeff'?  Did you alter the grants
> and
> > > > > > apply the password? If not do you need  a password for connection?
> > > > > >
> > > > > > Tim Morris
> > > > >
> > > > > To be honest I don't know if I am root. I know I don't need a
> password
> > > > > to connect via the command line. I just type 'mysql'. I do have
> username
> > > > > and password specified in the .ini file which I believe I set when I
> > > first
> > > > > installed it. What can I do from here?
> > > > > Jeff Oien
> > > >
> > > > --
>

RE: [PHP-DB] MySQL Connect Problem

2001-05-17 Thread Jeff Oien

I tried your code and got this:

Warning: Can't connect to MySQL server on 'localhost'

Also tried ip address of my machine. So at least maybe that narrows
down the problem. 
Jeff Oien

> Hi Jeff,
> I am using Windows, but am a beginner.  Here is some code I use maybe it
> will help
> 
> I use this in my navigation pages:
> 
> 
> 
>  
> mysql_pconnect("$host","$user","$password")
> or die("Unable to connect to SQL server");
> mysql_select_db("$dbasename") or die("Unable to select database");
> ?>
> 
> and here is db_details.php
> 
>  $host="host.name.com";
> $user="user_id";
> $password="password";
> $dbasename="database_name";
> ?>
> By using the include it means if I go LIVE with a site I only have to change
> one file db_details.php
> The reason I don't do it all in one is that it didn't like "." in IP
> addresses for some reason ( I think it thought it was the beginning of a
> string)
> On my windows machine my db_details would look like this
>  $host="localhost";
> $user="";
> $password="";
> $dbasename="database_name";
> ?>
> You shouldn't need a password.
> I hope this helps
> All the Best
> Lisa
> 
> -Original Message-
> From: Jeff Oien [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, May 17, 2001 2:16 PM
> To: PHP-DB
> Subject: RE: [PHP-DB] MySQL Connect Problem
> 
> 
> I'm on Windows 2000.
> Jeff
> 
> > Jeff,
> > 
> > If you are on unix/linux use the command id to see who you are.
> > You can only use jeff in your connect string if jeff is a user in your
> mysql 
> > database. 
> > 
> > If you are root when you are running mysql then you should probably set a 
> > password for root in the database.
> > 
> > Wayne
> > 
> > 
> > On Thu, 17 May 2001 13:20, Jeff Oien wrote:
> > > > > Here is sample code:
> > > > >  > > > > $connection = @mysql_connect("localhost", "jeff", "*")
> > > > > or die("Couldn't connect.");
> > > > > if ($connection) {
> > > > > $msg = "success!";
> > > > > }
> > > > > ?>
> > > > >
> > > > > This is on my machine only used by me. I also tried connecting to
> > > > > IP address and 127.0.0.1 and it still won't work. Thanks.
> > > > > Jeff Oien
> > > >
> > > > Are your the 'root' rather than 'jeff'?  Did you alter the grants and
> > > > apply the password? If not do you need  a password for connection?
> > > >
> > > > Tim Morris
> > >
> > > To be honest I don't know if I am root. I know I don't need a password
> > > to connect via the command line. I just type 'mysql'. I do have username
> > > and password specified in the .ini file which I believe I set when I
> first
> > > installed it. What can I do from here?
> > > Jeff Oien
> > 
> > -- 
> > Wayne Bastow - DBA - Central Coast Health Phone: 61 2 43203231
> > Email: wbastowATccahsDOThealthDOTnswDOTgovDOTau
> >  
> > Linux, the choice of a GNU generation Kernel 2.2.16-22 on a i686
> >  
> > Running Windows on a Pentium is like having a brand new Porsche but  only 
> > be able to drive backwards with the handbrake on. (Unknown source)
> > 
> > ==
> > This message is intended for the addressee named and may contain 
> > confidential information. If you are not the intended recipient, please 
> > delete it and notify the sender. Views expressed in this message are 
> > those of the individual sender, and are not necessarily the views of 
> > the NSW Department of Health.
> > ==
> > 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] MySQL Connect Problem

2001-05-17 Thread Jeff Oien

I'm on Windows 2000.
Jeff

> Jeff,
> 
> If you are on unix/linux use the command id to see who you are.
> You can only use jeff in your connect string if jeff is a user in your mysql 
> database. 
> 
> If you are root when you are running mysql then you should probably set a 
> password for root in the database.
> 
> Wayne
> 
> 
> On Thu, 17 May 2001 13:20, Jeff Oien wrote:
> > > > Here is sample code:
> > > >  > > > $connection = @mysql_connect("localhost", "jeff", "*")
> > > > or die("Couldn't connect.");
> > > > if ($connection) {
> > > > $msg = "success!";
> > > > }
> > > > ?>
> > > >
> > > > This is on my machine only used by me. I also tried connecting to
> > > > IP address and 127.0.0.1 and it still won't work. Thanks.
> > > > Jeff Oien
> > >
> > > Are your the 'root' rather than 'jeff'?  Did you alter the grants and
> > > apply the password? If not do you need  a password for connection?
> > >
> > > Tim Morris
> >
> > To be honest I don't know if I am root. I know I don't need a password
> > to connect via the command line. I just type 'mysql'. I do have username
> > and password specified in the .ini file which I believe I set when I first
> > installed it. What can I do from here?
> > Jeff Oien
> 
> -- 
> Wayne Bastow - DBA - Central Coast Health Phone: 61 2 43203231
> Email: wbastowATccahsDOThealthDOTnswDOTgovDOTau
>  
> Linux, the choice of a GNU generation Kernel 2.2.16-22 on a i686
>  
> Running Windows on a Pentium is like having a brand new Porsche but  only 
> be able to drive backwards with the handbrake on. (Unknown source)
> 
> ==
> This message is intended for the addressee named and may contain 
> confidential information. If you are not the intended recipient, please 
> delete it and notify the sender. Views expressed in this message are 
> those of the individual sender, and are not necessarily the views of 
> the NSW Department of Health.
> ==
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] MySQL Connect Problem

2001-05-16 Thread Jeff Oien

> > Here is sample code:
> >  > $connection = @mysql_connect("localhost", "jeff", "*")
> > or die("Couldn't connect.");
> > if ($connection) {
> > $msg = "success!";
> > }
> > ?>
> >
> > This is on my machine only used by me. I also tried connecting to
> > IP address and 127.0.0.1 and it still won't work. Thanks.
> > Jeff Oien
> 
> Are your the 'root' rather than 'jeff'?  Did you alter the grants and
> apply the password? If not do you need  a password for connection?
> 
> Tim Morris

To be honest I don't know if I am root. I know I don't need a password
to connect via the command line. I just type 'mysql'. I do have username 
and password specified in the .ini file which I believe I set when I first 
installed it. What can I do from here?
Jeff Oien 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] MySQL Connect Problem

2001-05-16 Thread Jeff Oien

Yes it is running. I don't need to use a password when running from the
command line but I am when connecting through PHP. This is exactly
how I did it on my Win98 machine but it isn't working with W2k.
Jeff Oien

> Well the mysql tool doesn't need any authentication usually when you first
> set it up. Is the winmysqladmin tool running in your system tray? You should
> see a stop light with the green light lighted up.
> 
> Jonathan
> 
> Used Prompt in Win2k. Moved to the apache/mysql/bin directory
> and typed mysql. 
> Jeff Oien
> 
> > You said you could connect through the command-line. How did you do that?
> > 
> > Jonathan
> > 
> > Here is sample code:
> >  > $connection = @mysql_connect("localhost", "jeff", "*")
> > or die("Couldn't connect.");
> > if ($connection) {
> > $msg = "success!";
> > }
> > ?>
> > 
> > This is on my machine only used by me. I also tried connecting to 
> > IP address and 127.0.0.1 and it still won't work. Thanks.
> > Jeff Oien
> > 
> > > 1. Can you set up a simple connection for us to test out? Allow people
> > from
> > > any host (%) to connect. 
> > > 2. Try connecting to your own IP address or host name instead of
> > localhost.
> > > They SHOULD mean the same thing, but I've been able to connect to IP
> > > addresses and not localhost's before when dealing with Windows 2k and
> > mySQL.
> > > It's almost as if my install of mySQL had set up its own name of
> something
> > > else. Very weird, but its worth a shot.
> > > 
> > > -Original Message-
> > > From: Jeff Oien [mailto:[EMAIL PROTECTED]]
> > > Sent: Tuesday, May 15, 2001 8:24 PM
> > > To: PHP-DB
> > > Subject: RE: [PHP-DB] MySQL Connect Problem
> > > 
> > > 
> > > Yes they are.
> > > Jeff
> > > 
> > > > Is the MySQL and Apache running on the same machine?
> > > > 
> > > > Jeff Oien wrote:
> > > > 
> > > > > I have MySQL on a new Win2000 install and can't connect to it using
> > PHP.
> > > > > I am able to connect using the command line. I'm not sure what the
> > next
> > > > > step is to troubleshoot. I've checked the username and password in
> the
> > > > > .ini file using WinMySQLAdmin. I'm using Apache which is working
> fine
> > > > > otherwise. Typical code:
> > > > >
> > > > >  > > > > $connection = @mysql_connect("localhost", "jeff", "*")
> > > > > or die("Couldn't connect.");
> > > > > if ($connection) {
> > > > > $msg = "success!";
> > > > > }
> > > > > ?>
> > > > >
> > > > > Thanks.
> > > > > Jeff Oien
> > > > >
> > > > > --
> > > > > PHP Database Mailing List (http://www.php.net/)
> > > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > > > To contact the list administrators, e-mail:
> > [EMAIL PROTECTED]
> > > > 
> > > 
> > > -- 
> > > PHP Database Mailing List (http://www.php.net/)
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> > > 
> > 
> > -- 
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> > 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] MySQL Connect Problem

2001-05-16 Thread Jeff Oien

Used Prompt in Win2k. Moved to the apache/mysql/bin directory
and typed mysql. 
Jeff Oien

> You said you could connect through the command-line. How did you do that?
> 
> Jonathan
> 
> Here is sample code:
>  $connection = @mysql_connect("localhost", "jeff", "*")
>   or die("Couldn't connect.");
> if ($connection) {
>   $msg = "success!";
> }
> ?>
> 
> This is on my machine only used by me. I also tried connecting to 
> IP address and 127.0.0.1 and it still won't work. Thanks.
> Jeff Oien
> 
> > 1. Can you set up a simple connection for us to test out? Allow people
> from
> > any host (%) to connect. 
> > 2. Try connecting to your own IP address or host name instead of
> localhost.
> > They SHOULD mean the same thing, but I've been able to connect to IP
> > addresses and not localhost's before when dealing with Windows 2k and
> mySQL.
> > It's almost as if my install of mySQL had set up its own name of something
> > else. Very weird, but its worth a shot.
> > 
> > -Original Message-
> > From: Jeff Oien [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, May 15, 2001 8:24 PM
> > To: PHP-DB
> > Subject: RE: [PHP-DB] MySQL Connect Problem
> > 
> > 
> > Yes they are.
> > Jeff
> > 
> > > Is the MySQL and Apache running on the same machine?
> > > 
> > > Jeff Oien wrote:
> > > 
> > > > I have MySQL on a new Win2000 install and can't connect to it using
> PHP.
> > > > I am able to connect using the command line. I'm not sure what the
> next
> > > > step is to troubleshoot. I've checked the username and password in the
> > > > .ini file using WinMySQLAdmin. I'm using Apache which is working fine
> > > > otherwise. Typical code:
> > > >
> > > >  > > > $connection = @mysql_connect("localhost", "jeff", "*")
> > > > or die("Couldn't connect.");
> > > > if ($connection) {
> > > > $msg = "success!";
> > > > }
> > > > ?>
> > > >
> > > > Thanks.
> > > > Jeff Oien
> > > >
> > > > --
> > > > PHP Database Mailing List (http://www.php.net/)
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > > To contact the list administrators, e-mail:
> [EMAIL PROTECTED]
> > > 
> > 
> > -- 
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> > 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] MySQL Connect Problem

2001-05-16 Thread Jeff Oien

Here is sample code:


This is on my machine only used by me. I also tried connecting to 
IP address and 127.0.0.1 and it still won't work. Thanks.
Jeff Oien

> 1. Can you set up a simple connection for us to test out? Allow people from
> any host (%) to connect. 
> 2. Try connecting to your own IP address or host name instead of localhost.
> They SHOULD mean the same thing, but I've been able to connect to IP
> addresses and not localhost's before when dealing with Windows 2k and mySQL.
> It's almost as if my install of mySQL had set up its own name of something
> else. Very weird, but its worth a shot.
> 
> -Original Message-
> From: Jeff Oien [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, May 15, 2001 8:24 PM
> To: PHP-DB
> Subject: RE: [PHP-DB] MySQL Connect Problem
> 
> 
> Yes they are.
> Jeff
> 
> > Is the MySQL and Apache running on the same machine?
> > 
> > Jeff Oien wrote:
> > 
> > > I have MySQL on a new Win2000 install and can't connect to it using PHP.
> > > I am able to connect using the command line. I'm not sure what the next
> > > step is to troubleshoot. I've checked the username and password in the
> > > .ini file using WinMySQLAdmin. I'm using Apache which is working fine
> > > otherwise. Typical code:
> > >
> > >  > > $connection = @mysql_connect("localhost", "jeff", "*")
> > > or die("Couldn't connect.");
> > > if ($connection) {
> > > $msg = "success!";
> > > }
> > > ?>
> > >
> > > Thanks.
> > > Jeff Oien
> > >
> > > --
> > > PHP Database Mailing List (http://www.php.net/)
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> > 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] MySQL Connect Problem

2001-05-15 Thread Jeff Oien

Yes they are.
Jeff

> Is the MySQL and Apache running on the same machine?
> 
> Jeff Oien wrote:
> 
> > I have MySQL on a new Win2000 install and can't connect to it using PHP.
> > I am able to connect using the command line. I'm not sure what the next
> > step is to troubleshoot. I've checked the username and password in the
> > .ini file using WinMySQLAdmin. I'm using Apache which is working fine
> > otherwise. Typical code:
> >
> >  > $connection = @mysql_connect("localhost", "jeff", "*")
> > or die("Couldn't connect.");
> > if ($connection) {
> > $msg = "success!";
> > }
> > ?>
> >
> > Thanks.
> > Jeff Oien
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] MySQL Connect Problem

2001-05-15 Thread Jeff Oien

I have MySQL on a new Win2000 install and can't connect to it using PHP.
I am able to connect using the command line. I'm not sure what the next
step is to troubleshoot. I've checked the username and password in the
.ini file using WinMySQLAdmin. I'm using Apache which is working fine
otherwise. Typical code:



Thanks.
Jeff Oien


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Autoincrement Question

2001-05-10 Thread Jeff Oien

If I have a database that has three records and I delete the entire
third record, when another record is then added will the auto_increment
number be 3 or 4? Thanks.
Jeff Oien

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] INSERT Problem

2001-05-09 Thread Jeff Oien

That told me my problem. Thank you! I hadn't selected the database
in my connect include but had it in other scripts and not this one.
Long story but thanks for the help. I can stop banging my head now.
Jeff Oien

> on 5/9/01 12:29 PM, Jeff Oien at [EMAIL PROTECTED] wrote:
> 
> > Am I missing something?
> 
> yes. you aren't giving yourself any feedback about what happened when the
> insert failed.
> 
> instead of:
> 
> $sql = "INSERT INTO $table_name (First_Name, Last_Name)
> VALUES (\"Jeff\", \"Oien\")";
> $result = mysql_query($sql,$connection)  or die("Failed");
> 
> try:
> 
> $sql = "INSERT INTO $table_name (First_Name, Last_Name)
> VALUES (\"Jeff\", \"Oien\")";
> if(! $result = mysql_query($sql,$connection)) {
> 
> print("ERROR ".mysql_errno().": ".mysql_error()."\n$sql\n");
> 
> }
> 
> also- i don't see your code for mysql_connect(). make sure you have a valid
> connection to mysql.
> 
> 
> 
> have a great day
> andy
> 
> -- 
> ***
> Andrew Rush :: Lead Systems Developer :: MaineToday.com
> ***
> 
> "A friend of the devil is a friend of mine" - R. Hunter
> 
> 
> 
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] INSERT Problem

2001-05-09 Thread Jeff Oien

OK, did that and it's just printing the INSERT command back to me.

INSERT INTO OVEvents (First_Name, Last_Name) VALUES("Jeff", "Oien")

Any help from here? Thanks.
Jeff Oien

> 
> echo $sql;
> 
> 
> always helpful, then paste that into the command line client and check the
> error
> 
> 
> Cameron
> 
> Jeff Oien wrote:
> 
> > This is driving me nuts. I can't insert anything into a mysql database
> > using PHP. I can insert from the command line when logged in with Telnet.
> > Using PHP I can connect and retrieve data from the database, just can't
> > INSERT anything.
> >
> > This is what doesn't work:
> > $sql = "INSERT INTO $table_name (First_Name, Last_Name)
> > VALUES (\"Jeff\", \"Oien\")";
> > $result = mysql_query($sql,$connection)  or die("Failed");
> >
> > or
> >
> > $sql = "INSERT INTO $table_name (First_Name, Last_Name)
> > VALUES (\"$First_Name\", \"$Last_Name\")";
> > $result = mysql_query($sql,$connection)  or die("Failed");
> >
> > yet this will work from the command line:
> > INSERT INTO TheTable (First_Name, Last_Name)
> > VALUES ("Jeff", "Oien");
> >
> > Am I missing something? Thanks for any help.
> > Jeff Oien
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] INSERT Problem

2001-05-09 Thread Jeff Oien

This is driving me nuts. I can't insert anything into a mysql database
using PHP. I can insert from the command line when logged in with Telnet.
Using PHP I can connect and retrieve data from the database, just can't
INSERT anything.

This is what doesn't work:
$sql = "INSERT INTO $table_name (First_Name, Last_Name)
VALUES (\"Jeff\", \"Oien\")";
$result = mysql_query($sql,$connection)  or die("Failed");

or

$sql = "INSERT INTO $table_name (First_Name, Last_Name)
VALUES (\"$First_Name\", \"$Last_Name\")";
$result = mysql_query($sql,$connection)  or die("Failed");

yet this will work from the command line:
INSERT INTO TheTable (First_Name, Last_Name)
VALUES ("Jeff", "Oien");

Am I missing something? Thanks for any help.
Jeff Oien


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Encode/Decode Secure Enough?

2001-04-07 Thread Jeff Oien

Are encode and decode secure enough for storing credit
card numbers on a Web server?
Jeff Oien

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] PHP an MySQL

2001-04-01 Thread Jeff Oien

I would recommend the first two books listed on this page:
http://www.webdesigns1.com/php/books.php
I've read both.
Jeff Oien

> Can someone recommend a book that shows how to use PHP and MySQL.
> 
>  I need to see how to pass parms from a form to a PHP so I can Update, Add
> and Delete records.
> 
> Thanks for the help.
> 
> Jim Ray
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] HELP: Eporting data from mySQL with PHP

2001-03-30 Thread Jeff Oien

> Hello,
> 
> I'm trying to figure out how to get the data out of a table in a format 
> which I can easily import into excel. I wanted to have tab delimited fields 
> enclosed by quotes. I'm not sure how to do this? I check the mySQL doc and 
> saw the mysqldump call but haven't found any mention of it in the PHP doc.
> 
> Any thoughts? code snippets?
> 
> Thanks in Advance,
> 
> Mark Rosenberg
> Michigan State

First you need this header:

header("Content-Type: application/vnd.ms-excel");

Then here is a message I got a while ago from Pierre-Yves Lemaire:

Hello,

The header will make netscape offer you a download of the file, and
IE will open it in a excell format.

For the display, just put your result in a nice html table and excell will
convert
it, it's quite simple.

print "";
print "Event";
... print all your header here

while ($row = mysql_fetch_array($result)) {
print "\n";
print "". $row['Event'] ."\n";
and so on...

}


hope it help,
py

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] MySQL for Billng Question

2001-03-26 Thread Jeff Oien

I want to have a database for my hours for my clients.
I want to create a report where it shows only the hours
back to the last time I was paid. I have no idea how to
go about this. Any help would be appreciated.

Jeff Oien
PHP >start here
http://www.webdesigns1.com/php/

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]