Welcome Guest ( Log In | Register )



2 Pages V  < 1 2  
Reply to this topicStart new topic
> MySQL Output Database Question
yordan
post Apr 23 2006, 05:04 PM
Post #11


Way Out Of Control - You need a life :)
Group Icon

Group: [MODERATOR]
Posts: 2,242
Joined: 16-August 05
Member No.: 7,896
myCENTs:56.55



QUOTE
I read all of your problems and still don't really understand what you're trying to do

@Quatrux : You don't understand because you could not figure how really he is beginning.
@lonebyrd : you don't select from a database. A database contains several tables. And the "select" instruction is the way of seing what is inside a table.
So, you must first know what tables are in your database, and then "select" to see what is inside a given table.
To see the names of the tables already created in your database, you type "show tables", exactly as Houdini told you. when you know the names of the tables inside your database, you type "select * from " in order to list the whole content of a table inside your database.
You cannot directly see the whole content of your database, you must first see the names of all the tables inside your database, and then you can look the full content of each table using the "select" syntax.
Hope this helped.
Don't hesitate to come back is it's still not clear.
Regards
Yordan
Go to the top of the page
 
+Quote Post
lonebyrd
post Apr 23 2006, 07:05 PM
Post #12


Premium Member
Group Icon

Group: Members
Posts: 302
Joined: 23-February 06
From: Northeastern Connecticut USA
Member No.: 11,487



O.K. Let me see. If you have a registration/login script where users sign-up with certain info, that info needs to be stored somewhere, right. Well, when I downloaded this registration/login script it came with all sorts of folders/files, and one of the files was called admin.php. Admin.php is where, according to the script I downloaded, all of the input info was to be stored.

So essentially, what I was trying to do, was make sure all the info that was input into my registration/login area of my site, which has a database name 'cscp...' table 'prefrences', would be stored in the admin.php file to be retrieved when I need it.

If that doesn't help then I don't know what to do. I don't know how to make registration/login pages. If someone knows a better way to store the database info for user info, let me know.
Go to the top of the page
 
+Quote Post
Houdini
post Apr 23 2006, 08:53 PM
Post #13


Super Member
Group Icon

Group: Members
Posts: 572
Joined: 25-April 05
From: Nashville Tennessee
Member No.: 4,340



OK I think I kind of have a handle on what is going on here. Your script admin.php will present a form with a couple of fields in it like a username field and a passowrd field and then a submit button of some sort. This form will have an action attribute that will tell the script what page to go to next (possibly even itself). It will also have a method of either POST or GET (normally POST) but that doesn't matter. The script either within the admin.php or the page that it goes to will look to see if the user has pressed the submit button and will then take the POST or get values and then check with the database to see if that person already exists. If they do exist and the password is correct the user will be sent to a new page where member are allowed, other wise the form will be re-presented with an explaination that either the username and'or password is wrong and to correct it or to register.

To perform this the script would have to connect to the database server, then the script must select the database that contains the information desired. This is done with PHP and MySQL queries kind of like below;
CODE
$host="localhost"; //or whatever on astahost this will work
$user="yourUserName"; // Your username here
$pass="YourPassword": // Your password here
$connect = mysql_connect($host,$user,$pass)
  or die("Could not connect to server".mysql_error());// Connect to the server or quit on fail with a message
$db = mysql_select_db('cscp',$connect)
  or die("Could not select the cscp database".mysql_error());// Select the Database cscp
$query = "SELECT username, password FROM preferences WHERE username = '$username'";//$username from form
$result = mysql_query($query,$connect) //execute the query
  or die("Query failed MySQL said '.mysql_error();
$rows=mysql_num_fields($result);
if($rows == 2){
//do something because the query found someones username and password (2 fields), send them to the members area with a header
  header("Location: member.php");
}
else{
//make them leave or become a member send them there with a header
  header("Location: registration.php");
}


This post has been edited by Houdini: Apr 24 2006, 12:21 AM
Go to the top of the page
 
+Quote Post
yordan
post Apr 24 2006, 04:44 PM
Post #14


Way Out Of Control - You need a life :)
Group Icon

Group: [MODERATOR]
Posts: 2,242
Joined: 16-August 05
Member No.: 7,896
myCENTs:56.55



QUOTE
Admin.php is where, according to the script I downloaded, all of the input info was to be stored.

I'm afraid you are confusing two things.
The info is not stored inside admin.php
the info is stored in a table.
admin.php is the program that puts or retrieves the data from the table.
And the table is in the database.
So, lonebyrd, you have to first understands that you have a database, inside the database you have tables, the date are inside the tables, and the php files are programs allowing to add, remove, display or delete the data which are inside the tables.
Go to the top of the page
 
+Quote Post
CaptainRon
post Apr 24 2006, 07:52 PM
Post #15


Premium Member
Group Icon

Group: Members
Posts: 238
Joined: 9-September 05
Member No.: 8,400



lonebyrd,

can u please give us link to the script that you downloaded?

guys,
i believe admin.php is NOT the input form, but the administrative panel from where you can see who all have registered, logged in.. etc.

Lonebyrd gets confused because may be the Readme.txt tells that the stored values can be accessed from admin.php

See lonebyrd, its not 'practical' to access stored records from an SQL statement directly. The script you downloaded may be having the admin.php file as the "access point" of the stored information.

Now what you need to do is, type the following into your browser:
http://<your_web_path>/admin.php
where <your_web_path> is the location of the uploaded php scripts. Once the admin.php script executes, it might ask you for some admin user name and password (that you must be knowing :-). Once you log in, you can click your way around for accessing Registration data.
Go to the top of the page
 
+Quote Post
Houdini
post Apr 25 2006, 03:13 AM
Post #16


Super Member
Group Icon

Group: Members
Posts: 572
Joined: 25-April 05
From: Nashville Tennessee
Member No.: 4,340



CODE
Admin.php is where, according to the script I downloaded, all of the input info was to be stored

It is possible that stored and saved are causing confusion, I think of storing as putting something into the database but saving is what I do with a file. I might edit the file and then save the changes. It might be possible that the admin.php of this script contains the database connection data even though usually it would be in an include file like config.php or db.php possibly something along those lines.

Probably after seeing the code i question it would be easier to determine just what lonebyrd is talking about and be better able to assist in any questions about the script and what it is supposed to be doing.
Go to the top of the page
 
+Quote Post
CaptainRon
post Apr 25 2006, 09:46 PM
Post #17


Premium Member
Group Icon

Group: Members
Posts: 238
Joined: 9-September 05
Member No.: 8,400



see its perfectly logical to believe that admin.php is just some sort of control panel. since the script is a downloaded one, every php developer keeps logical names of their files, and in this case, admin.php is a logical backend access name.

If we could get the source of the script, or incase lonebyrd could post the script somehow, we could infer what the file is trying to do.
Go to the top of the page
 
+Quote Post
vhortex
post May 19 2006, 07:11 PM
Post #18


Guilty Until Proven Innocent
Group Icon

Group: Members
Posts: 372
Joined: 13-April 05
Member No.: 3,937



QUOTE(yordan @ Apr 25 2006, 12:44 AM) *

I'm afraid you are confusing two things.
The info is not stored inside admin.php
the info is stored in a table.
admin.php is the program that puts or retrieves the data from the table.
And the table is in the database.
So, lonebyrd, you have to first understands that you have a database, inside the database you have tables, the date are inside the tables, and the php files are programs allowing to add, remove, display or delete the data which are inside the tables.


hey i got your point, i will post the solution later since i got very custom to using my wrapper in accessing the database. For awhile here is what he needs to do so that all of you can understand.

He wants to select a certain group of data in the database and he wants to display the data to admin.php

what you need to do is to capture the result set and store the values in it using indexes to the result set.

--

"hard to solve simple questions if we have been used to solved complex problems.."
=)


Go to the top of the page
 
+Quote Post
iGuest
post Aug 18 2008, 09:41 PM
Post #19


Newbie [ Level 1 ]
Group Icon

Group: Members
Posts: 0
Joined: 1-November 07
Member No.: 25,869



Field name does not appear at the php mysql output
MySQL Output Database Question

Hello,

I have installed Apache2Triad in Vista. Created table and a php script to see my table data. Php output shows table data but it does not show the field names !

Could you please help me about this.

Thanks.

Murshed

-question by Murshed
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. MySQL, Multiple Tables(24)
  6. Navcat For MySQL(9)
  7. Mysql And Php(15)
  8. Login System Using A Mysql Db(5)
  9. Mysql - So Hard(14)
  10. Sun Bought Mysql(6)
  11. Integrate Access Database Onto Intranet Site(5)
  12. Mysql Backup With Another Address?(4)
  13. I Have An Error With My Mysql Connection(7)
  14. Accessing Ms Access Database From A Centralized Location?(5)
  15. Mysql And User File_priv(0)
  1. Mysql Database Management(1)
  2. Mysql Database Entry By Excel Sheets(2)
  3. Mysql On Computer(9)
  4. Space Needed For Database(10)
  5. Database Access On Remote Server W/jsp(0)
  6. Any Website Provide Free Host Mysql Host?(4)
  7. Mysql Multiple Tables(1)
  8. Some Useful Database Links.(7)
  9. Best Database(13)
  10. How To Understand A Database Schema(4)
  11. Mysql Overhead(3)
  12. Free Or Opensource Database/schema Browser?(6)
  13. Login System(6)


 



- Lo-Fi Version Time is now: 5th December 2008 - 05:15 PM