UK Webmaster Talk - Online Marketing - SEO


 

Help - Php

This is a discussion on Help - Php within the Php and MySQL forums, part of the Programming / Scripting / Coding category; Im going to leasrn PHP but i carnt find any decent tutorials if anyone noes of any good ones or ...


Go Back   UK Webmaster Talk - Online Marketing - SEO > Website Design & Development > Programming / Scripting / Coding > Php and MySQL

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Notices

Reply

 

LinkBack Thread Tools Display Modes
Old 25-06-2005, 10:30   #1 (permalink)
KF1
Guest
 
Posts: n/a
iTrader: / %
Default Help - Php

Im going to leasrn PHP but i carnt find any decent tutorials if anyone noes of any good ones or even better Video tutorials could you post them here

Ive learnt a lot of HTML and VB in the last month with video tutorials from
http://www.seangreasley.com/
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 25-06-2005, 13:11   #2 (permalink)
Active Member
 
Join Date: May 2005
Location: Doncaster, UK
Posts: 58
iTrader: 0 / 0%
vegancoder is on a distinguished road
Send a message via MSN to vegancoder
Default

never seen any video tutorials, but www.spoono.com is pretty good for beginning, making a guestbook is a good way to learn and then you can improve it as you advance
vegancoder is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 25-06-2005, 13:34   #3 (permalink)
KF1
Guest
 
Posts: n/a
iTrader: / %
Default

right i need HELP
ive made a script
Code:
<?PHP

$cfg['mysqlhost'] = '';	// Database host URL
$cfg['mysqluser'] = '';				// Database user
$cfg['mysqlpassword'] = '';		// Database password
$cfg['mysqldb'] = '';			// Database name
// MySql
$db_banlist = '';
$db_config = '';
$db_levels = '';
$db_mail = '';
$db_users = '';
$db_admin = '';
$db_style = '';
$db_lang = '';
$db_ads = '';
$db_online = '';

?>
i have that but how do i make my other script connect to it i need it to get mysql of my mysql script ? can any one help me?
its for a register form
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 26-06-2005, 12:11   #4 (permalink)
Active Member
 
Join Date: May 2005
Location: Doncaster, UK
Posts: 58
iTrader: 0 / 0%
vegancoder is on a distinguished road
Send a message via MSN to vegancoder
Default

hmmm not sure why you have put the connection variables into an array.

Here is the way i do it:

I save the code below in to a file called db.php
PHP Code:
<?
//database information
$host 'localhost'//the host, if the database is held on the server that the script is ran from it is localhost
$db_username ''//the username
$db_name ''//the name of the database
$db_password ''//the database password for the username

//connection strings
mysql_connect($db_host,$db_username,$db_password) or die(mysql_error());
mysql_select_db($db_name) or die(mysql_error());
?>
and the i use
PHP Code:
include('db.php';) 
on any page i want to connect to the database.

remeber to use this when you have finished with the connection(when you have finished querying the database):
PHP Code:
mysql_close(); 
that will close the connection
vegancoder is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 26-06-2005, 12:39   #5 (permalink)
KF1
Guest
 
Posts: n/a
iTrader: / %
Default

thank you
tahats what i need to do
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 28-06-2005, 20:27   #6 (permalink)
KF1
Guest
 
Posts: n/a
iTrader: / %
Default

could someone help me make a login form please?
i dont know what to put
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 28-06-2005, 20:48   #7 (permalink)
King of scotland
 
Join Date: Jun 2005
Location: ye olde oxforshire
Posts: 720
iTrader: 0 / 0%
randomman will become famous soon enough
Default

these php tuts are good but i find php an odd/hardish script anyway
randomman is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 28-06-2005, 20:57   #8 (permalink)
KF1
Guest
 
Posts: n/a
iTrader: / %
Default

can someone HELP ME please and soon Please i despiately need it in next 5 mins or SOONER PLEASE

Last edited by KF1; 29-06-2005 at 08:12.
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 29-06-2005, 14:13   #9 (permalink)
Active Member
 
Join Date: May 2005
Location: Doncaster, UK
Posts: 58
iTrader: 0 / 0%
vegancoder is on a distinguished road
Send a message via MSN to vegancoder
Default

Its un tested but should be fine, there are many improvements that coupld be made but it should do the job you want.

You will need to create a mysql database with a table called whatever you like but it must have the username and password columns. Edit the code so that $table equals whatever table name you have used.

Here is the code hope it helps!

PHP Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Login</title>
</head>

<body>
<?
$table 
'';//your user table
if($_POST['submit']){
    
$username $_POST['username'];
    
$password $_POST['password'];
    
$sql "SELECT * FROM $table WHERE username = '$username' password = '$password'";
    
$sql mysql_query($sql);
    if(
mysql_num_rows($sql)){
        
//successfull login
        
echo 'successfully logged in';
    } else {
        
//unsuccessful login
        
echo 'login failed';
    }
}else{
?>
    <form name="form1" method="post" action="<? echo $PHP_SELF?>">
        Username: 
        <input type="text" name="username">
        Password: 
        <input type="password" name="password">
        <input type="submit" name="submit" value="Login">
    </form>
<?
}//end submission check
?>
</body>
</html>
vegancoder is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 01-07-2005, 17:18   #10 (permalink)
King of scotland
 
Join Date: Jun 2005
Location: ye olde oxforshire
Posts: 720
iTrader: 0 / 0%
randomman will become famous soon enough
Default

back on topic, i still cant find anything good for the absolute begginer. can anyone help me?
randomman is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
php

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT +1. The time now is 16:40.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
UK Webmaster Forum © WebmasterTalk.co.uk | Design by Forbairt

Ad Management by RedTyger

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41