•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 427,167 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,024 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MySQL advertiser: Programming Forums
Views: 1938 | Replies: 5
![]() |
•
•
Join Date: Mar 2005
Posts: 4
Reputation:
Rep Power: 0
Solved Threads: 0
Okay, not new to MySQL, or PHP, but I'm really lost on this one. I have a query (simple one really) that is supposed to return the requested values from a database. I've tested the query with MySQL direct and it works fine, but when used via the web interface, it chokes and doesn't get a valid result resource.
I don't understand how a valid query can work with MySQL directly but not with the web interface. I've added the query below:
SELECT GUID, FirstName, LastName, Address, Address1, City, State, Zip, Phone, Email, Company, Remove FROM databasename WHERE GUID = '$id'
$id would of course be a POSTed variable. I've also tried this using "SELECT * from databasename" and it also fails for the same reason. Of course, my first thought was something simple so I pasted a working query from another function and it also failed. Nothing is any different for the connection as it's the only one used. And yes, all the column names are correct.
What am I missing?
thx,
Plenty
I don't understand how a valid query can work with MySQL directly but not with the web interface. I've added the query below:
SELECT GUID, FirstName, LastName, Address, Address1, City, State, Zip, Phone, Email, Company, Remove FROM databasename WHERE GUID = '$id'
$id would of course be a POSTed variable. I've also tried this using "SELECT * from databasename" and it also fails for the same reason. Of course, my first thought was something simple so I pasted a working query from another function and it also failed. Nothing is any different for the connection as it's the only one used. And yes, all the column names are correct.
What am I missing?
thx,
Plenty
•
•
Join Date: Oct 2004
Location: San Francisco, CA
Posts: 338
Reputation:
Rep Power: 4
Solved Threads: 2
perhaps you are not logged in with the correct username/password combination
if you do have a correct user name/password then...
maybe the one you have doesn't have access to SELECT statments on that database and/or table
try doing this...
hopefully the error message generated gives you enough information to solve your problems. try usign localhost for your host name instead of your domain name.
if you do have a correct user name/password then...
maybe the one you have doesn't have access to SELECT statments on that database and/or table
try doing this...
<?
$server = "localhost";
mysql_connect ($server, $user, $password) or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ($database) or die ("cannot connect to the datbase");
$result = mysql_query("SELECT * FROM databasename");
if ($result == 0)
{
echo("<b>Error " . mysql_errno() . ": " . mysql_error() . "</b>");
}
else
{
echo "the query worked!";
}hopefully the error message generated gives you enough information to solve your problems. try usign localhost for your host name instead of your domain name.
•
•
Join Date: Mar 2005
Posts: 4
Reputation:
Rep Power: 0
Solved Threads: 0
Actually, I use the same connection for all the queries so that rules out the incorrect login/password. Further, I've tried successfully used the query against the database directly, as well as taken other queries known to be good and tried them, but they all fail just in this block of code.
I had also tried as you suggested, but result is actually "1" afterwards, shouldn't it be "Resource ID#x"?? I'll still go back and try again, but I'm not to hopeful...
I know I'm missing something, but I just can't seem to get it.
Thanks.
I had also tried as you suggested, but result is actually "1" afterwards, shouldn't it be "Resource ID#x"?? I'll still go back and try again, but I'm not to hopeful...
I know I'm missing something, but I just can't seem to get it.
Thanks.
![]() |
•
•
•
•
•
•
•
•
DaniWeb MySQL Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- sql query problem with MS Access and C# (C#)
- Select Query Problem in access (MS Access and FileMaker Pro)
- query problem (delimiter?) (PHP)
- SQL query problem with WHERE clause (ASP)
- MySql multiple table query problem.... (MySQL)
- query problem (MySQL)
- Problem with font in Word 2003 (Windows Software)
Other Threads in the MySQL Forum
- Previous Thread: Inserting special characters & superscript
- Next Thread: Query Code


Linear Mode