Hi Raquibul,

----- Original Message ----- 
From: "raquibul islam"
> Bob here is the 1st file i change.
> 
> 
> <html>
> <body>
> <?php
> $dbhost='localhost';
> $dbuser='root';
> $dbpass='123456';
> $dbname='image';
> $tbl_name='images';
> $conn=mysql_connect($dbhost,$dbuser,$dbpass) or die ('Error in Connecting to 
> database');
> mysql_select_db($dbname);
> 
> if (isset($_POST[ 'submit'] ))
> {
> require ($_SERVER['DOCUMENT _ROOT'] . '/cgi-bin/open_ your_database. php');
> 
> $image = addslashes(fread( fopen($_FILES[ 'the_file' ]['tmp_name' ], 'r'), 
> $_FILES['the_ file']['size' ]));
> $query = "INSERT INTO images VALUES (0, '$image', '" . $_FILES['the_ 
> file']['type' ] . "')";
> 
> 
> if (mysql_query( $query)) echo '<p>Image No: ' . mysql_insert_ id() . ' has 
> been stored</p>'; (Error in Browser-->Parse error:  syntax error, unexpected 
> T_STRING, expecting ',' or ';' in C:\Program Files\xampp\htdocs\pic\index.php 
> on line 20)
> else echo 'Image could not be stored ' . mysql_error( );
> mysql_close( );
> }
> else
> {
> ?>
> <form method="post" action="<?php echo $_SERVER['PHP_ SELF']; ?>" 
> enctype="multipart/ form-data" >
> <input type="hidden" name="MAX_FILE_ SIZE" value="100000" />
> <div align="center" >
> Select a file to upload: <input type="file" name="the_file" /><br />
> <input type="submit" name="submit" value="Submit" />
> </div>
> </form>
> <?php
> }
> ?>
> </body>
> </html>
> 
> Note: If i just block that if and else then after submitting a image 
> Error-->Warning:  require(/cgi-bin/open_ your_database. php) 
> [function.require]: failed to open stream: No such file or directory in 
> C:\Program Files\xampp\htdocs\pic\index.php on line 14
> 
> Fatal error:  require() [function.require]: Failed opening required 
> '/cgi-bin/open_ your_database. php' (include_path='.;C:\Program 
> Files\xampp\php\pear\') in C:\Program Files\xampp\htdocs\pic\index.php on 
> line 14


First, remove this line:
require ($_SERVER['DOCUMENT _ROOT'] . '/cgi-bin/open_ your_database. php');
as you are opening the database yourself previously.

Second, in mysql_insert_ id()
You have a space between the "mysql_insert_" and "id()"

When code is sent via this group, it gets wrapped which causes spaces in it.
Regards, Bob.

Reply via email to