View Full Version : php/ mysql
jonathan C
12-12-2002, 12:00 AM
What are some good resources on how to integrate PHP and MYSQL. I have looked both at php.net and at the mysql site and neither explain in basic terms how to get data in and out of a mysql database through php. Or maybe they do and i just don't understand it. If my understanding is correct, you just use mysql commands within <?php blah blah ?> tags. is that correct or what am I missing. Maybe it's that i need to connect to the database. If so, what is the best way to connect? Any suggestions on books or preferrably websites that could explain this a little better?
Dynasty
12-12-2002, 07:19 AM
Connecting is just
mysql_connect(Server,Username,Password);
And yes the commands just go in the <?php ?> tags.
www.phpbuilder.org is a good site.
MikeParent
12-13-2002, 04:13 AM
Having the Wrox PHP Programming book by your side is handy (all the Wrox "red" books are phenomenal references) .
The MySQL HTML documentation (installs with MySQL), is also invaluable.
As mentioned PHP Builder is a good site.
CodeMain (http://www.codemain.com/) is also a good one.
sandeepji
07-22-2010, 11:09 PM
hi Here i mention simple login script that help you
save it in root folder as index_dir.php
<?php
if(isset($_POST['posted']))
{
$name=$_POST['dir_username'];
$pass=$_POST['dir_password'];
$connect=mysql_connect('localhost','root','');
$db=mysql_select_db('dir_db',$connect);
$query=mysql_query('SELECT * FROM dir_login',$connect);
while($row=mysql_fetch_array($query))
{
$column1=$row['username'];
$column2=$row['password'];
if($column1 == $name && $column2 == $pass)
{
header('location:registration_dir.php');
}
else
{
echo('Sorry Username and password is mismatch');
exit();
}
}
}
?>
<form name="index_dir" method="post" action="index_dir.php">
<table align="center" border="">
<tr>
<td>
<b style="background-color:#063">USERNAME</b>
<input type="text" name="dir_username" value="USERNAME" style="background-color:#966">
</td>
</tr>
<tr>
<td><b style="background-color:#063">PASSWORD</b>
<input type="password" name="dir_password" value="*****" style="background-color:#966">
</td>
</tr>
<tr>
<td><input type="hidden" name="posted" value="true>"></td>
<td>
<input type="submit" name="dir_submir" value="GO" style="background-color:#063">
</td>
</tr>
</table>
</form>
and still you have doubt then just mention here, I'll solve them
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.