Re: [PHP-DB] error of check box form

2004-09-08 Thread John Holmes
[EMAIL PROTECTED] wrote:
Any guidance to the error , please.
Resubmitting,
--
---
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

--
$db_host = \localhost\;
$db_pass = \\;
$db_user = \\;
$db_name = \\;
print \ERROR - failed to create connection: \ . 
$sql = \DELETE FROM note WHERE note_id = $item[$i];\;
$sql = \SELECT note_id,film_id,LEFT(text,32) AS item_name FROM 
note ORDER BY film_id ASC;\;
Remove the \ characters in the lines above.
$db_host = localhost;
etc...
and read this http://us2.php.net/manual/en/language.types.string.php
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] error of check box form

2004-09-08 Thread Peter Ellis
In addition, please send your messages once and only once.  I have two
copies of the same e-mail, both sent to the list successfully with two
different replies to both messages.  You're more likely to get help if
you post and wait for a reply to your original message.
-- 
Peter Ellis - [EMAIL PROTECTED]
Web Design and Development Consultant
naturalaxis | http://www.naturalaxis.com/

On Wed, 2004-09-08 at 05:53 -0400, [EMAIL PROTECTED] wrote:
 Dear friends,
 
 
 Any guidance to the error , please.
 Resubmitting,
 --
 ---
 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\tdinput 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';
 
 }
 
 
 
 ?

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php