Welcome Guest ( Log In | Register )



2 Pages V   1 2 >  
Reply to this topicStart new topic
> MySQL Output Database Question
lonebyrd
post Apr 22 2006, 02:45 PM
Post #1


Premium Member
Group Icon

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?
Go to the top of the page
 
+Quote Post
Houdini
post Apr 22 2006, 03:32 PM
Post #2


Super Member
Group Icon

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 what
do 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'
$result=mysql_query($query) or die("Could not execute query".mysql_error());
Does that help any?
Go to the top of the page
 
+Quote Post
lonebyrd
post Apr 22 2006, 03:41 PM
Post #3


Premium Member
Group Icon

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?
Go to the top of the page
 
+Quote Post
coffeemug
post Apr 22 2006, 03:46 PM
Post #4


Newbie [ Level 1 ]
Group Icon

Group: Banned
Posts: 3
Joined: 22-April 06
Member No.: 12,934



QUOTE(lonebyrd @ Apr 22 2006, 02:45 PM) *

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 laugh.gif

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
Go to the top of the page
 
+Quote Post
lonebyrd
post Apr 22 2006, 03:53 PM
Post #5


Premium Member
Group Icon

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.
Go to the top of the page
 
+Quote Post
coffeemug
post Apr 22 2006, 03:58 PM
Post #6


Newbie [ Level 1 ]
Group Icon

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?
Go to the top of the page
 
+Quote Post
lonebyrd
post Apr 22 2006, 10:16 PM
Post #7


Premium Member
Group Icon

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.
Go to the top of the page
 
+Quote Post
Houdini
post Apr 23 2006, 12:59 AM
Post #8


Super Member
Group Icon

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
Go to the top of the page
 
+Quote Post
lonebyrd
post Apr 23 2006, 03:25 AM
Post #9


Premium Member
Group Icon

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.
Go to the top of the page
 
+Quote Post
Quatrux
post Apr 23 2006, 03:01 PM
Post #10


the Q
Group Icon

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 ? smile.gif
Go to the top of the page
 
+Quote Post

2 Pages V   1 2 >
Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. MySQL - Trouble With Bulk Insert Statements(3)
  2. MySQL Realtime Replication(4)
  3. Recover Tables From A MySQL .frm File(8)
  4. Mirror My MySQL Database To Another Mysql Server(4)
  5. How To Connect MySQL With Flash?(8)
  6. MySQL, Multiple Tables(24)
  7. Navcat For MySQL(9)
  8. Mysql And Php(15)
  9. Login System Using A Mysql Db(5)
  10. Mysql - So Hard(14)
  11. Database(1)
  12. Sun Bought Mysql(6)
  13. Integrate Access Database Onto Intranet Site(5)
  14. Mysql Backup With Another Address?(4)
  15. I Have An Error With My Mysql Connection(7)
  1. Accessing Ms Access Database From A Centralized Location?(5)
  2. Mysql And User File_priv(0)
  3. Mysql Database Management(1)
  4. Mysql Database Entry By Excel Sheets(2)
  5. Mysql On Computer(9)
  6. Space Needed For Database(10)
  7. Database Access On Remote Server W/jsp(0)
  8. Any Website Provide Free Host Mysql Host?(4)
  9. Mysql Multiple Tables(1)
  10. Some Useful Database Links.(7)
  11. Best Database(7)
  12. How To Understand A Database Schema(4)
  13. Mysql Overhead(3)


 



- Lo-Fi Version Time is now: 11th October 2008 - 03:01 PM