anyone here good with php coding and linking databases with mysql through coding itself? If someone can provide me help and fast I can paypal some money. Shoot me a message or reply, thank you

Recommended Answers

All 3 Replies

That is not how things work here. If you want to post a job offer, do so in the Business Exchange area.

If you wish to ask questions, ask them here. Post code if it's relevant.

Do not post asking for help through PM or email.

anyone here good with php coding and linking databases with mysql through coding itself? If someone can provide me help and fast I can paypal some money. Shoot me a message or reply, thank you

HI.

Here is an example of one of my php scripts.
I've changed the database username and password for security reasons.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
	<title>List Badminton Matches</title>
</head>

<body BGCOLOR=#0099FF>

<!-- This script is called by badminton2.html -->

<?PHP 
print (date('l d F Y'));
print ("<CENTER><h3>Badminton Matches.</h3></CENTER>");

?>




<?PHP
include("dbconnect.php");
$Query = "SELECT DATE_FORMAT(date, '%a %D %b %Y') as FDate, date, time,DATE_FORMAT(time,'%l:%i %p') AS start, team, clubname, venue,homeaway from matches where Date > '20100831' order by date, time";


// $Result = mysql_db_query ($DBName, $Query, $Link);
$Result = mysql_query ($Query) or die("SELECT: Failed.");

//DATE_FORMAT(time,'%l:%i %p') AS start

// Create a table
print ("<TABLE BORDER=0 WIDTH=\"75%\" CELLSPACING=2 CELLPADDING=2 ALIGN=CENTER>\n");
print ("<TR ALIGN=CENTER VALIGN=TOP>\n");
//print ("<TH ALIGN=CENTER VALIGN=TOP>FDate</TD>\n");
print ("<TH ALIGN=CENTER VALIGN=TOP>Date</TD>\n");
print ("<TH ALIGN=CENTER VALIGN=TOP>Time</TD>\n");
print ("<TH ALIGN=CENTER VALIGN=TOP>Team</TD>\n");
print ("<TH ALIGN=CENTER VALIGN=TOP>Club</TD>\n");
print ("<TH ALIGN=CENTER VALIGN=TOP>Venue</TD>\n");
print ("<TH ALIGN=CENTER VALIGN=TOP>Home/Away</TD>\n");
print ("</tr>\n");

// Fetch the results from the database.
while ($Row = mysql_fetch_array
	($Result)) {
		print ("<TR ALIGN=CENTER VALIGN=TOP>\n");
		print ("<TD ALIGN=CENTER VALIGN=TOP>$Row[FDate]</TD>\n");
		//print ("<TD ALIGN=CENTER VALIGN=TOP>$Row[date]</TD>\n");
		print ("<TD ALIGN=CENTER VALIGN=TOP>$Row[start]</TD>\n");
		print ("<TD ALIGN=CENTER VALIGN=TOP>$Row[team]</TD>\n");
		print ("<TD ALIGN=CENTER VALIGN=TOP>$Row[clubname]</TD>\n");
		print ("<TD ALIGN=CENTER VALIGN=TOP>$Row[venue]</TD>\n");
		print ("<TD ALIGN=CENTER VALIGN=TOP>$Row[homeaway]</TD>\n");
		print ("</TR>\n");
	}
	
print ("</TABLE>\n");


?>

<table>
<tr>
<td><a href=""></a></td>
</tr>
</table>

</body>
</html>


<! Here is the included dbconnect.php>

<?PHP

// Set the variables for the database
$Host = "mysql1.webhostprovider.com";
$User = "Mydata";
$Password = "**********";
$DBName = "MyDBName";

//print ("<BR>Host:$Host User: $User Password: $Password<BR>\n");

// Create a link to MySQL
$Link = mysql_connect($Host,$User,$Password) or die("Could not connect");
//   print "Connected successfully";



if (mysql_select_db ($DBName)) {
	
} else {
	print ("<BR>The query could not be executed.<BR>\n");
}

//if (mysql_select_db ($DBName)) {
//	print ("The database has been opened.<BR>\n");
//} else {
//	print ("the query could not be executed.<BR>\n");
//}
// Only uncomment out the above code if you need to debug the script

// $Result = mysql_query ($Query) or die ("The record insert has failed - $Result.\n");
?>

See http://www.lesniak.co.uk/matches.php for the output.

I hope this helps

anyone here good with php coding and linking databases with mysql through coding itself? If someone can provide me help and fast I can paypal some money. Shoot me a message or reply, thank you

Linking to a database with php is very simple. Here is an example. Assuming these are your sever details:
host = localhost
username = root
password = pass
database = mydb

Now here is the code

<?php
//connect to your server
$connection = mysql_connect("localhost", "root", "pass") or die("Unable to connect. ".mysql_error());

//Select your database
mysql_select_db("mydb", $connection) or die("Error selecting database. ".mysql_error());
?>

You are now connected and you can query your database for any information.

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.