error form check box and database

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear friends,

Any guidance to the error , please.
------------------------------------------------------------------------------
---
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in 
C:\HOME\doctorbush\check.php on line 11

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting 
T_STRING or T_VARIABLE or T_NUM_STRING in C:\HOME\doctorbush\check.php on line 73

------------------------------------------------------------------
script code
-------------------------------------------------------------------------
<?php

// example code for checkbox.txt
// confirmed working: Friday, March 07, 2003

// Configuration information for connecting to database
// Contains $db_name, $db_user, $db_pass, $db_host
// for connection.

// Enter your database host name here.
$db_host = \"localhost\";
// Enter your database password here.
$db_pass = \"\";
// Enter your database user name here.
$db_user = \"\";
// Enter the name of your database here.
$db_name = \"\";

// Connect to database
  $db_conn = @mysql_pconnect($db_host, $db_user, $db_pass);

// Check for database unavailable 
if (!$db_conn)
{
print \"ERROR - failed to create connection: \" . >>>
mysql_error();

}


function make_item_control($value,$title) { 
$content = '<tr class=\"tabletext\"><td><input type=\"checkbox\" >>>
name=\"item[]\" value=\"'.$value.'\" />'.$title.'</td>';

return $content;
}

if($p_delete_checked) {
// Process items
// We substract one from the count because a for loop executes >>>
once

// before incrementing.
$n = count($item)-1;
for($i = 0; $i <= $n; $i++)
{
$sql = \"DELETE FROM note WHERE note_id = $item[$i];\";
$result = mysql_db_query($db_name,$sql);

if (!$result) {
        print ' ERROR - Delete note query failed: ' >>>
.mysql_error();

}

}
} else {
// list items

// database query here

$sql = \"SELECT note_id,film_id,LEFT(text,32) AS item_name FROM >>>
note ORDER BY film_id ASC;\";

$result = mysql_db_query($db_name,$sql);

if (!$result || mysql_num_rows($result) < 1) {
        print ' ERROR - Select note query failed: ' >>>
.mysql_error();

}

print '<form action='. $_SERVER['PHP_SELF'] .'>';
print '<table>';
while($row = mysql_fetch_array($result)) {
print make_item_control($row[note_id],$row[item_name]);
}
print '<tr class=\"tabletext\">
<td>
<input type=\"Submit\" name=p_delete_checked value=\"Delete >>>
Checked\" />

</tr>';
print '</table>';
print '</form>';

}



?>

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux