Getting Started..

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

 



I'm just getting started here and I'm working with PHP & MySQL for Dummies.
The book says to write a simple file called "test.php" with the following
entries in it:
<html>
<head>
<title>PHP Test</title>
</head>
<body>
<p>This is an HTML line
<p>
<?php
echo "This is a PHP line";
phpinfo();
?>
</body></html>
When I run http://localhost/test.php, this is the error I got:
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in
C:\apachefriends\xampp\htdocs\test.php on line 9.
Can someone tell me what's wrong and what I need to do to get things squared
away?
Thank you...
Respectfully,
 
Clinton E. Lovell
Principal
Rainmaker Marketing Corporation
15519 Dawnbrook Drive
Houston, Texas 77068
(281) 537-1200
(206) 203-1229 (eFax)
 
CONFIDENTIALITY NOTICE: This communication and any documents, or files,
attached to it, constitute an electronic communication within the scope of
the Electronic Communication Privacy Act, 18 USCA 2510. This communication
may contain non-public, confidential, or legally privileged information
intended for the consideration of the designated recipients(s). The unlawful
interception, use, or disclosure of such information is strictly prohibited
by 18 USCA 2511 and any applicable laws. If you have received this e-mail in
error, please immediately notify us at (281) 537-1200 or via reply email and
permanently delete the original and any copy of any e-mail, file or
attachment and destroy any printout thereof. Thank you for your assistance.


-----Original Message-----
From: Norland, Martin [mailto:Martin.Norland@xxxxxxxxxx] 
Sent: Monday, September 19, 2005 2:04 PM
To: php-db@xxxxxxxxxxxxx
Subject: RE:  insert error for mysql

One of the strings you're inserting has an quotation mark (apostrophe).
You're going to have to do some more careful data scrubbing on the
incoming data.

E.G. one of the strings says "it's used in the retail, banking, and
insurance industries, among" ...
And it's breaking the containing '   -  insert into foo (bar) values
('this isn't going to work.');

might I suggest starting with addslashes()

Cheers,
- Martin Norland, Sys Admin / Database / Web Developer, International
Outreach x3257

The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.


-----Original Message-----
From: Yui Hiroaki [mailto:yui@xxxxxxxxxxxxxxxxxxxx] 
Sent: Monday, September 19, 2005 1:26 PM
To: php-db@xxxxxxxxxxxxx
Subject:  insert error for mysql. .

hi!

I have an error message to try to insert character into table.
But I have an error messages like below. When I try to insert
$strbuf, I got error.


Could not perform INSERT to table 1064: You have an error in your SQL
syntax. Check the manual that corresponds to your MySQL server version
for the right syntax to use near 's used in the retail, banking, and
insurance industries, among



I publish SQL;

mysql> create table view(b_col_id mediumint(255) NOT NULL
AUTO_INCREMENT, b_col longblob NOT NULL,file_name varchar(255) NOT
NULL,file_size varchar(255) NOT NULL,file_type varchar(255) NOT
NULL,file_date time,vtext longtext,PRIMARY KEY(b_col_id))TYPE=MyISAM;


mysql> alter tablev view add fulltext (vtext);

The code----------------------------------------------
$handle = popen("/usr/bin/pdftotext \"$original_tmp\" - -layout  2>&1",
'r');
$strbuf = fread($handle, 2048000);
echo $strbuf;

pclose($handle);


$sql_insert = "INSERT INTO
view(b_col,file_name,file_size,file_type,file_date,vtext) VALUES
('$binaryContent','$original_name','$original_size','$original_type',CUR
TIME(),'$strbuf')";

mysql_query($sql_insert) or DIE ("Could not perform INSERT to table
".mysql_errno().": ".mysql_error());
mysql_close($db);






Please do help me!

Yui

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

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

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


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

  Powered by Linux