|
|
|
|
![]() ![]() |
Apr 22 2006, 02:45 PM
Post
#1
|
|
|
Premium Member Group: Members Posts: 302 Joined: 23-February 06 From: Northeastern Connecticut USA Member No.: 11,487 |
I am new to MySql and have just created a database after using a script. My problem is not the script, but what it says about putting it into the output file. I cant figure out the right terms to put it in, I keep getting errors. I try using; SELECT*FROM 'database name' WHERE 'location' but it isnt working. I'm lost with this stuff, I really am. Can someone please help me out?
|
|
|
|
Apr 22 2006, 03:32 PM
Post
#2
|
|
|
Super Member Group: Members Posts: 572 Joined: 25-April 05 From: Nashville Tennessee Member No.: 4,340 |
I am assuming that you are using a GUI like maybe phpMyAdmin so you want to select all rows from a database name then you have a where clause but nothing for the WHERE clause to work with
QUOTE SELECT*FROM 'database name' WHERE 'location' Where location equls whatdo not put quotes around the database name or the field name you do put them around values like so CODE SELECT * FROM testdatabase WHERE location = '$somevariable' if you are using php you would use CODE $query="SELECT * FROM testdatabase WHERE location = '$somevariable'";// or location ='My Home Town' Does that help any?
$result=mysql_query($query) or die("Could not execute query".mysql_error()); |
|
|
|
Apr 22 2006, 03:41 PM
Post
#3
|
|
|
Premium Member Group: Members Posts: 302 Joined: 23-February 06 From: Northeastern Connecticut USA Member No.: 11,487 |
I did what you said and this is what it came up with, no error message, so I'm not sure if I did it right:
MySQL returned an empty result set (i.e. zero rows). (Query took 0.0005 sec) SQL query: SELECT * FROM cscp_mojt_prefs WHERE 'admin.php' LIMIT 0 , 30 The cscp... is the database I made and admin.php is where I wanted it to go. Does this look correct to you? |
|
|
|
Apr 22 2006, 03:46 PM
Post
#4
|
|
|
Newbie [ Level 1 ] Group: Banned Posts: 3 Joined: 22-April 06 Member No.: 12,934 |
I am new to MySql and have just created a database after using a script. My problem is not the script, but what it says about putting it into the output file. I cant figure out the right terms to put it in, I keep getting errors. I try using; SELECT*FROM 'database name' WHERE 'location' but it isnt working. I'm lost with this stuff, I really am. Can someone please help me out? when i look at your post it seems like, you are very very new to mysql right? no offense intended, iam quite new to it too i thin when you said SELECT*FROM 'database name' WHERE 'location', you are try ing to access the database? correct? because 'database name' is not a parameter of SELECT CLAUSE so is 'location' if you are trying to access the database use there command in mysql console command CODE use your_database_name; Select * from your_table_name WHERE link = '$your_search_parameter'; in php CODE $host = "your_hostname"; $user = "your_userid"; $pass = "your_password"; $db = "your_Database_name"; $connection = mysql_connect($host, $user, $pass) or die ("Unable to connect 1!"); mysql_select_db($db) or die ("Unable to select database!"); $query = "Select * from your_table_name WHERE link = '$your_search_parameter'"; there you go ^^ Regards Coffeemug |
|
|
|
Apr 22 2006, 03:53 PM
Post
#5
|
|
|
Premium Member Group: Members Posts: 302 Joined: 23-February 06 From: Northeastern Connecticut USA Member No.: 11,487 |
No, actually I'm trying to get the typed in answers given to the database to go to 'admin.php'. I'm not looking to access the database with that script. And yes I am VERY new to this, no offence taken. What this is, is a login script that I downloaded, so the results from the database need to go to an admin file. But thanks for that info.
|
|
|
|
Apr 22 2006, 03:58 PM
Post
#6
|
|
|
Newbie [ Level 1 ] Group: Banned Posts: 3 Joined: 22-April 06 Member No.: 12,934 |
SELECT *
FROM cscp_mojt_prefs WHERE 'admin.php' LIMIT 0 , 30 like i said SELECT clause do not use database name as parameter... and why do you need admin.php in where clause? are you at all familiar with SQL ? or is this your first time using SQL? may i ask what do you wish to accomplish with those commands? |
|
|
|
Apr 22 2006, 10:16 PM
Post
#7
|
|
|
Premium Member Group: Members Posts: 302 Joined: 23-February 06 From: Northeastern Connecticut USA Member No.: 11,487 |
O.K. you caught me, this is my first time using SQL. Anyway, what I was trying to do was make sure the info input into the database named 'csps....' went to the 'admin.php' file. As I said, this is a login script I got, so what it is essentially doing is getting the users name, email, etc..., and that info would go to my admin file to keep track of. Hope that helps.
|
|
|
|
Apr 23 2006, 12:59 AM
Post
#8
|
|
|
Super Member Group: Members Posts: 572 Joined: 25-April 05 From: Nashville Tennessee Member No.: 4,340 |
If you are connected to your database then all you need to do to see all the tables that are in that database,
CODE SHOW TABLES If you do have tables that have been created then to see all the rows that are in those tables just do QUOTE SELECT * FROM tableName
|
|
|
|
Apr 23 2006, 03:25 AM
Post
#9
|
|
|
Premium Member Group: Members Posts: 302 Joined: 23-February 06 From: Northeastern Connecticut USA Member No.: 11,487 |
I don't understand why you are telling me to show the database. I'm using a script that has a specific data form that goes with the database I just made that is in the admin.php folder. That is why I want the data in the database to go to the admin.php folder when it is calculated.
|
|
|
|
Apr 23 2006, 03:01 PM
Post
#10
|
|
|
the Q Group: [HOSTED] Posts: 1,051 Joined: 13-July 05 From: Lithuania, Vilnius Member No.: 7,059 |
I read all of your problems and still don't really understand what you're trying to do, others I think does not understand too. So I assume You have a database with a table and all the infos for your login script, so you want that people could login by using admin.php ? If so when write a script into it and when you fetch all the stuff, check the pass and user-name and let him login or else show some other page. ??? and admin.php is a file or a folder/directory ?
|
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 11th October 2008 - 03:01 PM |