Please help - getting very desperate! Sun, 12 October 2003 05:39
I have PHPDEV 4.2.3 from Firepages.com.a u as the upgrade to 4.3.0 did
not work. I also had an abortive download from PHP.NET as I could not
configure Apache myself.
The REAL problem is that PHPmyAdmin works and sees my test database
Wines....
But my PHP program does not!
The code I have used is:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<TITLE> Getting PHP & MY SQL to work </TITLE>
<head>Wines PHP Tester<BR></head>
<body>
<?php
echo "This is PHP here....<BR>\n" ;
$link_id = @msql_pconnect( "localhost" );
if (!$link_id) {
echo ("Failed to connect to MySQL!");
exit;
}
else;
{
echo "Connected OK!";
}
if (!mysql_select_ db("Wines")) {
echo ("Failed to select database cms!");
exit;
}
echo ("Connected to Database");
$resultset = mysql_query("SE LECT * FROM wine");
while ($row = mysql_fetch_row ($resultset)) {
echo "Date $row[0]: $row[1]\n";
}
echo ("end");
?>
</html>
</BODY>
</HTML>
And I have also tried:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> Getting PHP & MY SQL to work </TITLE>
</HEAD>
<BODY>
<html>
<head>Wines PHP Tester<BR></head>
<body>
<?php
echo "This is PHP here....<BR>\n" ;
$connection = mysql_connect(" localhost");
$db = mysql_select_db ("Wines",$conne ction);
$query = "SELECT * FROM Wine";
echo "Select..." ;
$result = mysql_query($qu ery,$connection );
echo "result..." ;
?>
</body>
</html>
</BODY>
</HTML>
But I get no results. It works fine in PHPmyAdmin though.
I did have a different Mysql on my XPHome box which I have
subsequently deleted as it could not connect to the server once PHP
was installed.
I am falling further behind in my degree as I can even get the db up
and running so I cant even get coding!
Please please help. 3 2585
try this
<?php
class base
{
#### SQL ####
//In this part of the Base class are located all sql related
functions
var $connected = false;
function sql_connect() //In this function u make a sql connection
{
############# FILL THIS IN: #############
$mysqlhost = 'localhost'; // Database
provider URL
$mysqluser = 'tobegood_test' ; // Database
gebruiker
$mysqlpassword = 'test'; // Database wachtwoord
$mysqldb = 'tobegood_test1 '; // Database
naam
############# That was all thnx ###########
if(!$this->connected)
{
$conn =
mysql_connect($ mysqlhost,$mysq luser,$mysqlpas sword) or die("Could not
connect to database!");
$select = mysql_select_db ($mysqldb,$conn ) or
die("Could not select the database!");
$connected = true;
}
}
function sql_query($quer y) //With this function u do a sql query
{
if(!$this->connected)
{
$this->sql_connect( );
}
$result = mysql_query($qu ery) or die("MySQL error :
".mysql_error() );
return ($result);
}
#### End SQL ####
}
class test extends base
{
function test()
{
$sql = $this->sql_query("SEL ECT * FROM wine");
$count = 0;
while($info = mysql_fetch_arr ay($sql))
{
echo $info[$count];
$count++;
}
}
}
$test = new test();
?>
Haven't tested it because my php server is down but it should work
good luck
On 12 Oct 2003 03:15:28 -0700, ju************* *@hotmail.com (James)
wrote: Please help - getting very desperate! Sun, 12 October 2003 05:39
I have PHPDEV 4.2.3 from Firepages.com.a u as the upgrade to 4.3.0 did not work. I also had an abortive download from PHP.NET as I could not configure Apache myself.
The REAL problem is that PHPmyAdmin works and sees my test database Wines.... But my PHP program does not!
The code I have used is:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <TITLE> Getting PHP & MY SQL to work </TITLE> <head>Wines PHP Tester<BR></head> <body> <?php echo "This is PHP here....<BR>\n" ;
$link_id = @msql_pconnect( "localhost" ); if (!$link_id) { echo ("Failed to connect to MySQL!"); exit; } else; { echo "Connected OK!"; }
if (!mysql_select_ db("Wines")) { echo ("Failed to select database cms!"); exit;
} echo ("Connected to Database"); $resultset = mysql_query("SE LECT * FROM wine"); while ($row = mysql_fetch_row ($resultset)) { echo "Date $row[0]: $row[1]\n"; } echo ("end"); ?> </html> </BODY> </HTML>
And I have also tried:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> Getting PHP & MY SQL to work </TITLE> </HEAD>
<BODY> <html> <head>Wines PHP Tester<BR></head> <body>
<?php echo "This is PHP here....<BR>\n" ; $connection = mysql_connect(" localhost");
$db = mysql_select_db ("Wines",$conne ction); $query = "SELECT * FROM Wine"; echo "Select..." ; $result = mysql_query($qu ery,$connection ); echo "result..." ;
?> </body> </html> </BODY> </HTML> But I get no results. It works fine in PHPmyAdmin though.
I did have a different Mysql on my XPHome box which I have subsequently deleted as it could not connect to the server once PHP was installed.
I am falling further behind in my degree as I can even get the db up and running so I cant even get coding!
Please please help.
"James" <ju************ **@hotmail.com> wrote in message
news:4e******** *************** ***@posting.goo gle.com... Please help - getting very desperate! Sun, 12 October 2003 05:39
I have PHPDEV 4.2.3 from Firepages.com.a u as the upgrade to 4.3.0 did not work. I also had an abortive download from PHP.NET as I could not configure Apache myself.
The REAL problem is that PHPmyAdmin works and sees my test database Wines.... But my PHP program does not!
The code I have used is:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <TITLE> Getting PHP & MY SQL to work </TITLE> <head>Wines PHP Tester<BR></head> <body> <?php echo "This is PHP here....<BR>\n" ;
$link_id = @msql_pconnect( "localhost" );
mysql and not msql !
$link_id = @mysql_pconnect ("localhost","u ser_name","user _password");
change user_name and user_password with your user name and passord
if (!$link_id) { echo ("Failed to connect to MySQL!"); exit; } else; { echo "Connected OK!"; }
if (!mysql_select_ db("Wines")) {
if (!mysql_select_ db("Wines",$lin k_id)) {
echo ("Failed to select database cms!"); exit;
} echo ("Connected to Database"); $resultset = mysql_query("SE LECT * FROM wine");
$resultset = mysql_query("SE LECT * FROM wine",$link_id) ;
while ($row = mysql_fetch_row ($resultset)) { echo "Date $row[0]: $row[1]\n";
echo "Date ".$row[0].": ".$row[1]."\n";
} echo ("end"); ?> </html> </BODY> </HTML>
And I have also tried:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> Getting PHP & MY SQL to work </TITLE> </HEAD>
<BODY> <html> <head>Wines PHP Tester<BR></head> <body>
<?php echo "This is PHP here....<BR>\n" ; $connection = mysql_connect(" localhost");
$db = mysql_select_db ("Wines",$conne ction); $query = "SELECT * FROM Wine"; echo "Select..." ; $result = mysql_query($qu ery,$connection ); echo "result..." ;
?> </body> </html> </BODY> </HTML> But I get no results. It works fine in PHPmyAdmin though.
I did have a different Mysql on my XPHome box which I have subsequently deleted as it could not connect to the server once PHP was installed.
I am falling further behind in my degree as I can even get the db up and running so I cant even get coding!
Please please help.
I noticed that Message-ID:
<4e************ **************@ posting.google. com> from James contained
the following: $link_id = @msql_pconnect( "localhost" ); if (!$link_id) { echo ("Failed to connect to MySQL!");
According to the manual, that function is used to make a persistent
connection to MiniSQL Dunno if it works with MySQL.
Try
$db = mysql_connect(" localhost", "username", "password") ;
if (!mysql_select_ db("Wines",$db) ) {
echo ("Failed to select database");
exit;
etc.,etc.,
--
Geoff Berrow
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: James Cameron |
last post by:
Hi I'm developing a program and the client is worried about future
reuse of the code. Say 5, 10, 15 years down the road. This will be a
major factor in selecting the development language. Any comments on
past experience, research articles, comments on the matter would be
much appreciated. I suspect something like C would be the best based
on comments I received from the VB news group.
Thanks for the help in advance
James Cameron
|
by: Matt |
last post by:
Hello
I have spent the last weeks trying to solve this problem but with no
luck at all, I have a piece of code that looks like this
declare @bestnr int,
@artnr varchar(25),
@journalnrrow int,
@bestlevant decimal,
|
by: tshad |
last post by:
I am just trying to decide whether to split my code and uses code behind. I
did it with one of my pages and found it was quite a bit of trouble.
I know that most people (and books and articles) like it because you can
split the code from the design. That is logical. But if you are the only
one working on the code, it seem a little overkill.
I use Dreamweaver to do my design and find it a bit of a hassle to have
multiple files open...
|
by: Scott Emick |
last post by:
I am using the following to compute distances between two lat/long
coordinates for a store locator - (VB .NET 2003)
it seems to take a long time to iterate through like 100-150 locations -
about 10-15 seconds...I want to make the code faster. I changed it to be
multi-threaded, and it doesn't really make it any faster. The bottleneck
seems to be with the math computations.
Any ideas like changing my data types or other ideas etc would...
|
by: Gernot Frisch |
last post by:
Hi,
I have no clue.
- I want to align the red, green, blue boxes in one line
- red,green,blue must be 45px high
- red (center) must be as wide as possible
- yellow must start exactly below the line
- yellow must be left aligned with red one.
| |
by: garyusenet |
last post by:
I have been trying to interface with my act database using .net and act
api's. I was originally using c# but it wouldn't connect to the
database. I tried VB in desperation and it is connecting!
Now i have hit another problem and i'm sure its down to the fact that
the code was written years ago, and needs a bit of modification for
..net can you take a look at these 12 lines of code and let me know how
to get it to work in .net please...
...
|
by: Cheryl Langdon |
last post by:
Hello everyone,
This is my first attempt at getting help in this manner. Please
forgive me if this is an inappropriate request.
I suddenly find myself in urgent need of instruction on how to
communicate with a MySQL database table on a web server, from inside
of my company's Access-VBA application. I know VBA pretty well but
have never before needed to do this HTTP/XML/MySQL type functions.
|
by: esimons |
last post by:
I am searching for days now to get a concrete example of how to use the __sleep() and __wakeup() function in a class to restore a databaseconnection when passing an object from one page to another by putting it in a session-variable.
What I already know is that you should load the class before the session_start() function etc... What I DO NOT know is how the concrete code in the __sleep() and __wakeup() functions should be in order to...
|
by: haft |
last post by:
I have posted this question on a javascript forum as it contains
javascript code however it was believed to be an asp issue.
The following head section javascript code contains the function
showBigImage( isource,bigImage,header ) function call of discussion:
var currentImage;
function showBigImage( isource,bigImage,header ) {
var theImage = document.getElementById( 'largeimage' );
theImage.src = isource;
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |