I was hoping to have to go there with adding anything as I am never sure if I am doing the right thing. However I keep getting this message when I add data to my db.
As a newbie I am not sure what I am doing wrong I went to php.net and thought I was onto something but each day I prove to be a newbie.
I know it is something so easy but I am missing it.
:queasy:
can not get id
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/ebermy5/public_html/login.php on line 43
this is my coding
<?php
ini_set ("display_errors", "1");
error_reporting(E_ALL);
?>
<?php
session_start();
session_id();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Welcome</title>
</head>
<body>
<?php
/* Program: login.php
* Desc: Displays the new member welcome page. Greets
* member by name and gives a choice to enter
* restricted section or go back to main page.
*/
include('Connections/connect_to_mysql.php');
$id = '';
$firstname = '';
$lastname = '';
$country = '';
$email = '';
if (isset($_SESSION['id'])) {
$id = $_SESSION['id'];
echo "can not get id";
}
$id = mysql_real_escape_string($id);
$result = mysql_query("SELECT id,firstname FROM `Members` WHERE $id={$_SESSION['id']}");
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
printf("id, firstname", $row[0], $row[1]);
}
if ($firstname == ''){ //condition, is name equal to lower case firstname notice we use == and not =
echo "Welcome, $firstname";
} else { //so incase the condition is not as expected
echo "Sorry you are not $firstname";
}
?>
<p>Your new Member accounts lets you enter the members only section
of our web site. You'll find special discounts, a profile of matches,
live advise from experts, and much more.</p>
<p>Your new Member ID and password were emailed to you. Store them
carefully for future use.</p>
<div style="text-align: center">
<p style="margin-top: .5in; font-weight: bold">
Glad you could join us!</p>
<form action="profile.php" method="post">
<input type="submit"
value="Enter the Members Only Section">
</form>
<form action="index.php" method="post">
<input type="submit" value="Go to eBermylove Main Page">
</form>
</div>
</body>
</html>