Solved

A Test Page For PHP Immidiately

Posted on 2003-10-27
15
172 Views
Last Modified: 2006-11-17
Here's the situation, I have a server (which I shall leave named x) which has phpMyAdmin on it. I need help getting a test page from one of you or on the Internet that has some basic PHP functions that I can use, like making a new table in a database, and pulling that information. I need this page because I'm a beginner and need a page like this that can help me learn some of the working characteristics of this language. I also am looking for a GOOD guide on PHP, have NOT found ANY yet. What can you do for me?

Nicolae Crisan,
crisann@mxtech.net
MxTechnical Computer Soltuions,
www.mxtech.net
0
Comment
Question by:ncwhiz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
  • 3
  • +2
15 Comments
 

Accepted Solution

by:
mrjoe earned 85 total points
ID: 9630951
Try the php.net tutorial for a start.

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

Greetz
0
 

Expert Comment

by:mrjoe
ID: 9630955
0
 
LVL 1

Author Comment

by:ncwhiz
ID: 9631438
great stuff! Answered many questions! BUT one thing, when connecting to a database, where do you put the code for connecting to that database? Do you put it in a separte file, or just with your html? example "connect.php"? What i do? Here's an example of code they site gave me.

$username="username";
$password="password";
$database="your_database";

Such and such...

I have some code, but what do I do now? stick it into my php file example (index.php) or do i have to put it into a seperate file and then pull that file first and do a redirect? What's the score here? How do I do this, so i can be able to enter information into my database as quickly as possible.

Thanks For All The Previous Help,
NcWhiz
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 13

Expert Comment

by:lozloz
ID: 9631555
you can do all in the connecting in a seperate file then include the file on each php page by using the include function, e.g. include("connect.php");

my usually looks something like this:

<?
$db_user = "user";
$db_pass = "pass";
$db = "db";
$host = "localhost";
$link = mysql_connect($host,$db_user,$db_pass) or die("Database connection broken");
mysql_select_db($db,$link) or die("Database connection unavailable - " . mysql_error());
?>

you can put all your php code into index.php and it will be parsed by the engine and converted into html for the user to see. inserting data based on user inputs will need some forms which can then be parsed by php and and inserted into mysql
0
 
LVL 1

Author Comment

by:ncwhiz
ID: 9631568
so like this ...
<?php
include (connect.php)
?>

Like that?
0
 
LVL 13

Expert Comment

by:lozloz
ID: 9631587
<?php
include("connect.php");
?>

you need the semi colon and the quotes, and the file needs to be in the same directory as the script you're running, if not you need the change string in the include function to have the path info as well. useful tip: if you want to read up about a function go to www.php.net/functionname where functionname is the function you want more info about.. so www.php.net/include for this one
0
 
LVL 1

Author Comment

by:ncwhiz
ID: 9631600
and one more thought, where's the close (); part on this code? shouldn't that be there in there somewhere? I don't want to kill my hosts server!
0
 
LVL 13

Expert Comment

by:lozloz
ID: 9631612
the function is called mysql_close();

quoting from the manual:

Using mysql_close() isn't usually necessary, as non-persistent open links are automatically closed at the end of the script's execution. See also freeing resources.

i never use it
0
 
LVL 1

Author Comment

by:ncwhiz
ID: 9631620
Ahhh!! Cool, this is cool! I'm getting it!! Cha-Ching!! Thanks a ton!... I'll post back for more ques.
0
 
LVL 1

Author Comment

by:ncwhiz
ID: 9631630
One more comment, HOW CAN YOU MAKE SURE that you have a working connection?
0
 
LVL 1

Expert Comment

by:lamdor
ID: 9632351
Hey ncwhiz,

 What was your question (A Test Page For PHP Immidiately?)
and where you have lead it? (One more comment, HOW CAN YOU MAKE SURE that you have a working connection?)..

 see its not fair..

 ask more questions..don't lead one question into multiple..
 I think if u open new question then you will get good answers..

okay..

with regards
lamdor.
0
 
LVL 7

Expert Comment

by:kohashi
ID: 9632353
from lozloz:

?
$db_user = "user";
$db_pass = "pass";
$db = "db";
$host = "localhost";
$link = mysql_connect($host,$db_user,$db_pass) or die("Database connection broken"); *RIGHT HERE TELLS YOU THAT YOU HAVE A WORKING CONNECTION OR DO NOT.  "or die" tells it to quit, it will show an error.*
mysql_select_db($db,$link) or die("Database connection unavailable - " . mysql_error());
?>

hope that helps,
-kohashi
0
 
LVL 7

Expert Comment

by:kohashi
ID: 9632402
http://directory.google.com/Top/Computers/Programming/Languages/PHP/Tutorials/

A list of PHP tutorials :)

hope that also helps,
-kohashi
0
 
LVL 1

Author Comment

by:ncwhiz
ID: 9633436
Okay, I gave the points to marjoe, because this user had the best answer to this question, however, lolz helped me the most in the detials, So I'll start some new questions, so Lolz can get some points as well. Sorry about that.
0
 

Expert Comment

by:mrjoe
ID: 9633503
Thanks, good thinking about starting some new questions, and good luck with php!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Why is my $_POST not going to results page 10 68
How to close my php post page. 3 41
phpmyadmin memory error 55 94
Code planning methods/tools? 5 56
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This article discusses how to implement server side field validation and display customized error messages to the client.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question