Sponsored Content
Special Forums UNIX and Linux Applications Virtualization and Cloud Computing Problems with PHP query to MySQL database Post 302378058 by hero132 on Sunday 6th of December 2009 08:40:43 PM
Old 12-06-2009
Problems with PHP query to MySQL database

Hello all,
I completed a website (it was code by php) and putted it to AWS, I install fedora instance in EC2 with the base is php and mysql.
I putted all files of my website to folder /home/webuser/helloworld/htddocs and my database (mysql) to folder /var/lib/mysql/test ("test" is my database's name).
I connect to database by a php file that is successful and its code is:

Code:
<?php # mysql_connect.php 
DEFINE ('DB_USER', 'root'); 
DEFINE ('DB_PASSWORD', 'ab2345'); 
DEFINE ('DB_HOST', 'root@localhost'); 
DEFINE ('DB_NAME', 'test'); 
# Connect to MYSQL 
$dbc = @mysql_connect (DB_HOST, DB_USER, DB_PASSWORD) OR die ('Could not connect to MYSQL:' .mysql_error()); 
mysql_select_db (DB_NAME) OR die ('Could not select the database:' .mysql_error()); 
?>

I made query commands to my database in PuTTY succesful and had data at output

But when I make query commands to database in php files (code by php) then didn't output, it is nothing. I don't know why, I searched more it in Internet but I didn't still find, I hope you can help me.
Thanks,

Last edited by pludi; 12-07-2009 at 02:14 AM.. Reason: code tags, please...
 

4 More Discussions You Might Find Interesting

1. Programming

How to query one to many mysql

Hi there, I have a hierarchical database that include 4 tables. Table A is the parent of B, B is Parent of C, C is parent of D. If I want to query everything in D that is associated with A.name, how do I do that? Thanks! YanYan (0 Replies)
Discussion started by: pinkgladiator
0 Replies

2. Web Development

mysql query help

hello all i have 2 columns every column in the following format column1 2011-04-01 11:39:54 column2 2019-02-03 00:00:00 i want get difference between above data as following 2 days 11:39 how to do so ? i tried many functions but nothing works please advice what is the query... (6 Replies)
Discussion started by: mogabr
6 Replies

3. Linux

PHP is not execute the query from mysql in Linux

Hi , I have ran the php script from Linux box. It is running, But I can able to see any html content. There is no mysql data on that page. I have checked . 1) Mysql and data bases are connected successfully. Please help and guild me If I missed any think during the configuration. ... (13 Replies)
Discussion started by: Mani_apr08
13 Replies

4. Programming

Need help in mysql query

Hi All, i have a table in mysql with the following data Table name Test Assettype Serial_No Status location Mouse 123456 In Stock chennai Mouse 98765 Allocated chennai Keyboard ... (2 Replies)
Discussion started by: venkitesh
2 Replies
MSSQL_GET_LAST_MESSAGE(3)												 MSSQL_GET_LAST_MESSAGE(3)

mssql_get_last_message - Returns the last message from the server

SYNOPSIS
string mssql_get_last_message (void ) DESCRIPTION
Gets the last message from the MS-SQL server PARAMETERS
This function has no parameters. RETURN VALUES
Returns last error message from server, or an empty string if no error messages are returned from MSSQL. EXAMPLES
Example #1 mssql_get_last_message(3) example <?php // Connect to MSSQL and select the database mssql_connect('KALLESPCSQLEXPRESS', 'sa', 'phpfi'); mssql_select_db('php'); // Make a query that will fail $query = @mssql_query('SELECT * FROM [php].[dbo].[not-found]'); if (!$query) { // The query has failed, print a nice error message // using mssql_get_last_message() die('MSSQL error: ' . mssql_get_last_message()); } ?> The above example will output something similar to: MSSQL error: Invalid object name 'php.dbo.not-found'. SEE ALSO
mssql_min_error_severity(3), mssql_min_message_severity(3). PHP Documentation Group MSSQL_GET_LAST_MESSAGE(3)
All times are GMT -4. The time now is 11:12 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy