| | |
Login session
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Mar 2008
Posts: 63
Reputation:
Solved Threads: 3
Hello does anyone know how to bring details from a database into a textbox? becuase ive got the login working and it displays whos logged in but i want the postcode to appear in a textbox, the postcode is kept in mysql table called address.
/after connecting to mysql
/after connecting to mysql
php Syntax (Toggle Plain Text)
$query = "SELECT * FROM StudentRecords WHERE Email= '".$myusername."'"; $result = mysql_query($query); <td><input type="text" name="PickupAddressPostCode"</td>
Last edited by peter_budo; Mar 30th, 2008 at 6:19 am. Reason: Keep It Organized - please use [code] tags
•
•
Join Date: Mar 2008
Posts: 154
Reputation:
Solved Threads: 19
PHP Syntax (Toggle Plain Text)
$query = "SELECT address_code FROM address WHERE userID= '".$myuserID."'"; $result = mysql_query($query); <td><input type="text" name="PickupAddressPostCode" value="<?php echo $result['address_code']; ?>" /></td>
Matti Ressler
Suomedia
Last edited by Suomedia; Mar 29th, 2008 at 12:24 pm.
If you want your dreams to come true, the first thing you must do is to wake up....
Suomedia - Dynamic Content Management
Suomedia - Dynamic Content Management
•
•
Join Date: Mar 2008
Posts: 154
Reputation:
Solved Threads: 19
Mark as solved
If you want your dreams to come true, the first thing you must do is to wake up....
Suomedia - Dynamic Content Management
Suomedia - Dynamic Content Management
•
•
Join Date: Mar 2008
Posts: 63
Reputation:
Solved Threads: 3
Its meant to select the postcode from the address table where the email matchs the login name which is myusername. and then display postcode in the textbox. it connects to database but in the textbox what the postcode is meant to appear in it says...
<br /><b>Notice</b>: Undefined variable: result in <b>/home/public_html/book.php</b> on line <b>79</b><br />
<br /><b>Notice</b>: Undefined variable: result in <b>/home/public_html/book.php</b> on line <b>79</b><br />
php Syntax (Toggle Plain Text)
<? $query = "SELECT PostCode FROM address WHERE Email= '".$myusername."'"; $result = mysql_query($query); ?> line 79 is here <td><input type="text" name="PickPostCode" value="<?php echo $result['PostCode ']; ?>" /></td>
Last edited by peter_budo; Mar 30th, 2008 at 6:19 am. Reason: Keep It Organized - please use [code] tags
•
•
Join Date: Mar 2008
Posts: 154
Reputation:
Solved Threads: 19
You need to connect to mySQL, select the database, make the query, fetch the result with mysql_fetch_array() and close the connection.
Matti Ressler
Suomedia
Matti Ressler
Suomedia
If you want your dreams to come true, the first thing you must do is to wake up....
Suomedia - Dynamic Content Management
Suomedia - Dynamic Content Management
•
•
•
•
PHP Syntax (Toggle Plain Text)
$query = "SELECT address_code FROM address WHERE userID= '".$myuserID."'"; $result = mysql_query($query); <td><input type="text" name="PickupAddressPostCode" value="<?php echo $result['address_code']; ?>" /></td>
Matti Ressler
Suomedia
That should actually be
php Syntax (Toggle Plain Text)
$query = "SELECT address_code FROM address WHERE userID= '".$myuserID."'"; $result = mysql_query($query); $row = mysql_fech_array($result); //or while($row = mysql_fetch_array($result)) if your query returns more than 1 row <td><input type="text" name="PickupAddressPostCode" value="<?php echo $row['address_code']; ?>" /></td>
Cheers,
Naveen
Ignorance is definitely not bliss!
*PM asking for help will be ignored*
*PM asking for help will be ignored*
![]() |
Similar Threads
- Updated : Simple ASP.Net Login Page (ASP.NET)
- session (ASP.NET)
- How to direct page to login page (PHP)
- RedHat 8 (*nix Software)
- Netscape 7.1, Hotmail login problem - cookies 'disabled" (Windows NT / 2000 / XP)
- Need Help with login authentication (ColdFusion)
- How to maintain session for Web Services Object? (VB.NET)
- ASP and SQL ? (MS SQL)
- Cannot Login to Mac (OS X)
Other Threads in the PHP Forum
- Previous Thread: Prase error..Pls help.. simple script..
- Next Thread: Updating Profile
| Thread Tools | Search this Thread |
# 5.2.10 ajax apache api array beginner binary broken cakephp checkbox class clean clients cms code cron curl database date display dissertation dynamic echo echo$_get[x]changingitintovariable... email error file files folder form forms function functions google href htaccess html image images include insert integration ip java javascript joomla ldap legislation limit link local login loop mail memberships menu mlm multiple mysql mysqlquery oop open paypal pdf persist php problem query radio random recursion regex remote rss script search server sessions sms soap sockets source space spam sql syntax system table tutorial update upload url validation validator variable video web xml youtube






