PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.php > associate user account with filename
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
associate user account with filename

Réponse
 
LinkBack Outils de la discussion
Vieux 14/09/2007, 13h21   #1 (permalink)
Reggie
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut associate user account with filename

am trying to associate username with filename in a upload script.


I get this error:
Parse error: syntax error, unexpected T_STRING in /home/fhlinux169/c/
clashoff.co.uk/user/htdocs/upload.php on line 42

This is my script any ideas.Am really stuck.


<?php
$host=""; // Host name
$username=""; // Mysql username
$password=""; // Mysql password
$db_name=""; // Database name
$tbl_name=""; // Table name
$target = "";
$target = $target . basename( $_FILES['uploaded']['name']) ;
$ok=1;

//This is our size condition
$upload_size = $_FILES['uploaded']['size'];
if ($upload_size > 1000000000000)
{
echo "Your file is too large.<br>";
$ok=0;
}

//This is our limit file type condition
$upload_type = $_FILES['uploaded']['type'];
if ($upload_type =="text/php")
{
echo "No PHP files<br>";
$ok=0;
}

//Here we check that $ok was not set to 0 by an error
if ($ok==0)
{
Echo "Sorry your file was not uploaded";
}

//If everything is ok we try to upload it
else
{
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
{
echo "The file ".
basename( $_FILES['uploaded']['name']). " has been uploaded";
$myfilename=basename( $_FILES['uploaded']['name'])

mysql_connect("$host", "$username", "$password")or die("cannot
connect");
mysql_select_db("$db_name")or die("cannot select DB");
$sql="update $tbl_name set filename = '$myfilename' WHERE
username='session_is_registered('myusername')' ";
mysql_query($sql);


}
else
{
echo "Sorry, there was a problem uploading your file.";
}
}
?>

<html>
<body>
<a href="/user.php">Return to User Page</a> </form>
</body>
</html>

  Réponse avec citation
Vieux 14/09/2007, 13h27   #2 (permalink)
gosha bine
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: associate user account with filename

On 14.09.2007 14:21 Reggie wrote:
> am trying to associate username with filename in a upload script.
>
>
> I get this error:
> Parse error: syntax error, unexpected T_STRING in /home/fhlinux169/c/
> clashoff.co.uk/user/htdocs/upload.php on line 42
>
> This is my script any ideas.Am really stuck.


The error has nothing to do with your actual problem. It's just a
parsing error, you're missing the comma or something like this. Check
line 42 of your script.



--
gosha bine

makrell ~ http://www.tagarga.com/blok/makrell
php done right http://code.google.com/p/pihipi
  Réponse avec citation
Vieux 14/09/2007, 15h23   #3 (permalink)
Anonymous
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: associate user account with filename

Reggie wrote:
>
> am trying to associate username with filename in a upload script.
>
> I get this error:
> Parse error: syntax error, unexpected T_STRING in /home/fhlinux169/c/
> clashoff.co.uk/user/htdocs/upload.php on line 42


Why don't you just look at line 42 then?

> $myfilename=basename( $_FILES['uploaded']['name'])
>
> mysql_connect("$host", "$username", "$password")or die("cannot
> connect");


Pretty obvious, you missed a semicolon in the line above 42.

Bye!
  Réponse avec citation
Vieux 14/09/2007, 16h20   #4 (permalink)
Reggie
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: associate user account with filename

On Sep 14, 3:23 pm, Anonymous <anonym...@nowhere.invalid> wrote:
> Reggie wrote:
>
> > am trying to associate username with filename in a upload script.

>
> > I get this error:
> > Parse error: syntax error, unexpected T_STRING in /home/fhlinux169/c/
> > clashoff.co.uk/user/htdocs/upload.php on line 42

>
> Why don't you just look at line 42 then?
>
> > $myfilename=basename( $_FILES['uploaded']['name'])

>
> > mysql_connect("$host", "$username", "$password")or die("cannot
> > connect");

>
> Pretty obvious, you missed a semicolon in the line above 42.
>
> Bye!


Where did i miss a semicolon.I cant see it.Am new to PHP

  Réponse avec citation
Vieux 14/09/2007, 16h25   #5 (permalink)
larry@portcommodore.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: associate user account with filename

On Sep 14, 8:20 am, Reggie <joelregisfo...@hotmail.com> wrote:

>
> Where did i miss a semicolon.I cant see it.Am new to PHP


Little things like that happen all to often - to all of us. :-)

  Réponse avec citation
Vieux 14/09/2007, 16h28   #6 (permalink)
Captain Paralytic
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: associate user account with filename

On 14 Sep, 16:20, Reggie <joelregisfo...@hotmail.com> wrote:
> On Sep 14, 3:23 pm, Anonymous <anonym...@nowhere.invalid> wrote:
>
>
>
>
>
> > Reggie wrote:

>
> > > am trying to associate username with filename in a upload script.

>
> > > I get this error:
> > > Parse error: syntax error, unexpected T_STRING in /home/fhlinux169/c/
> > > clashoff.co.uk/user/htdocs/upload.php on line 42

>
> > Why don't you just look at line 42 then?

>
> > > $myfilename=basename( $_FILES['uploaded']['name'])

>
> > > mysql_connect("$host", "$username", "$password")or die("cannot
> > > connect");

>
> > Pretty obvious, you missed a semicolon in the line above 42.

>
> > Bye!

>
> Where did i miss a semicolon.I cant see it.Am new to PHP- Hide quoted text -
>
> - Show quoted text -


Of course you can't see it, it's not there! that is what missing
means.

Look at line 41, it has no semicolon, so php carries on reading to
line 42 and finds a string, when by now it should have had a semicolon.

  Réponse avec citation
Vieux 14/09/2007, 19h41   #7 (permalink)
Anonymous
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: associate user account with filename

Reggie wrote:
>
> On Sep 14, 3:23 pm, Anonymous <anonym...@nowhere.invalid> wrote:
> > Reggie wrote:
> >
> > > am trying to associate username with filename in a upload script.

> >
> > > I get this error:
> > > Parse error: syntax error, unexpected T_STRING in /home/fhlinux169/c/
> > > clashoff.co.uk/user/htdocs/upload.php on line 42

> >
> > Why don't you just look at line 42 then?
> >
> > > $myfilename=basename( $_FILES['uploaded']['name'])

> >
> > > mysql_connect("$host", "$username", "$password")or die("cannot
> > > connect");

> >
> > Pretty obvious, you missed a semicolon in the line above 42.
> >
> > Bye!

>
> Where did i miss a semicolon.I cant see it.Am new to PHP


You missed it here:

$myfilename=basename( $_FILES['uploaded']['name']) <-
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 02h50.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,12035 seconds with 15 queries