|
|
|
|
![]() ![]() |
Apr 23 2006, 05:04 PM
Post
#11
|
|
|
Way Out Of Control - You need a life :) 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 |
|
|
|
Apr 23 2006, 07:05 PM
Post
#12
|
|
|
Premium Member 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. |
|
|
|
Apr 23 2006, 08:53 PM
Post
#13
|
|
|
Super Member 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 |
|
|
|
Apr 24 2006, 04:44 PM
Post
#14
|
|
|
Way Out Of Control - You need a life :) 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. |
|
|
|
Apr 24 2006, 07:52 PM
Post
#15
|
|
|
Premium Member 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. |
|
|
|
Apr 25 2006, 03:13 AM
Post
#16
|
|
|
Super Member 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. |
|
|
|
Apr 25 2006, 09:46 PM
Post
#17
|
|
|
Premium Member 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. |
|
|
|
May 19 2006, 07:11 PM
Post
#18
|
|
|
Guilty Until Proven Innocent Group: Members Posts: 372 Joined: 13-April 05 Member No.: 3,937 |
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.." =) |
|
|
|
Aug 18 2008, 09:41 PM
Post
#19
|
|
|
Newbie [ Level 1 ] 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 |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 5th December 2008 - 05:15 PM |