473,471 Members | 1,733 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

connecting to MYSQL using PHP and Apache

3 New Member
I setted all settings
in php.ini & windows directory system32 libmysql.dll
I tried all that three steps u expalined

later i tried this code
1.
<?php
2.
echo mysql_connect("localhost", "root", "YOURPWHERE");
3.
?>

i got output resource #2

then i tried this
1.
error_reporting(E_ALL);
2.
echo mysql_connect("localhost", "root", "ROOTPWD") or die(mysql_error());
i got output only 1

plz anyone help me to solve this problem on my system

I am using APACHE HTTP SERVER 2.0.50
WINDOWS XP
MYSQL 5.0
PHP 5.2.5
Mar 20 '08 #1
3 1074
ronverdonk
4,258 Recognized Expert Specialist
The result of an mysql_conect is either a resource connection id or a FALSE, So your code is allright. But now you hgave to select a database, ussie a query, retirve the resuklts of the query, etc.like[php]
// connect to server
$conn=mysql_connect("localhost", "root", "ROOTPWD")
or die('Connection error: '.mysql_error());
// select the database
mysql_select_db(SQL_DB,$conn)
or die("Cannot select database: " . mysql_error());
// select rows from a table
$res=mysql_query("SELECT * FROM table_name")
or die("SELECT error: ".mysql_error());
if (mysql_num_rows($res) < 1)
die("No rows selected");
// there are rwos in the rsult, process them
else {
// get all rows in a while loop
while ($row=mysql_fetch_assoc($res) ) {
$myvar=$row['xxxx'];
// etc ........
}
}[/php]This is a simple example of how to do it.

Ronald
Mar 20 '08 #2
srinivasMP51
3 New Member
i tried this one simply my output is blank screen
Mar 20 '08 #3
ronverdonk
4,258 Recognized Expert Specialist
The sample shown is exactly what it says: just a sample. You have to fill in all variable fields for your own system! Have you done that? If so, show the code you have used to get nothing.

And show the code within the appropriate code tags. See the Posting Guidelines.

Ronald
Mar 20 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Bob Trautman | last post by:
I have installed MySql on a Windows 98 workstation. I start the service with the command: mysqld I can connect to the database and see tables, etc. I have installed Apache Ver 1.X with PHP...
2
by: pancho | last post by:
Greetings, I need help configuring/building PHP3 with MySQL as a DSO on a Solaris 8 box - this module is needed to host some existing sites I will be migrating Note. I built PHP4 from source and...
0
by: Monica Ferrero | last post by:
Hi! I'm not sure if this is the most adequate mySQL list for this post. If not, please indicat me which one I should use... I'm using Tomcat 4.1.24 with Apache 2 and MySQL 4.0.13. I have the...
0
by: bruce | last post by:
Hi... A mysql/Apache issue: I get the following when I'm trying to run a test web site on an Apache 2.0/RH8.0 setup. -------------------------------- Warning: Access denied for user:...
0
by: bruce | last post by:
Hi... Update.... We have the following setup in our httpd.conf file. We've tried to give what's related to the issue. We're trying to set up a virtual host for a test project. The behavior...
6
by: MBS | last post by:
Yeah, read the previous posts...I did that. None answer my question. I just installed PHP 5.0.4, Apache 2.0.54, and MySQL 4.1.13 a few days ago on WinXP SP2. My goal is to learn to use these...
2
by: news | last post by:
We currently have our mySQL server on the same box as the Apache server. For security and load balancing, we're going to be moving the mySQL server to another box. We're already using a single...
1
by: ironcito | last post by:
Hello, I installed Apache 2.0.55, PHP 5.1.1, and MySQL 5.0.17 (in that order, on Windows XP). I have managed to get Apache and PHP working right, and MySQL by itself seems ok too. However, when...
11
by: Howard | last post by:
Hi, I have been racking my brain trying to figure out what I am missing trying to follow this book to get a php script to work. I would really appreciate if someone could point out my errors....
0
by: cwho.work | last post by:
Hi! We are using apache ibatis with our MySQL 5.0 database (using innodb tables), in our web application running on Tomcat 5. Recently we started getting a number of errors relating to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
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,...
0
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...
0
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...
0
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 ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.