473,385 Members | 1,317 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Query/confusion

I am getting this error:
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/xxxxx/public_html/login.php on line 164
Couldn't execute select query.

from this code:
Expand|Select|Wrap|Line Numbers
  1. $sql = "SELECT loginname FROM member 
  2.          WHERE loginname = '$loginname'";  
  3. $result = mysql_query($con,$sql) // <-- Line 164
  4.              or die("Couldn't execute select query.");
  5. $num = mysql_num_rows($result);                 
  6. if ($num > 0)                                    
  7. {
  8.     $message_new = "$loginname already used. 
  9.     Select another User Name.";
  10.     include("index.php");
  11.     exit();
  12.  }
  13.  
A connection to the DB was established earlier, I am just using this to make sure the new user is not using an existing name.
May 29 '07 #1
2 1155
is the "include" statement wrong? im not sure if the index.php belongs there
May 29 '07 #2
Atli
5,058 Expert 4TB
Hi.

It looks like you switched the parameters for the mysql_query() function.
Expand|Select|Wrap|Line Numbers
  1. // Should be
  2. mysql_query($SQL, $connection);
  3.  
  4. // Rather than
  5. mysql_query($connection, $SQL);
  6.  
The mysqli_query() function, however, takes the parameters in reverse order.
May 30 '07 #3

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

Similar topics

3
by: David McManus | last post by:
I am trying to use a query to filter SQL Server 2000 records by a date value. Here is relevant columns in my database table (tblContent): title starting .... and here is my query: Query...
0
by: Dave | last post by:
Hi all, I have a problem with a query. (well, I actually have a few problems...) Here is my query. select FOCUS.SiteName, FOCUS.URL, OTWAdCars.* , REGION.SiteName as RegionSite, REGION.URL...
2
by: Pete | last post by:
Before I get started with the question, does anyone have a (single) good book recommendation for database design? Not an Access-specific book, but something geared toward helping me figure out...
12
by: Joe Stanton | last post by:
Hello Group I have a query that works in Oracle and SQL Server, but fails in Microsoft Access. The query is: SELECT data fromTABLE1 WHERE data>='A&' AND data<'A''' Here is my sample data:
4
by: Shahzad | last post by:
dear respected gurus, I would like to knew how to apply append,insert query for a self table where no primary keys issues. i do have problem say there are 5 rows of single record, this is data...
5
by: Lyn | last post by:
This one is difficult to explain, so I will cut it down to the basics. I have a major table 'tblA' which has an autonum field 'ID-A' as primary key (of no significance to users). 'tblA' contains...
3
by: c tom | last post by:
id name location 1 tom new york 2 jeny sicago 3 tom new york 4 luca sidney 5 luca sidney i want to make below table using query. id name location
5
by: elitecodex | last post by:
Hey everyone. I have this query select * from `TableName` where `SomeIDField` 0 I can open a mysql command prompt and execute this command with no issues. However, Im trying to issue the...
3
by: Thorben Grosser | last post by:
Hello Newsgroup, I am doing some archive database and therefore got one table indexing every folder and one table storing which rack belongs to which department, eg: table folders :...
3
by: pbd22 | last post by:
Hi. I need some help with structuring my query strings. I have a form with a search bar and some links. Each link is a search type (such as "community"). The HREF for the link's anchor looks...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.