Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




How Do I Connect To A Table?


I am try to connect to my table I made in PHP Admin and for some reason I can't connect to it! Is it supposed to be something like: Yourusername_mytable? If you are using a hosting provider? PHP Code:




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
How To Connect Remote Site - Can't Connect To MySQL Server
Lets say, i have two php sites named Site-A and Site-B. I want to use MySql
Datbase of Site-B for Site-A.

Generally i use :

$Host="localhost";
$User="username";
$Pass="password";
$DB="databse";
mysql_connect($Host,$User,$Pass);
mysql_select_bd($DB);

When i connect to Site-B database from Site-A what will be the $Host name?
I have tried with: $Host="www.mysite.com";

but it shows the warning:
Warning: mysql_connect(): Can't connect to MySQL server on....

Grab Content From HTML Table And Place Into MySQL Table?
I am in the process of helping a co-worker upgrade some of his old static html pages into dynamic MySQL driven pages. He currently has a lot of pages with huge tables displaying data. Does anyone know if there is a script or class that can convert a table to a .sql file for upload?

Table Background Color Based On Results From MySQL Table
I am trying to get the "Did User Agree" field on a database query to be colored Green for "Agreed" Red for "Disagreed" and Blue for "Agreed (2nd Time)" .. I have my PHP setup to do the query just fine as of right now with alternating column colors, just can't seem to get the colors to work as I am hoping for.  Can anyone help me get the Agreed? table's background color to the colors above? Code:

Outputting A Table Or Form Using SHOW FIELDS FROM Table
In the code the MySQL database was queried using "SHOW FIELDS FROM table" which and the returned results of column names was then use to build an output for a form and a table with php using a series of if statements along the lines of if the returned field name matches something echo a text input field.

I have never seen this done this way before, so I want to get the opinion of the devshed user. Does it seem like an unsual long process to build up a form. Is there a security advantage doing it this way? Has anyone ever done it this way before?

Finding Matches In A Table And Then Moving That Match To Another Table?
Ok, I have a database that has a table called critiera in this table
is to fields on is ID and the other is critiera.

Now I want to filter out all the one that don't apple to the list and
move the one that match to a different database.

I know how to open a connection, close, select

but I don't know how I would inside of a database use another one as
the way to create the list of critieras....

Mysql Fetch_field Gets Table Alias, Not Real Table Name
After a SQL 'select .... from tablename alias'
the mysql_fetch_field function returns a value $result=>table which
will contain the alias, not the actual table name.
Is there a way to get the actual table name ?

I am running mysql 4.1 and php 4.4

Grab Data From A Table, Echo, Then Insert It Into A New Table...
I'm trying to do is count the number of times usernames shows up in a table. I then want to reinsert that information into a different table with the Username in column1 & the occurrences in column2 for every user that is echoed on the page. Code:

Using PHP To Sort Data In MySQL Table 1 By Values In Table 2
I have a MySQL database with 2 tables in it. products and prices.. Products has a field in it called 'prodno'. Prices has a field in it called 'prodid'.

There is one of each item in products and each product has it's own unique 'prodno'

There are multiple instances of each product's pricing in prices.. One for each price.. So if a product had multiple prices depending on quantity it would have an entry for each price.. Example:

id = 1
prodid = 7001
qty = 300
price = 12.5

id = 2
prodid = 7001
qty = 400
price = 15.5

I was wondering if I could query the database getting info from the products table but sort it according to the prices in the prices table.

Kinda like doing a "SELECT * FROM products" ordering it by the lowest price value from each item..

This is all very confusing to me, and I'm the one writing it. Let's try one last time..

Query the database selecting * from products (I plan on using all the info in products) and ordering them by the lowest price for each item in the prices table. I've tried sorting the results of just a basic SELECT * FROM products using Javascript and PHP but with pagination in the results it makes it a bit hard.

Update Table While Insert Data To Another Table
it seem like mine coding din work.
[php]<?

include("checkin.html");
$conn=mysql_connect('localhost','root','') or die ('Could not connect to server');
$today = date("Y.m.d");
mysql_select_db('hms', $conn);

$ok = mysql_query("INSERT INTO check_in(ID,room_no,datein)values ('$ID','$room','$today')", $conn);

if( $ok ){

$up = mysql_query("UPDATE studtable SET checked = 'checkin' where [ID] = '%ID');

if(mysql_affected_rows( $up ) == 1)
{
echo'Checked IN!'
}else { echo'No such student to check in' }}
else { echo'Check In FAILED, please check again'}?>[php]

Using COM To Connect To Db
Does anyone know how to create a connection to a database file ("name.mdb") using COM, without having to set up an ODBC connection?

TCP Connect
What I want to do is take the content of one PHP file on one server and include it in another. The trick is I need server 1 to parse or translate the file before it is included in page on server 2. I can do this in another language and it is called TCPConnect. Code:

How To Transfer A Data With An Id To Another Table From A Table?
how am i going to transfer let say a name identified using the suer id and copy the name to the other table having the same user id>?

How Can I Find A Name From One Table In A Text From Another Table?
I have one table with a description field and other info, and I also have another table with a list of names and picture url:s. When I display the text description on my site I'd like to know if there are a match with a name from the 'names' table in the text. Code:

Returning Table Name As Well As Fields From That Table
I am returning all fields from news and from regional, however I want to determine where the fields have come from when I ouput the data, therefore I need to return the table name with the fields. Is this possible? Code:

Moving Data From One Table To Another Table
Does anyone know how to move one row from a table in a mysql database to another table using php?

Connect ASMX (.NET) Use XML From Php
DEAR ALL :

I got a API write with XML (use .NET) ,this script function is
to Insert someone data into mssql,
Today,how i can use this api with php?

i attach my file , plz help me to chk this .

myServer:linux+php+mysql+apache
myurl:test.com

theServer:win32+mssql+ASP+.NET
thePath : /webservices/User.asmx?op=UR_Create
theServer: 10.20.11.17
theport:81
----------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<USER_CreateAcc xmlns="http://test.yahoo.com.tw/webservices/UserAdd.asmx">
<MEMacc>string</MEMacc>
<MEMpas>string</MEMpas>
<MEMsex>int</MEMsex>
<MEMgroup>int</MEMgroup>
.
.
.
</USER_CreateAcc >
</soap:Body>
</soap:Envelope>

thz for help

How To Connect To Oracle?
Ok so I config PHP with:

./configure --prefix=/usr/orion/php/php --with-mysql --with-apxs=/usr/orion/php/apache/bin/apxs --with-oci8=/d0/app/oracle/product/8.1.6 --with-oracle=/d0/app/oracle/product/8.1.6

However in my httpd.conf I do not have a place to change my SID (instance) or ORACLE HOME

Anyone know why and maybe post the lines to add that to httpd.conf

How To Connect On MS SQL Database
How can I connect to a MS SQL server using PHP running under LINUX on different machine?..so u see, I have an NT server (where my MS SQL server is installed) and another server where I installed my MySQL and PHP (this is under Linux)..so is there a way to access Ms SQL via PHP ? if so, how can i do it? so they say i need to download an odbc driver?

Php/mysql - How To See If They Can Connect?
I have installed php and mysql but i am not sure the 2 are able to talk to
each other.

i have created a database in mysql called test / user: test / pw: test and
given the user select privelges. The table has one field column called test.
Can anyone tell me a simple php script to try to see if a connection can be...

Connect To MySQL
PHP 4.3.4 installed manually from package *.zip and Apache 2. I have a
problem with this simple code:

<?php
$link = mysql_connect("127.0.0.1","","")
or die("Could not connect: " . mysql_error());
echo "Connected successfully";
mysql_close($link);
?>

And this error occurs:

Warning: mysql_connect(): Can't connect to MySQL server on ďv.0.0.1'
(10061) in C:usrApache2htdocsfriko.plindex.html on line 18
Could not connect: Can't connect to MySQL server on 'localhost' (10061)

The settings are:

Active Persistent Links 0
Active Links 0
Client API version 3.23.49

Directive Local Value Master Value
mysql.allow_persistent On/On
mysql.connect_timeout 60/60
mysql.default_host localhost/localhost
mysql.default_password no value/no value
mysql.default_port no value/no value
mysql.default_socket no value/no value
mysql.default_user no value/no value
mysql.max_links Unlimited/Unlimited
mysql.max_persistent Unlimited/Unlimited
mysql.trace_mode Off/Off

Connect To The Mysql Already?
Hope you guys can help me out~~ I have a config.php file. I want to
conncet to my own mysql version. When i run the config.php file as
below, i get all successful message. However, when i take a look the
database information in doc environment, I don't see any database or
table created.

<html>
<head><title>Create Database and table</title></head>
<body>
<?php

//connect to the database, write, and execute the query
$linkID = mysql_connect("localhost", "", "") or die ('I cannot connect
to the
database because: ' . mysql_error());

if (!$_GET['linkID'])

{
print("The connection to the server was made successfully.<br>");
}
else
{
print("The connection to the server failed.<br>");
}

mysql_close($_GET['linkID']);

$DBName="Krista";
$TableName = "Employee";

//connect to the database, write, and execute the query
$Link = mysql_connect("localhost","","");

mysql_select_db("Krista", $_GET['Link']);

$resultID = mysql_query ("CREATE table Employee(EmployeeID INT
UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
Employee_Name TEXT",$_GET['Link']);

if(!$_GET['resultID']){
print("The query was successfully executed!<BR>
");
}
else{
print("The query could not be executed!<BR>
");
}

mysql_close($_GET['Link']);

?>
</body>
</html>

In addition, i change the global_register to on. However, I still need
to use $_GET['username'] like this. I want to use $username instead of
$_GET['xxx'].

Php Informix Connect
I want to connect my intranet server (with php/apache) to the other
informix database server,
But I didnt it. I dont know how i can do it?

Can i use php_informix extensions for example ifx_connect();

I was read this article: http://www-128.ibm.com/developerwor...dier/index.html
and doing step one step but i was not success.

Firstly I reading this page and copy PDO_INFORMIX to Php.5.3/ext/
pdo_informix directory.
Before i was download Php.5.2.3 source code and compiled Php.5.2.3
from the source code ./configure --enable-pdo --with-pdo-informix=/opt/
informix bla bla... then make / make install it.
But that not found informix driver to /opt/informix
shuold I download and setup Informix Client SDK ? to /opt/informix
directory

My Intranet Server Fetaures
Fedora Core 6 and Php 5.2.3 and Apache 2

Connect To MS Access
I am trying to connect to a MS Access database with PHP. I have set up the dNS but cant seem to open the database. Do I have to make any adjustments in my php.ini file.

Connect() Is New Function Of Php?
i've always used connect() as the name of my mysql connect functions. But now - in one particular server - it does not allow using connect() as a function name, it says:
Fatal error: Cannot redeclare connect() in /home/mysite/public_html/test.php on line 2
i made this file to be sure, that it's not my mistake. the file is: PHP Code:

Pconnect And Connect
I have been hearing about using pconnect in PHP to keep a "persistant", or on-going connection to the MySQL server. Using pconnect, does the connection carry over to the other pages or does it keep a connection until the page is done loading the PHP code?

Cannot Connect To Postgresql
I am running on Win XP. I have installed Apache 2.2. Works fine.
I have installed php-4.4.4-Win32 manually.
Apache to php connection is working fine, I tested a couple of trivial
php scripts.

I have installed PostGreSQL v8. I can do stuff (create table, populate
data) thru pgAdminIII tool, so I think that is also fine.

I want to install phpBB. When I try to do the set up I get message
"The PHP configuration on your server doesn't support the database type
that you chose"

So it tells me the issue is with php and PGSQL, hence my question here.

I have modified php.ini to uncomment the line
extension=php_pgsql.dll
and restarted the server. No good.

I tried running this script that I copied from a site
<html>
<head>
<title>PHP Test</title>
</head>
<body>
<?php echo '<p>Hello World</p>' ?>
<?php $conn = pg_connect("host=localhost port=5432 dbname=postgres
user=postgres password=mypasswd");
$sql = "SELECT current_date AS today;";
$result = pg_query($conn, $sql);
$row = pg_fetch_object($result, 0);
echo "Today is: " .$row->today;
?>
<?php phpinfo(); ?>
</body>
</html>

It prints out the Hello World line. Doesn't print the phpinfo. Nor
the current date.

Needless to say, I know no php, just want to get the bulletin board up
and running on my PC.

How To Connect To Mssqlserver With Php?
i'm trying to get my php 4.0.3pl1 to work with mssql server 7, but i read in the php.ini file that i'll need a dynamic extension mssql7.dll. where can i find the file? i'm using php4.0.3pl1 with win98+apache3.22.34

How Do I Connect To MySQL In A Url
I am building a website which is using a database which will give users access to dynamic information. Once the user has enter user and password, what is the best way of connecting to other pages with MySQL? If I want to use url links to other pages with MySQL how do I parse varibles to other pages including connection to MySQL.

Connect To Mysql?
I have a question. I have installed php and mysql on an apache-server on
windows and I can't connect to the server.

I tried to create a database (since I am trying to learn howto). My manual
said I should write this at the shell:
c:mysqlin>mysqladmin -u root creare mindb

I did this and got this error:
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'

I then tried to use -p and wrote this instead:
c:mysqlin>mysqladmin -p -u root creare mindb

The database was created!

Then I tried to write mysql in cmd at c:mysqlin but I get this error:
Access denied for user 'ODBC'@'localhost' (using password: No)

Why?

I have used earlier versions of mysql and php and got it to work. In earlier
versions "my.ini" looks very different and user and password were written
there, but not anymore. Why, or is it me who have done something wrong? When
I log in to phpmyadmin I have to root-accounts there, one with
host=localhost and one the host=%.

All I want, is to make mysql work, so I can test things and to learn!

My configuration

Windows XP pro

Netgear router (I have opened port 3306)

ADSL

no-ip (For my domain, www.kamrate.se)

Apache 2.2.2

The exe-files are in c:apache2in

(All I did was to fill in domain=localhost, servername=localhost and my
email)

PHP 5.1.4

The exe-files are in c:php

(I used the zip package)

httpd.conf

At the row below "#LoadModule ssl_module modules/mod_ssl.so" I wrote:

LoadModule php5_module "c:/php/php5apache2_2.dll

At the row below "AddType application/x-gzip .gz .tgz" I wrote:

AddType application/x-httpd-php .php

At the row below "DocumentRoot" I wrote:

PHPIniDir "C:/php"

At the row below "DocumentRoot" I wrote:

PHPIniDir "C:/php"

At the row "DirectoryIndex index.html" I wrote:

DirectoryIndex index.htm index.html index.php

My Php Can't Connect The Mysql
A question : why my php can't connect the mysql.

my php version is 5.014 and my mysql version is also 5.0,
but i run them on the windows xp system.
who knows the real problem?

I searched this at google,but I still haven't got the way to deal with
my problem.

How To Connect 2 Strings Together With PHP
I know how to do it in Javascript but its not the same for PHP. What i am trying to do is connect 2 strings together. Like the string "index" and ".php". For javascript, id probably write it like this ...

name = "index";
name2 = ".php";
name3 = name + name2;

that would connect them and put them into one variable. I tried that with PHP but it didnt work.

Using PHP To Connect To Progress V9.1d DB?
Is there anyone out there who has successfully connected to a Progress
DB with PHP and uses this configuration for a mission critical
system...

I am aware that it can be done however I have heard that the ODBC
connection is slow and some of the functions do not owrk anyway...

Can't Connect To Mysql From Php
I can connect in the php by using 'root' and the root pw. But when I
tried adding a user ( sarah ) with GRANT I cannot connect from php. The
php is simple, what am I overlooking? Again putting the root user name
and pw it'll work in php but not for sarah:

the php....
mysql_pconnect("localhost","sarah","camera")
or die("ERROR: Could not connect to database!");
mysql_select_db("howto");

*But* on the command line the sarah user works OK:

C:Documents and SettingsAdministrator>mysql -u sarah -p
Enter password: ******
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 19 to server version: 4.1.3a-beta-nt-max

Type 'help;' or 'h' for help. Type 'c' to clear the buffer.

mysql> select * from howto.page;
+---------+-----------------------------+
| page_id | page_url |
+---------+-----------------------------+
| 1 | http://www.lg.netfarms.org |
+---------+-----------------------------+
1 row in set (0.00 sec)

mysql> show grants for sarah@localhost;
+-----------------------------------------------------------------------------------------------------------------------+
| Grants for sarah@localhost
|
+-----------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'sarah'@'localhost' IDENTIFIED BY
PASSWORD '*6043233C67ADBE7E9242089D718763C3C5E1A1E2' |
+-----------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql>

Cannot Connect To Mysql
I hope you guys can help me out~~~
when I run it localhost/config.php, it cannot display any message such
as connect successfully or failed. Do u guys have any idea?

config.php
<html>
<head><title>Create Database and table</title></head>
<body>

<?php

$linkID = mysql_connect("localhost","","");
print ("hello"); <---can print
Hello

if($linkID != "FALSE") <--i think
fail here
{
print("The connection to the server was made successfully.)";
}
else
{
print("The connection to the server failed");
}

mysql_close($linkID);

?>
</body>
</html>

am I right? do i need to put username and password in
mysql_connect("localhost","","")? i dont know where i can find it, or
how can I find it in mysql.

Trying To Connect To Telnet?
I'm kind of new to php, and i want to connect to telnet on whois.nic.uk port 43
how would i go about doing this?

How Can I Connect Php To Mysql?
im a beginner and student. i want to learn how to connect php to mysql?
just a basic tutorial.

Connect To Ms Access Using Php?
ive already set the odbc in control panel for ms access driver but there is still an error:

Warning: odbc_connect() [function.odbc-connect]: SQL error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified, SQL state IM002 in SQLConnect in C:wampwwwfirst projectmsaccess_conn.php on line 10

Warning: odbc_exec(): supplied argument is not a valid ODBC-Link resource in C:wampwwwfirst projectmsaccess_conn.php on line 17 Error in SQL Code:

Database Connect
I know this is so easy and I am just being retarded but if i created a database in mysql and want to make it accessible to a web page form i created and posted on my site what do i have to do iwth the form to access the db

Connect To Database
i was wondering if anyone knew how to connect to a database and view a table in php what im trying to do is have a php file that will connect to my database and show the info in a table and also have a button to delete a row in the table

Connect To Proxy
I have a page that makes my host send a request to a site, but how would i get my host's server to connect to a proxy that will send the request?

edit: wow just my luck, i have been searching google for days and 10 minutes after i ask somebody, i find what im looking for, in the file_get_contents function page of all place's.

Can I Connect To Two MySQL Databases At Once?
Hi!

Quick question, there wouldn't be any conflicting issues if I connect to two databases at once? Just as long as I use different variables, and field names, right? Thanks lots.

Using Php To Connect To Access Database
First of all I'd like to appologise if this has been posted before, I did try the search, but for some reason instead of result, all I got is a blank screen (did try waiting to see if it was still searching/loading).

I've done some basic php a while ago, but have now been asked to create a php script to query an msaccess database that is running on a WinNT server running IIS.

I've looked around on the internet and have found code similar to the code below. My connection is the name of a system or file ODBC data source. However much I play around with this (such as putting the database path in where "myconnection" is) but I can't seem to get it to connect to the database I get the "Unable to open database" on my page.

<?

$db = 'myconnection'

$conn = new COM('ADODB.Connection');

$conn->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$db") or die ("Unable to access database");

Using PHP To Connect To A Progress Database
I wonder if there is a way to connect to a Progress database using PHP. And if so, how is it done? Does anybody has experience wether this is a good or a bad idea?

Can PHP Connect/use An Access Database?
I was trying to connect to an Access database (something.mdb or something), but I realise I was using the all familiar MySQL way of doing it, so naturally it didn't work..

If PHP can use this mdb files that Access uses, can anyone tell me how I can utilize them.

Connect To SYBASE Database
I have problem connecting to SYBASE database in PHP (connect directly, not thru ODBC). For the time being, I use ODBC to connect to SYBASE using a profile in ODBC setup.
In the php.ini, I see a line in the SYBASE section(;sybase.interface_file= ...) which is commented out.
My question: Any information about how to construct the interface file to fill in information such as: server name, database name, user ID, password?

Trying To Connect PHP4 To Oracle 9.i
I am trying to get PHP4 to work with Oracle 9.i on Suse Linux

I have the DSO version of Apache version 1.3.27 and PHP 4.3.1 Running. I have this setup running successfully with mysql, however I am trying to get it to connect to a Oracle 9.i database.

PHP and Apache came pre-installed with Suse Linux 8.2. When I look at <? Phpinfo ?> I do not see the –with oci8 module installed. Since php came installed with my version of Linux, I do not have the source. I tried downloading the php source and ./configure –with oci8, however , after “make install” it does not show the new module.

Also it appears to be installing some of PHP in different directories from the ones the linux install used.

Is there any other way to get the Oracle module installed without running ./configure? Such as a RPM to install that module? If not what parameters do I need to use with the ./configure?

MS Access DSN For PEAR DB::connect
Does anyone know what DSN I must use to get connected to my MS Access database?

BUSINESS is my OBDC connection on Windows 2000 to my database.

As PHP database type I use 'odbc'.

Please find the enclosed code snipet:

<?php require_once('DB.php');
$dsn = "odbc:///BUSINESS";
// Establish the connection
$db = DB::connect($dsn);
if (DB::isError($db)) {
die ($db->getMessage());
}
?>
When running it, I receive an DB Error: connect failed.
Unfortunately with same result, I tried the following DSN:

$dsn = "odbc:///BUSINESS";
$dsn = "odbc://localhost/BUSINESS";
$dsn = "odbc://administrator@localhost/BUSINESS";
$dsn = "odbc://user@localhost/BUSINESS";
$dsn = "odbc://userassword@localhost/BUSINESS";

Connect To Remote Server
I want to connect To Remote Server through my site done in php.
I got some file but it is in vbscript.
can anyone help me out for this file.


Copyright © 2005-08 www.BigResource.com, All rights reserved