Search
Left Quote    By failing to prepare, you are preparing to fail.
- Benjamin Franklin    
Right Quote
 
[login] | [Register]
Forum Index » PHP and mySQL » Viewing Topic and Replies
Post Reply


        Viewing Topic: member system - register.php what about db_connect.php $tabl
  This user is offline  drew
  Subject: "member system - register.php what a..." Posted: @ 11:33 pm on Dec 03 2005   
Member #: 112
Rank: User - (4)
Since: 12/03/05
Posts: 4

we specified a table in db_connect.php, but we don't use it in register.php, should we use it instead of hardcoding the table name into the page?

ie:
$q2 = mysql_query(&qu ot;SELECT * FROM 'members' WHERE 'username' = '".$_POST[ 'username'].&qu ot;'";

changed to
$q2 = mysql_query(&qu ot;SELECT * FROM '"$table&q uot;' WHERE 'username' = '".$_POST[ 'username'].&qu ot;'";

Edited at 11:34:54 pm on 12/03/05


    Viewed: 7,640 Times | Reply to This | To top
  This user is online  Guest
  Subject: "re: member system - register.php wh..." Posted: @ 11:55 pm on Dec 03 2005    
Unregistered

if you choose. doesnt matter. you dont have to specify a table in db_connect.



    Viewed: 7,630 Times | Reply to This | To top
  This user is offline  drew
  Subject: "member system - register.php what a..." Posted: @ 11:35 pm on Dec 03 2005    
Member #: 112
Rank: User - (4)
Since: 12/03/05
Posts: 4

In db_connect.php we have a variable called $table which should be the name of the table where the user information is stored. Why not use that variable throughout register.php?
$q2 = mysql_query(&q uot;SELECT * FROM 'members' WHERE 'username' = '".$_POS T['username'] ."'&quo t;

changed to:

$q2 = mysql_query(&q uot;SELECT * FROM '"$table "' WHERE 'username' = '".$_POS T['username'] ."'&quo t;




    Viewed: 7,628 Times | Reply to This | To top
  This user is offline  bs0d
  Subject: "re: member system - register.php wh..." Posted: @ 4:33 pm on Dec 04 2005    

Member #: 1
Rank: Admin. - (1,505)
Since: 02/06/05
Posts: 600
From: USA

give it a try. But what if you need to connect to a different table? i would just specify the table name in the query instead of using the variable.




-bs0d | AllSyntax.com

    Viewed: 7,621 Times | Reply to This | To top
Viewing Page: 1 of 1


1 |

You must be logged in to post on the forums. Login or Register








"AllSyntax.com" Copyright © 2002-2018; All rights lefted, all lefts righted.
Privacy Policy  |  Internet Rank