|
Subject:
|
Help me Please
|
|
Posted By:
|
minhtri
|
Post Date:
|
11/9/2004 11:59:24 PM
|
Does any one tell me How to Connect PHP with MySql database please
|
|
Reply By:
|
SiliconFuRy
|
Reply Date:
|
11/10/2004 5:21:25 AM
|
In the words of the virgin mary, RTFM ;)
http://www.php.net/mysql
Once you know the basics, its very simple. Connecting is a matter of using the command mysql_connect(), and mysql_query() to run a query.
Many shoes,
James/SiliconFuRy
|
|
Reply By:
|
SiliconFuRy
|
Reply Date:
|
11/10/2004 5:28:56 AM
|
To get you started, try this(predefining the variables of course):
mysql_connect($hostname, $user, $pass) or die("Cannot connect to server!\n"); mysql_select_db($dbname) or die("Table unavailable!\n");
$sql = "Show tables";
$result = mysql_query($sql);
$result is now an identifier to the result list that the query returned.
mysql_fetch_array($result) will return the first row in the result, so implement this in a loop to go through the result table row at a time and do whatever functions you need.
Many shows,
James/SiliconFuRy
|
|
Reply By:
|
minhtri
|
Reply Date:
|
11/11/2004 10:14:58 AM
|
yes I try to use mysql_connect($hostname, $user, $pass) or die("Cannot connect to server!\n"); function bu I get the following error Undefind mysql_connect function I'm using XP pro
|
|
Reply By:
|
Snib
|
Reply Date:
|
11/11/2004 10:54:01 AM
|
READ THE MANUAL.
If you had read the manual, it says that the MySQL library is no longer included with PHP 5.
Read the manual for instructions to install it.
-Snib Where will you be in 100 years? Try new FreshView 0.2!
|
|
Reply By:
|
SiliconFuRy
|
Reply Date:
|
11/12/2004 4:41:56 AM
|
Is this some nazisom/communism/capitilism/shoeism by PHP not to include php by default? Or is it just a security thing?
Many shoes,
James/SiliconFuRy
|
|
Reply By:
|
Snib
|
Reply Date:
|
11/12/2004 3:28:08 PM
|
I assume you mean to not include MySQL by default....
I agree with you, it's kind of stupid. I searched on it and it gave me this: http://us2.php.net/manual/en/faq.databases.php#faq.databases.mysql.php5
-Snib Where will you be in 100 years? Try new FreshView 0.2!
|
|
Reply By:
|
SiliconFuRy
|
Reply Date:
|
11/15/2004 6:13:50 AM
|
Excuse my shoes, going by the time of posting it must have been nearing the Midday Feeding Frenzy...
Many shoes
JAmez
|
|
Reply By:
|
anshul
|
Reply Date:
|
11/16/2004 4:27:20 AM
|
Why2use PHP-MySQL on WinXPPRO !!
Better try install PHP 5 on Win2000 or 2003 Be ready to read documentation, download something from php.net and fix mysql by hit -n- trial
I'm better with PHP 4.3.4 
Why2use extra PHP 5 lieu 4.x.y !!
|
|
Reply By:
|
Snib
|
Reply Date:
|
11/16/2004 1:38:16 PM
|
Tell me, how does this post help anyone? Or are you just saying you don't care for XP? PHP runs almost the same cross-platform.
-Snib Where will you be in 100 years? Try new FreshView 0.2!
|
|
Reply By:
|
SiliconFuRy
|
Reply Date:
|
11/17/2004 4:58:44 AM
|
I agree with Snib's shoes. I run PHP on a Windows 2000 server in an enterprise environment and I have had minimal^Wno problems so far.
The prob is people who can't configure their setup for IIS/Apache/PHP.
Many shoes,
Jamez/SiliconFuRy
|