RE: [PHP-DB] Script syntax error
| From: | Rick Emery | Date: | Mon, 08 Oct 2001 15:30:13 +0000 |
| Subject: | RE: [PHP-DB] Script syntax error | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-13114@lists.php.net to get a copy of this message | ||
Sounds like a problem with MySQL Front (whatever that as). Do you have
access to athe MySQL command line?
There is no seetting in MySQL to make data invisible.
What is the structure of the database?
-----Original Message-----
From: steve downs [mailto:sdowns@cox.rr.com]
Sent: Monday, October 08, 2001 10:03 AM
To: php-db@lists.php.net
Subject: Re: [PHP-DB] Script syntax error
I've fixed the errors from happening. But, now the data is "invisible" in
the database. When I look at it in MySQL Front there is no visible data in
the database. There is an ID and the time is there. But, the data that was
entered through the form is not displaying. However, I know it is there
because it gets outputted to the web browser. There is no error message. Is
this some sort of setting in MySQL? This is what I changed the code to:
<?php
include "include_fns.php";
if (isset($story) && (story != "new"))
$s = get_story_record($story);
$conn = db_connect();
$time = time();
if ($story=="new") {
$sql = "update stories
set headline = '$headline',
story_text = '$story_text',
page = '$page',
modified = $time
where id = $story";
}
else {
$sql = "insert into stories
(headline, story_text, page, writer, created, modified)
values
('$headline', '$story_text', '$page',
'$auth_user', $time,
$time)";
}
$result = mysql_query($sql, $conn);
if (!$result) {
print "There was a database error when executing <PRE>$sql</PRE>";
print mysql_error();
exit;
}
header("Location: http://www.cncrenegade.com/");
?>
~Steve
**This space for Rent**
----- Original Message -----
From: "Rick Emery" <remery@excel.com>
To: "'steve downs'" <sdowns@cox.rr.com>; <php-db@lists.php.net>
Sent: Monday, October 08, 2001 9:32 AM
Subject: RE: [PHP-DB] Script syntax error
> Which line spits out the error message? What is the error message?
>
> -----Original Message-----
> From: steve downs [mailto:sdowns@cox.rr.com]
> Sent: Friday, October 05, 2001 8:00 PM
> To: php-db@lists.php.net
> Subject: [PHP-DB] Script syntax error
>
>
> I'm using "PHP and MySQL Web Development" published by SAM's. I believe
the
> story_submit.php file for the Content Mangement script in Chapter 26 has a
> syntax problem. I'm getting errors. I'm very new to MySQL & PHP and would
> appreciate some help. The form has a field for uploading an optional .html
> file. That's what $html represents. The $story variable is the story ID.
If
> there is no story ID then it is a new story rather than a story to
modified.
> Here's the code:
>
> <?php
>
> // story_action.php
> // add / modify story record
>
> include "include_fns.php";
>
> $conn = db_connect();
>
> $time = time();
>
> if ( ($html) && (dirname($html_type) == "text") ) {
> $fp = fopen($html, "r");
> $story_text = addslashes(fread($fp, filesize($html)));
> fclose($fp);
> }
>
>
> if ($story) { // It's an update
> $sql = "update stories
> set headline = '$headline',
> story_text = '$story_text',
> page = '$page',
> modified = $time
> where id = $story";
> }
> else { // It's a new story
> $sql = "insert into stories
> (headline, story_text, page, writer, created, modified)
> values
> ('$headline', '$story_text', '$page',
> '$auth_user', $time,
> $time)";
> }
>
> $result = mysql_query($sql, $conn);
>
> if (!$result) {
> print "There was a database error when executing <PRE>$sql</PRE>";
> print mysql_error();
> exit;
> }
>
> if ( ($picture) && ($picture != "none") ) {
>
> if (!$story)
> $story = mysql_insert_id();
>
> $type = basename($picture_type);
>
> switch ($type) {
> case "jpeg":
> case "pjpeg": $filename = "pictures/$story.jpg";
> copy ($picture, $filename);
> $sql = "update stories
> set picture = '$filename'
> where id = $story";
> $result = mysql_query($sql, $conn);
> break;
> default: print "Invalid picture format: $picture_type";
> }
> }
>
> header("Location: $destination");
>
> ?>
>
>
> Thanks,
> ~Steve Downs
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
For additional commands, e-mail: php-db-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net