Jump to content

Recommended Posts

i've experience the following problem when i try to link MySQL and dreamweaver8/MX together:

[color=red]Warning: session_start() [function.session-start]: open[/color]

how do i rectify this problem?

and how do i link from PHP to MySQL.

also, how do i create a redemption of points thingy? can i use MySQL or PHP? how do i do it?

hoping for reply asap. thankx.
Link to comment
https://forums.phpfreaks.com/topic/15778-h-e-l-p~-am-new/
Share on other sites

[color=blue]The following is my code in Dreamweaver[/color]
<!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=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<?php
session_start();
if (!isset($count)) {
session_register("count");
$count = 1;
}
?>
You have been to this page <?=$count?> times.
<?php
$count++;
?>
</body>
</html>

and i keep getting tis same error(section error) for a few other pages.. wad is wrong

[color=red]Warning: session_start() [function.session-start]: open(C:/temp\sess_f0fdd9d74d859dcc573dfe3c1a1666da, O_RDWR) failed: No such file or directory (2) in c:\Inetpub\wwwroot\pd1\session.php on line 10

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at c:\Inetpub\wwwroot\pd1\session.php:9) in c:\Inetpub\wwwroot\pd1\session.php on line 10

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at c:\Inetpub\wwwroot\pd1\session.php:9) in c:\Inetpub\wwwroot\pd1\session.php on line 10
You have been to this page 1 times.
Warning: Unknown: open(C:/temp\sess_f0fdd9d74d859dcc573dfe3c1a1666da, O_RDWR) failed: No such file or directory (2) in Unknown on line 0

Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (C:/temp) in Unknown on line 0[/color]
Link to comment
https://forums.phpfreaks.com/topic/15778-h-e-l-p~-am-new/#findComment-64593
Share on other sites

All those errors are caused by the first. It appears your php.ini has been setup to save your session data to C:\temp which currently doesnt exist. See if create a folder called temp within the root of your C: drive resolves this. Note once you have created the folder restart your server.

Also whilst looking at your code provided you cannot use session_start() after any output to the browser, such as text/html. Unless you have output bufferining enabled within the php.ini.  I would move session_start above the HTML.
Link to comment
https://forums.phpfreaks.com/topic/15778-h-e-l-p~-am-new/#findComment-64596
Share on other sites

Thankx lots for the previous solution! :D

erm... for the following, i can mark out the required field but i can't get the infomation into my database

[color=blue]<?php require_once('Connections/pd1.php'); ?>
<!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=iso-8859-1" />
<title>Register</title>
<style type="text/css">
.error {color:red; font-weight: bold;}
</style>
</head>

<body>


<?php
$page = "register.php";

function print_form() {
global $page, $error, $print_again, $HTTP_POST_VARS;
$fields = array("first" => "text",
"last" => "text",
"age" => "text",
"email_required" => "text",
"login_required" => "text",
"password1_required" => "password",
"password2_required" => "password");
$labels = array("first" => "First_name",
"last" => "Last_name",
"age" => "Age",
"email_required" => "Email",
"login_required" => "*Desired_username",
"password1_required" => "*Password",
"password2_required" => "*Confirm password");
?>

<form name="form1" action="<?php echo $editFormAction; ?>" method="POST">
<?
if($print_again) {
?><h3>You missed some fields. Please correct the <span class=error>red</span> fields. Passwords     must match. <?
}
else {
?><h3>Please fill in the following fields.</h3><?
}
?>
<table border="0">
<?
foreach($fields as $key => $value) {
?>
<tr><td <? error_flag($error, $key);
?><?=$labels[$key]?>: </td>
<td><input type="<?=$value?>" name="<?=$key?>"
value="<? @print($HTTP_POST_VARS[$key])?>"></td></tr>
<?
}
?>
<tr><td colspan="2" align="center">
<input type="submit" name="submit" value="Submit"></td></tr>
</table>
<input type="hidden" name="MM_insert" value="form1">
</form>

<?
}//end function print_form

function error_flag($error, $field) {
if($error[$field]) {
print("<td class=error>");
}
else {
print("<td>");
}

}//end function error_flag

function check_form() {
global $error, $print_again, $HTTP_POST_VARS;
$print_again = false;
//check required fields have been entered
foreach($HTTP_POST_VARS as $key => $value) {
if(($value == "") && eregi("_required$", $key)) {
$error[$key] = true;
$print_again = true;
}
else {
$error[$key] = false;
}
}
//verify email

if (!eregi("^[a-z0-9]+[a-z0-9_-]*(\.[a-z0-9_-]+)*@[a-z0-9_-]+(\.[a-z0-9_-]+)*\.([a-z]+){2,}$",
    $HTTP_POST_VARS['email_required'])) {
$error['email_required'] = true;
$print_again = true;
$HTTP_POST_VARS['email_required'] = "ENTER A VALID EMAIL";
}

//verify desired user name is available
$available = true;
if (!$available) {
$error['login_required'] = true;
$print_again = true;
$HTTP_POST_VARS['login_required'] = "Name Not Available: " . $HTTP_POST_VARS[             'login_required'];
}

//verify password matched
if ($HTTP_POST_VARS['password1_required'] !=
$HTTP_POST_VARS['password2_required']) {
$error['password1_required'] = true;
$error['password2_required'] = true;
$HTTP_POST_VARS['password1_required'] = NULL;
$HTTP_POST_VARS['password2_required'] = NULL;
$print_again = true;

}
//print again if there are errors found
if($print_again) {
print_form();
}
else {
print("<h3>Thank you for completing the form!</h3>");
//do database insert, email, etc. Since data is OK!

}
}//end function check_form

/***** MAIN *****/

if(isset($submit)) {
check_form();
}
else {
print_form();
}
?>


</body>
</html>[/color]

are u able to help?
Link to comment
https://forums.phpfreaks.com/topic/15778-h-e-l-p~-am-new/#findComment-64605
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.