help me with this code

hey guys im really new to php and and im trying to learn by mistakes… so i have a php page when im trying to execute it im getting error:
Notice: Undefined variable: acct in C:\xampp\htdocs\banking\register_preview.php on line 8

here is the code
[php]

<?php

include ‘db_connect.php’;
$sql = “SELECT * FROM myacct WHERE acct=’$acct’”;
$result = mysql_query($sql) or die(“SQL select statement failed”);

while ($row = mysql_fetch_array($result)) {
$acct=$row[“acct”];
$card=$row[“card”];
$name=$row[“name”];
$day=$row[“day”];
?>








Welcome to your Banking System!
     
Account Number : <?php echo"$acct"; ?>
Identity Card :
<?php echo"$card"; ?>
Full Name :
<?php echo"$name $pword"; ?>
     
<?php } ?> [/php] plz explain what is going on and how to solve such issues.... im really at beginner level so instead of laughing over my stupidity plz help... :( :(

Hello,

the field acct in your database might not exist. recheck the name of field and fix it.

hi thanks for quick reply…i checked my database and the field acct is existing… not sure what to do…so here is the sql code which i used to create my database…

create Database: bank

CREATE TABLE acct_no (
id int(4) NOT NULL auto_increment,
acct varchar(20) NOT NULL default ‘’,
used varchar(10) NOT NULL default ‘’,
PRIMARY KEY (id),
UNIQUE KEY acct (acct)
)

INSERT INTO acct_no VALUES (1, ‘000-111-1212’, ‘no’);
INSERT INTO acct_no VALUES (2, ‘000-222-1212’, ‘no’);
INSERT INTO acct_no VALUES (3, ‘000-333-1212’, ‘no’);
INSERT INTO acct_no VALUES (4, ‘000-444-1212’, ‘no’);
INSERT INTO acct_no VALUES (5, ‘000-555-1212’, ‘no’);


CREATE TABLE event (
id int(4) NOT NULL auto_increment,
acct varchar(20) NOT NULL default ‘’,
depo int(15) NOT NULL default ‘0’,
event varchar(20) NOT NULL default ‘’,
time varchar(30) NOT NULL default ‘’,
day varchar(30) NOT NULL default ‘’,
PRIMARY KEY (id)
)


CREATE TABLE login (
id int(4) NOT NULL auto_increment,
acct varchar(20) NOT NULL default ‘’,
card varchar(30) NOT NULL default ‘’,
name varchar(30) NOT NULL default ‘’,
pword varchar(80) NOT NULL default ‘’,
role varchar(8) NOT NULL default ‘’,
PRIMARY KEY (id),
UNIQUE KEY acct (acct),
UNIQUE KEY card (card)
)


CREATE TABLE myacct (
id int(4) NOT NULL auto_increment,
acct varchar(20) NOT NULL default ‘’,
card varchar(30) NOT NULL default ‘’,
name varchar(30) NOT NULL default ‘’,
depo int(15) NOT NULL default ‘0’,
day varchar(30) NOT NULL default ‘’,
PRIMARY KEY (id),
UNIQUE KEY acct (acct),
UNIQUE KEY card (card)
)

nahh sure what is going i will debug on my localhost.

pack the sql along php files into a zip and email it to me i private messaged you my email

thank you so much for ur help…well actually the above code is part of a few interconnected pages of banking system webpage so should i post the whole pack???

only all the necessary files to make it work on my pc

dont include any sensitive information like password ect

mail sent…nothing sensitive in this…its just a educational project typ banking site…plz take a look

srry to butt in
$acct var is not set it has no value so you cannot get the query to work

right, so in your register_review.php put this
[php]
$acct = $_GET[‘acct’];
$sql = “SELECT * FROM myacct WHERE acct=’$acct’”;
[/php]

u must pass the account number when you link to that file like

[php]
<href=‘register_revie.php?$acctno’>register_review
[/php]

for instance if you visit register_review.php like this

register_preview.php?acct=000-111-1212

it will work

Sponsor our Newsletter | Privacy Policy | Terms of Service