[PHP 4.2.3] Parse Error

Pagina: 1
Acties:
  • 35 views sinds 30-01-2008

  • vegterb
  • Registratie: Juni 2001
  • Laatst online: 22-05 18:08

vegterb

[ZzZ]Vighter

Topicstarter
Na deze topics:
[PHP + MySQL] Zoekmachine
[HTML > PHP > MySQL] Communicatie fout?
Beiden zitten nu op slot...

Nog steeds werkt het niet en zit ik vast in het volgende bestand:
instert.php
PHP:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?
$username="ODBC";
$password="";
$database="testing";

mysql_connect(localhost,$username,$password);
@mysql_select_db($database) 
    or die( "Unable to select database");
Print "\"$database\" geopend!";

Echo "<P>";

$query = INSERT INTO contacts VALUES ($HTTP_POST_VARS['$first'],$HTTP_POST_VARS['$last'],$HTTP_POST_VARS['$phone'],$HTTP_POST_VARS['$mobile'],$HTTP_POST_VARS['$fax'],$HTTP_POST_VARS['$email'],$HTTP_POST_VARS['$web'])" 
    or die( "Unable to insert into database");
Print "Invoeren van \"$first $last $phone $mobile $fax $email $web\" gelukt!";

ini_set('error_reporting', E_ALL);

mysql_query($query);

mysql_close();
?>


Ik ben er dus ook achter gekomen dat sinds een update na 4.1.x (zoiets) er iets veranderd is in de werking van PHP. ik draai versie 4.2.3 en het werkt dus niet. Ik ben verschillende sites afgegaan.
PHP:
1
 $first

PHP:
1
 $_POST['$first']

PHP:
1
 $HTTP_POST_VARS['first']

PHP:
1
 '".$HTTP_POST_VARS['first']."'

Allen geen verandering in werking en/of foutmelding.

PHP:
1
 "INSERT INTO contacts VALUES ('',$_POST['$first'],$_POST['$last'],$_POST['$phone'],$_POST['$mobile'],$_POST['$fax'],$_POST['$email'],$_POST['$web')"

Geeft:
code:
1
 Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in c:\phpdev\www\insert.php on line 13


PHP:
1
 INSERT INTO contacts VALUES ('',$_POST['$first'],$_POST['$last'],$_POST['$phone'],$_POST['$mobile'],$_POST['$fax'],$_POST['$email'],$_POST['$web')

Geeft:
code:
1
 Parse error: parse error in c:\phpdev\www\insert.php on line 13


PHP:
1
 $query = INSERT INTO contacts VALUES ($HTTP_POST_VARS['$first'] = 'first',$HTTP_POST_VARS['$last'] = 'last',$HTTP_POST_VARS['$phone'] = 'phone',$HTTP_POST_VARS['$mobile'] = 'mobile',$HTTP_POST_VARS['$fax'] = 'fax',$HTTP_POST_VARS['$email'] = 'email',$HTTP_POST_VARS['$web'] = 'web')

Geeft:
code:
1
Parse error: parse error in c:\phpdev\www\insert.php on line 13


PHP:
1
$query = INSERT INTO contacts VALUES ($HTTP_POST_VARS['$first'].$HTTP_POST_VARS['$last'].$HTTP_POST_VARS['$phone'].$HTTP_POST_VARS['$mobile'].$HTTP_POST_VARS['$fax'].$HTTP_POST_VARS['$email'].$HTTP_POST_VARS['$web']);

Geeft:
code:
1
Parse error: parse error in c:\phpdev\www\insert.php on line 13

[ Voor 16% gewijzigd door vegterb op 19-05-2004 12:44 ]

My Laptop Specificaties vs My Desktop Specificaties


  • NMe
  • Registratie: Februari 2004
  • Laatst online: 24-05 14:53

NMe

Quia Ego Sic Dico.

PHP:
1
$query = "INSERT INTO contacts VALUES ($HTTP_POST_VARS['$first'] = 'first',$HTTP_POST_VARS['$last'] = 'last',$HTTP_POST_VARS['$phone'] = 'phone',$HTTP_POST_VARS['$mobile'] = 'mobile',$HTTP_POST_VARS['$fax'] = 'fax',$HTTP_POST_VARS['$email'] = 'email',$HTTP_POST_VARS['$web'] = 'web')";

Is je niet al wat vaker gezegd dat er ook tutors bestaan waar dit UITGEBREID behandeld wordt? :/

Edit: ik heb hier je eigen query gekopieerd, die klopt ook nog eens niet, je zet EERST de veldnaam, dan de WAARDE die je eraan wil geven. En je kan beter $_POST gebruiken dan $HTTP_POST_VARS, al was het alleen al om RSI tegen te gaan... :P

[ Voor 39% gewijzigd door NMe op 19-05-2004 12:50 ]

'E's fighting in there!' he stuttered, grabbing the captain's arm.
'All by himself?' said the captain.
'No, with everyone!' shouted Nobby, hopping from one foot to the other.


  • Spinal
  • Registratie: Februari 2001
  • Laatst online: 15-05 11:48
vegterb schreef op 19 mei 2004 @ 12:43:
PHP:
1
 INSERT INTO contacts VALUES ('',$_POST['$first'],$_POST['$last'],$_POST['$phone'],$_POST['$mobile'],$_POST['$fax'],$_POST['$email'],$_POST['$web')

Geeft:
code:
1
 Parse error: parse error in c:\phpdev\www\insert.php on line 13
En zo?
PHP:
1
mysql_query ("INSERT ..."); // Hele query hier dus neerzetten

Full-stack webdeveloper in Groningen


  • spacebugs504
  • Registratie: Februari 2004
  • Laatst online: 18-03 15:32
Moeten er geen dubble qoutes staan om de SQL query ? dus $query=" INSERT ..... "


Trage post .... 8)7

[ Voor 20% gewijzigd door spacebugs504 op 19-05-2004 12:50 ]


  • Cavorka
  • Registratie: April 2003
  • Laatst online: 27-03-2018

Cavorka

Internet Entrepreneur

vegterb schreef op 19 mei 2004 @ 12:43:
(...Veel code, veel tekst...)
Fraaie layout trouwens. Maar ehm, op regel 13 ben je gewoon een " vergeten... als je die nou eerst eens toevoegt.

Van je voorbeelden begrijp ik trouwens echt helemaal niets. Wat is nou precies je punt? Dat er iets verandert is?

*Spuit 312421242.

Hehe, ik had nog niet eens al die anderen gezien. Drukte hierzo :P.

[ Voor 51% gewijzigd door Cavorka op 19-05-2004 12:52 ]

the-blueprints.com - The largest free blueprint collection on the internet: 50000+ drawings.


  • spacebugs504
  • Registratie: Februari 2004
  • Laatst online: 18-03 15:32
Sorry zal proberen 't nooit weer doen .... 8)

  • vegterb
  • Registratie: Juni 2001
  • Laatst online: 22-05 18:08

vegterb

[ZzZ]Vighter

Topicstarter
ZanderZ schreef op 19 mei 2004 @ 12:47:
[...]


En zo?
PHP:
1
mysql_query ("INSERT ..."); // Hele query hier dus neerzetten
code:
1
 Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in c:\phpdev\www\insert.php on line 13
spacebugs schreef op 19 mei 2004 @ 12:48:
Moeten er geen dubble qoutes staan om de SQL query ? dus $query=" INSERT ..... "


Trage post .... 8)7
code:
1
 Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in c:\phpdev\www\insert.php on line 13

My Laptop Specificaties vs My Desktop Specificaties


  • curry684
  • Registratie: Juni 2000
  • Laatst online: 12-05 22:23

curry684

left part of the evil twins

Sorry hoor maar dit blijft basic debugwerk.... tel je openingsquotes in godesnaam gewoon eens op en overtuig je ervan dat het aantal sluitingsquotes identiek is.

Spendeer eens wat uurtjes op www.php.net, dit soort topics blijft gewoon nergens heen gaan en verspilling van onze tijd... :/

Professionele website nodig?

Pagina: 1

Dit topic is gesloten.