[thelist] PHP Apache & MySql the next step
Andrew Maynes
andrew at humanbehaviour.co.uk
Thu Aug 29 09:25:02 CDT 2002
I will try that cool,
It is these two bits that are causing problems
$WebRoot="/Cart";
$Relative="/localhost/Cart";
? Andrew
-----Original Message-----
From: thelist-admin at lists.evolt.org
[mailto:thelist-admin at lists.evolt.org]On Behalf Of Jay Blanchard
Sent: Thursday, August 29, 2002 03:18
To: thelist at lists.evolt.org
Subject: RE: [thelist] PHP Apache & MySql the next step
[snip]
still struggling to connect a script to the DB though wants a relative path
?
[/snip]
Why are you struggling? Take the code I posted earlier;
<?php
//connect to & select database
if(!($connect = mysql_pconnect("127.0.0.1", "username", "password"))){
print("Failed to connect to database!\n");
exit();
}
if(!mysql_select_db("mysql", $connect)){
print("Failed to select database!\n");
exit();
}
?>
Change the mysql_select_db as I have done. Then perform a simple and quick
query (put the code above and the code below in one page);
<?php
$query = "SELECT User from user ";
$result = mysql_query($query, $connect);
while($row = mysql_fetch_object($result)){
print($row->User . "<br>\n");
}
?>
Run the script in the browser. If it works then you're golden.
Jay
*****************************************************
* Texas PHP Developers Conf Spring 2003 *
* T Bar M Resort & Conference Center *
* New Braunfels, Texas *
* Contact jay.blanchard at niicommunications.com *
* *
* Want to present a paper or workshop? Contact now! *
*****************************************************
--
For unsubscribe and other options, including
the Tip Harvester and archive of thelist go to:
http://lists.evolt.org Workers of the Web, evolt !
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.384 / Virus Database: 216 - Release Date: 8/21/02
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.384 / Virus Database: 216 - Release Date: 8/21/02
More information about the thelist
mailing list