Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

error in code!!!

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

error in code!!!

Postby wckf » Fri Mar 29, 2013 5:54 am

<?php
require 'connect.inc.php';



if(isset($_POST["id"])){
$id = $_POST["id"];}


if (!empty($id)){
$query = "SELECT * FROM customers WHERE id = $id ";
if ($query_run = mysql_query($query)){
while ($query_row = mysql_fetch_assoc($query_run)){
$fname = $query_row['fName'];
$Email = $query_row['Email'];
$PNumber = $query_row['PNumber'];
$Address = $query_row['Address'];

echo $fname. '<br>';
echo $Email. '<br>' ;
echo $PNumber. '<br>';
echo $Address. '<br>';
}

}
else{echo mysql_error();}

}
?>
</body>
</html>







the code is returning the address phone number and the email but the name is giving me and notice: unidentified index !! thanks !
wckf
New php-forum User
New php-forum User
 
Posts: 15
Joined: Wed Mar 27, 2013 7:59 am

Re: error in code!!!

Postby seandisanti » Fri Mar 29, 2013 7:14 am

verify the name of the column is fName in your database, and that you don't have one without a value for the name
seandisanti
php-forum Fan User
php-forum Fan User
 
Posts: 838
Joined: Mon Oct 01, 2012 12:32 pm

Re: error in code!!!

Postby wckf » Fri Mar 29, 2013 7:47 am

the name is fName and i have no one without the value of the name !!!
wckf
New php-forum User
New php-forum User
 
Posts: 15
Joined: Wed Mar 27, 2013 7:59 am

Re: error in code!!!

Postby seandisanti » Fri Mar 29, 2013 7:56 am

the error means that it's not finding a field with that name in the result set.
seandisanti
php-forum Fan User
php-forum Fan User
 
Posts: 838
Joined: Mon Oct 01, 2012 12:32 pm

Re: error in code!!!

Postby wckf » Fri Mar 29, 2013 8:01 am

i also created another database and called the field name the same thing happened !!!
wckf
New php-forum User
New php-forum User
 
Posts: 15
Joined: Wed Mar 27, 2013 7:59 am


Return to PHP coding => General

Who is online

Users browsing this forum: Google [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.