Re: Looking for a mentor on php/mysql

2006-02-23 Thread Duane Whitty

Robert Uzzi wrote:

I am trying to teach my self php/mysql/html programming.
I have done native static html web sites before.
Running FreeBSD 6.0 with apache13, php, and mysql all installed and
working.

Have read a few php books and searched the web for code snippets.
Have been on some of the php forum sites, but responses are not forth
coming.

Looking for a mentor to guide me with puting all the pieces together.
I have a working panel for registering a user that writes to a flat
text file.
Need guidance in changing this to use mysql. Would email you direct
outside of the questions list.





While I don't consider myself knowledgable enough to help you with php I
have found this site helpful when I am looking for code ideas.
http://www.tutorialized.com/tutorials/PHP/1



Hi,

I'm not experienced enough in PHP to be a mentor 
in it but from one beginner to another maybe this 
will be useful.


Here is a link to a resource I used to get myself 
up-and-running with PHP. 
http://www.hudzilla.org/phpbook/index.php


I wrote the attached code when I playing around 
with the example from the MySQL manual.  It's just 
play code bu maybe it can point you to the name of 
functions (methods) to investigate.


Hth,

--Duane

Accessing a MySQL Database Using PHP

   Starting PHP script
   '; ? host_info); echo '
   '; printf(Server info: %s\n, $mysqli-server_info); echo '
   '; $query = SELECT CURRENT_USER();; $query .= SELECT name FROM
   pet; /* execute multi query */ if ($mysqli-multi_query($query)) { do
   { /* store first result set */ if ($result = $mysqli-store_result())
   { while ($row = $result-fetch_row()) { printf(%s
   , $row[0]); } $result-close(); } /* print divider */ if
   ($mysqli-more_results()) { printf(-
   ); } } while ($mysqli-next_result()); } /* close connection */
   $mysqli-close(); ?
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]

Looking for a mentor on php/mysql

2006-02-22 Thread fbsd_user
I am trying to teach my self php/mysql/html programming.
I have done native static html web sites before.
Running FreeBSD 6.0 with apache13, php, and mysql all installed and
working.

Have read a few php books and searched the web for code snippets.
Have been on some of the php forum sites, but responses are not forth
coming.

Looking for a mentor to guide me with puting all the pieces together.
I have a working panel for registering a user that writes to a flat
text file.
Need guidance in changing this to use mysql. Would email you direct
outside of the questions list.




html
head
meta http-equiv=Content-Language content=en-us
titlelearning PHP /title
/head
body
h1 ALIGN=centernbsp;/h1
h1 ALIGN=centerfont size=6nbsp;Membership
Registration/font/h1
font FACE=Courier New SIZE=2pnbsp;/p
pEnter your info below./font/p
pnbsp;/p

form method=POST action=?php echo($PHP_SELF); php?
   input type=hidden name=action value=addbr
  pAccount IDnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;
nbsp;nbsp;
  input type=text name=id size=20/p
  pAccount Passwordnbsp;nbsp;
  input type=text name=pw size=20/p
  pFirst
Namenbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;
nbsp;nbsp;
  input type=text name=first-name size=20/p
  pLast
Namenbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;
nbsp;nbsp;
  input type=text name=last-name size=20/p
  pAddress
Linenbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;
  input type=text name=address size=20/p

pCitynbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nb
sp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;
nbsp;nbsp;
  input type=text name=city size=20/p

pStatenbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;n
bsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; nbsp;nbsp;nbsp;
  input type=text name=state size=20/p

pZipnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbs
p;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;
nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;
  input type=text name=zip size=20/p
  pnbsp;/p

pnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;
nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;
  input type=submit value=Submit name=B1input type=reset
value=Reset name=B2/p
/form

pnbsp;/p
?php
$file_directory = $_SERVER[DOCUMENT_ROOT];
$user_ip = $_SERVER[REMOTE_ADDR];
$error = 'Could not open the file! Verify permissions  path are
correct.';


if($_POST['action'] == add)
 {
 if($filehandle = fopen($file_directory/members.php, a))
   {
flock($filehandle, 2);  // lock file
fputs($filehandle,
$_POST['id'].:.$_POST['pw'].:.$_SERVER['REMOTE_ADDR'].:.$_POST['
first-name'].:.$_POST['last-name'].:.$_POST['address'].:.$_POST[
'city'].:.$_POST['state'].:.$_POST['zip'].\n);
flock($filehandle, 3); // unlock file
fclose($filehandle);
print(Successfully added .$_POST['id']. to the file);
   }
   else
   {
echo($error);
   }
 }
php?
/body/html

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Looking for a mentor on php/mysql

2006-02-22 Thread Robert Uzzi
 I am trying to teach my self php/mysql/html programming.
 I have done native static html web sites before.
 Running FreeBSD 6.0 with apache13, php, and mysql all installed and
 working.

 Have read a few php books and searched the web for code snippets.
 Have been on some of the php forum sites, but responses are not forth
 coming.

 Looking for a mentor to guide me with puting all the pieces together.
 I have a working panel for registering a user that writes to a flat
 text file.
 Need guidance in changing this to use mysql. Would email you direct
 outside of the questions list.




While I don't consider myself knowledgable enough to help you with php I
have found this site helpful when I am looking for code ideas.
http://www.tutorialized.com/tutorials/PHP/1

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Looking for a mentor on php/mysql

2006-02-22 Thread Daniel A.
Hi,
While the idea of a mentor is quite widespread amongst people who
wish to learn a new field within IT, I find it that not many people
who want one get one.

I can, though, suggest that you in no circumstance save user passwords
in plaintext. I could find that file on a live server and retrieve all
user passwords.

The best way to learn any programming language (Or anything else, for
that matter) is to just play with it. Find some good guestbook script,
or some other type of not-so-complex code, and hack at it. Add
features, edit current features to your liking, etc.. That is how I
got good at coding PHP.


On 2/22/06, fbsd_user [EMAIL PROTECTED] wrote:
 I am trying to teach my self php/mysql/html programming.
 I have done native static html web sites before.
 Running FreeBSD 6.0 with apache13, php, and mysql all installed and
 working.

 Have read a few php books and searched the web for code snippets.
 Have been on some of the php forum sites, but responses are not forth
 coming.

 Looking for a mentor to guide me with puting all the pieces together.
 I have a working panel for registering a user that writes to a flat
 text file.
 Need guidance in changing this to use mysql. Would email you direct
 outside of the questions list.




 html
 head
 meta http-equiv=Content-Language content=en-us
 titlelearning PHP /title
 /head
 body
 h1 ALIGN=centernbsp;/h1
 h1 ALIGN=centerfont size=6nbsp;Membership
 Registration/font/h1
 font FACE=Courier New SIZE=2pnbsp;/p
 pEnter your info below./font/p
 pnbsp;/p

 form method=POST action=?php echo($PHP_SELF); php?
input type=hidden name=action value=addbr
   pAccount IDnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;
 nbsp;nbsp;
   input type=text name=id size=20/p
   pAccount Passwordnbsp;nbsp;
   input type=text name=pw size=20/p
   pFirst
 Namenbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;
 nbsp;nbsp;
   input type=text name=first-name size=20/p
   pLast
 Namenbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;
 nbsp;nbsp;
   input type=text name=last-name size=20/p
   pAddress
 Linenbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;
   input type=text name=address size=20/p

 pCitynbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nb
 sp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;
 nbsp;nbsp;
   input type=text name=city size=20/p

 pStatenbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;n
 bsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; nbsp;nbsp;nbsp;
   input type=text name=state size=20/p

 pZipnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbs
 p;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;
 nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;
   input type=text name=zip size=20/p
   pnbsp;/p

 pnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;
 nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;
   input type=submit value=Submit name=B1input type=reset
 value=Reset name=B2/p
 /form

 pnbsp;/p
 ?php
 $file_directory = $_SERVER[DOCUMENT_ROOT];
 $user_ip = $_SERVER[REMOTE_ADDR];
 $error = 'Could not open the file! Verify permissions  path are
 correct.';


 if($_POST['action'] == add)
  {
  if($filehandle = fopen($file_directory/members.php, a))
{
 flock($filehandle, 2);  // lock file
 fputs($filehandle,
 $_POST['id'].:.$_POST['pw'].:.$_SERVER['REMOTE_ADDR'].:.$_POST['
 first-name'].:.$_POST['last-name'].:.$_POST['address'].:.$_POST[
 'city'].:.$_POST['state'].:.$_POST['zip'].\n);
 flock($filehandle, 3); // unlock file
 fclose($filehandle);
 print(Successfully added .$_POST['id']. to the file);
}
else
{
 echo($error);
}
  }
 php?
 /body/html

 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to [EMAIL PROTECTED]

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]