Hello Dani PHP Members.

My name is Michael, I have been looking online for a place to learn php and at this point I have given up.

I am wondering if there is anyone on here that can teach me php and mysql.
Or if you know of any places I can learn from please let me know the web urls.


thank you,
Michael C. :p

Hi Michael

How you learn will depend on what other programming languages you know. If you've got significant experience in any other language it's really just a matter of converting the syntax, getting a few new concepts and you're off running.

If you are new to all programming then the learning curve is quite different.

Hunt around for a few tutorials, follow them through. Create guest books, practice applying design. Find a php forum which gets alot of traffic and try answering other peoples questions, or just following through with the answers to see why the recommendations were made.

Sites to watch
PHPClasses.org - a great script repository
Weberdevscripts and articles and Weberforums
Newbies board at PHPBuilder.com
SourceForge
Open Source CMS

A key question to ask yourself is why you want to learn PHP and structure your learning around your goals.

Sarah

Hello Sarah.

I would like to learn as much as possible not just on one subject or one goal, I would like to know how to create anything using php/mysql.

I would also like to learn WAP, and some other things, but I would like to learn php and mysql first.

Also there were a few links that you posted but did not say where to look for php stuff.


Please let me know, Thank you
Michael

Oh yeah, I forgot to post a link to the most important site of all http://www.php.net

Not only is it the manual but people contribute code there too.

OK Michael

You have a website right, and a MySQL database? either on your PC at home or on the web somewhere? If not, go get one.

Then create a basic hello world site using these file

index.php

<?php
$title = 'Michaels first page';
 
include 'header.php';
include 'leftnav.php';
//ready to start content
?><h1>Hello World</h1>
<p>My name is Michael</p>
<?php
// no more unique content
include 'footer.php';
?>

header.php

<html>
<head>
<title><?php echo $title; ?></title>
<style>
body, table { font: 12px Arial, Helvetica, Verdana, Geneva, Sans-serif; }
a { color: navy; text-decoration: none; font-weight: bold; }
a:hover { text-decoration: underline }
</style>
</head>
<body>
<table border='0' cellpadding='0' cellspacing='0'>

leftnav.php

<tr><td><h2>Menu</h2>
<ul>
<li><a href='page1'>Page 1</a></li>
<li><a href='page2'>Page 2</a></li>
</ul>
</td>
<td>

footer.php

</td></tr></table>
<div align='center'>&copy; <?php echo date('Y'); ?> Michael</div>
</body>
</html>

You'll see that on some files I break in and out of PHP and in others there is none at all. I also refer to page 1 and page 2 which will be copies of index.php with different content.

Now, you get to muck about adding some html onto the page, playing with the stylesheet to display the fonts and colours the way you want.

Notice that if you change something in header it follows through for the page 1 and page 2.
See how I create a variable called $title but I only use it in header.php and it can see it.

Next, add something from the database...

Sarah

Dear Sarah

:eek: :eek: :eek:

I wish I know what you just did, or even said

Each code section needs to be a separate file with the name I've given. Upload them onto your php website and ask it for http://www.mysite.com/index.php where mysite is your actual site name.

Sarah

Oh no I have a domains but no hosting right now, Can not find anyone that offers a good thing for a good price.

This is a great place to start, espcially if you want to understand the difference of PHP4 and PHP5, and you want to learn PHP:

http://www.php.net/manual/en/

--
Installation and Configuration:

http://www.php.net/manual/en/install.php
--

--
Language Reference:

http://www.php.net/manual/en/langref.php
--

--
PHP4 Object Oriented:

http://us2.php.net/oop/
--

--
PHP5 Object Oriented:

http://us3.php.net/zend-engine-2.php--

My suggestion to you is to read the documentation section fully, then move into the PHP5 OO section. PHP5 has a few changes from PHP4 especially in how Object Oriented code is handled, so my suggstion is to familiarize yourself with PHP5.

Oh no I have a domains but no hosting right now, Can not find anyone that offers a good thing for a good price.

Visit our Hosting Offers forum for some cool deals. If you can't find anything, post in our Hosting Requests forum.

you could also open a localhost on your machine, as long as you have internet connection.

Try downloading Apache servers with the self installing php!
It'll make the hosting problem dissapear!

:)

I learnt php + mysql from Internet sites. One I most recommended is http://www.php-mysql-tutorial.com/index.php. It would be easier if you know VB.

For hosting, you can get a few free for practice purposes. Do google search.

Hey all,

Ok here is an new update on my behalf. I have printed all 1801 pages of the php.net manual.

I have study this manual inside and out and have read all pages and did all exmples they had posted in the manual. The I went to the book store and bought 10 different php books and have read about 3 of them already.

You would think after reading the php.net manual and at least 3 books I would know how to write php, but I am still not understanding everything I have read.


I am trying to make a contact form, a Place Ad form, and a edit ad form,
the contact use form is I am sure all easy to you guys. But for some reason I do not know where to begin.

the Place ad form, I want people to be able to post ads about there cars they have for sell, and well with the Edit Ad I am sure you know what that means as well.

One other thing I am trying to make a Upload script as well for the same site, that will upload and update the clients pictures of there cars or to add new pictures.


Can any one here give me a hand on how this would all be done.


Thank you all for the help in advanced.
MichaelK5 - :D :cheesy:

I don't think reading is enough and effective way to learn something like php. hand on practical experience is more important. I learnt php not even bought a book or print out the manual. I suggest you search for script (from Internet) that you want to program with and modify the code to suit your need. I only refer the manual when I need function that I not totally understand, or cannot remember, such as date's variables.

Here's email contact script:

<?php
if(strlen($_POST["textarea"]) > 10 && isset($_POST["email"])) {
  $mssg = str_replace(Chr(13), "<br>", $_POST["textarea"]);
  $mssg = stripslashes($mssg);
  $to  = "yourself@yourdomain.com";
  $subject = $_POST["subject"];
  $message = "<i>Message from ". $_POST["client"] .":</i>\r\n<br><br>";
  $message .= $mssg;
										
  // and now mail it and print confirmation 
  mail($to, $subject, $message, $headers);
  echo "<h1>Email Sent! </h1>";
}
?>
<form name="form" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<table width="100%" border="0" cellspacing="2" cellpadding="3">
   <tr> 
      <td width="25%">Your Name:</td>
      <td width="75%"><input type="text" name="client" size="30"></td>
   </tr>
   <tr> 
      <td>Your Email:</td>
      <td><input type="text" name="email" size="30"></td>
   </tr>
   <tr> 
      <td>Subject:</td>
      <td><input type="text" name="subject" size="30"></td>
   </tr>
   <tr valign="top"> 
     <td height="25">Message:</td>
     <td><textarea name="textarea" rows="10" cols="65"></textarea></td>
   </tr>
   <tr valign="bottom"> 
      <td></td>
      <td><input type="submit" name="Submit" value=" Send Email "></td>
   </tr>
</table>
</form>

Here is the upload script:

<form method="POST" enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<table border="0" cellspacing="0" cellpadding="0">
  <tr> 
	<td width="20%">File 1:</td>
	<td width="80%"><input type="file" name="file1" size="35"> </td>
  </tr>
  <tr> 
	<td>File 2: </td>
	<td><input type="file" name="file2" size="35"> </td>
  </tr>
 <!-- can add more input here -->
  <tr> 
	<td>&nbsp;</td>
	<td height="40"><div align="center"> 
		<input type="submit" name="submit" value=" Upload ">
	  </div></td>
  </tr>
</table>
</form>
<?php
// In PHP earlier then 4.1.0, $HTTP_POST_FILES should be used instead of $_FILES. 
  if($_FILES["file1"]["size"] > 0) {
	echo "<h4>Upload Result</h4>";
	for ($i=1; $i<=5; $i++)
	{
	  $file = $_FILES["file".$i];
	  echo "File ".$i.": ";
	  if($file["size"] > 0) { 

		$fileName = basename($file["name"]);
		$ext = substr($fileName, -3, 3);
		// filter file you allow to upload
		$accept = array('pdf','doc','xls','ppt','txt','zip');

		// filter filesize
		if ($file["size"] > 500000) { 
		  echo "Filesize over 500 KB limit.<br>\n"; 
		}
		elseif(!in_array($ext, $accept))  { 
		echo "Invalid file format. <br>\n"; 
		} 
		else {
		  // set folder path to which image uploaded 
		  $uploaddir = "../shop/".$shop_id."/";  	// name of directory
		  
		  //copy the file to some permanent location 
		  if (move_uploaded_file($file["tmp_name"], $uploaddir . $file["name"])) {
			echo $file["name"]." uploaded.<br>\n";
		  } else {
			echo "Error found. Please try again. <br>\n";
		  }
		}
	  } else {
		echo "File not found.<br>\n";
	  }
	} 
  }
  ?>

Zippee,

For some reason the e-mail script is not working it never sends the test mail to me.

Upload script is not working either, its giving me the following.....


File 1:
File 2:


Upload Result
File 1: Invalid file format.
File 2: File not found.
File 3: File not found.
File 4: File not found.
File 5: File not found.

1. Make sure your hosting enable smtp, so that email can be sent out.
2. Make sure you upload the correct file extension, as listed.

:cool: You're come a right place

Well Ok I have gotten the Contact us form to work.
But I still can not upload anything using the script Zeppe gave me even with the changes within our pms.


I am wondering if anyone else can help fix this problem.

Thank you.

P.S. I have started a New community forum and could use some feedback and php helpers.. If anyone is could help please let me know..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.