08. marts 2005 - 16:41
Der er
32 kommentarer og 2 løsninger
unexpected T_STRING
Jeg har igen igen problemmer med noget php og mySQL Denne gang kommer den med denne fejl: Parse error: parse error, unexpected T_STRING in /usr/home/dan12034/public_html/mobil/post.php on line 52 min linje nummer 52 ser sådanne ud: INSERT INTO `mos_content` ( `id` , `title` , `title_alias` , `introtext` , `fulltext` , `state` , `sectionid` , `mask` , `catid` , `created` , `created_by` , `created_by_alias` , `modified` , `modified_by` , `checked_out` , `checked_out_time` , `publish_up` , `publish_down` , `images` , `urls` , `attribs` , `version` , `parentid` , `ordering` , `metakey` , `metadesc` , `access` , `hits` ) Hvad er fejlen?
Annonceindlæg tema
Offentlig digitalisering
Fra effektivisering til digital suverænitet. Hvordan skaber det offentlige en digital fremtid med AI, sikkerhed og kontrol i centrum?
08. marts 2005 - 16:42
#1
I skal måske lige have hele INSERT: INSERT INTO `mos_content` ( `id` , `title` , `title_alias` , `introtext` , `fulltext` , `state` , `sectionid` , `mask` , `catid` , `created` , `created_by` , `created_by_alias` , `modified` , `modified_by` , `checked_out` , `checked_out_time` , `publish_up` , `publish_down` , `images` , `urls` , `attribs` , `version` , `parentid` , `ordering` , `metakey` , `metadesc` , `access` , `hits` ) VALUES ( '', '$title', '$title_alias', '$introtext', '$fulltext', '$stat', '$sectionid', '$mask', '$catid', '$created', '$created_by', '$created_by_alias', '$modified', '$modified_by', '$checked_out_time', '$publish_up', '$publish_down', '0000-00-00 00:00:00', '$images', '$urls', '$attribs', '$version', '$parentid', '$ordering', '$metakey', '$metadesc', '$access', '$hits');
08. marts 2005 - 16:47
#2
det er fordi du ikke bare kan skrive SQL i et PHP script. Prøv med: mysql_query(INSERT INTO `mos_content` ( `id` , `title` , `title_alias` , `introtext` , `fulltext` , `state` , `sectionid` , `mask` , `catid` , `created` , `created_by` , `created_by_alias` , `modified` , `modified_by` , `checked_out` , `checked_out_time` , `publish_up` , `publish_down` , `images` , `urls` , `attribs` , `version` , `parentid` , `ordering` , `metakey` , `metadesc` , `access` , `hits` ) VALUES ( '', '$title', '$title_alias', '$introtext', '$fulltext', '$stat', '$sectionid', '$mask', '$catid', '$created', '$created_by', '$created_by_alias', '$modified', '$modified_by', '$checked_out_time', '$publish_up', '$publish_down', '0000-00-00 00:00:00', '$images', '$urls', '$attribs', '$version', '$parentid', '$ordering', '$metakey', '$metadesc', '$access', '$hits'));
08. marts 2005 - 16:49
#3
Det virker heller ikke...
08. marts 2005 - 16:50
#4
Hvorfor et komma der og hvorfor ''? VALUES ( '', '$title', '$title_alias', prøv med VALUES ("'$title', '$title_alias', Og sæt ogsaa " mellem ( `id` , `title` og `metadesc` , `access` , `hits` )
08. marts 2005 - 16:51
#5
nizo De første '' er fordi den er tom.
08. marts 2005 - 16:52
#6
hov.. jeg glemte også noget: mysql_query("INSERT INTO `mos_content` ( `id` , `title` , `title_alias` , `introtext` , `fulltext` , `state` , `sectionid` , `mask` , `catid` , `created` , `created_by` , `created_by_alias` , `modified` , `modified_by` , `checked_out` , `checked_out_time` , `publish_up` , `publish_down` , `images` , `urls` , `attribs` , `version` , `parentid` , `ordering` , `metakey` , `metadesc` , `access` , `hits` ) VALUES ( '', '$title', '$title_alias', '$introtext', '$fulltext', '$stat', '$sectionid', '$mask', '$catid', '$created', '$created_by', '$created_by_alias', '$modified', '$modified_by', '$checked_out_time', '$publish_up', '$publish_down', '0000-00-00 00:00:00', '$images', '$urls', '$attribs', '$version', '$parentid', '$ordering', '$metakey', '$metadesc', '$access', '$hits')");
08. marts 2005 - 16:54
#7
bromer så langt så godt nu får jeg ikke den fejl mere, men denne: Can't insert into the table. Query was empty
08. marts 2005 - 17:05
#8
Orker ikke lige at ændre din query, men $sql = "INSERT INTO `mos_content`(`id`, `title`) VALUES ('', '". $title_alias ."')"); if(myqsl_query($sql)) { echo"FINT NOK"; }else{ echo"FEJL! ". mysql_error(); }
08. marts 2005 - 17:10
#9
sukos--> Så du mener hver skal se sådanne ud '". $title ."', '". $title_alias ."'?
08. marts 2005 - 17:12
#10
ehmm, jow, og lige en fejl i mit indlæg!!!!!!!!!!!! $sql = "INSERT INTO `mos_content`(`id`, `title`) VALUES ('', '". $title_alias ."')";
08. marts 2005 - 17:24
#11
Nu ser min kode sådanne ud: $sql = "INSERT INTO `mos_content`( `id` , `title` , `title_alias` , `introtext` , `fulltext` , `state` , `sectionid` , `mask` , `catid` , `created` , `created_by` , `created_by_alias` , `modified` , `modified_by` , `checked_out` , `checked_out_time` , `publish_up` , `publish_down` , `images` , `urls` , `attribs` , `version` , `parentid` , `ordering` , `metakey` , `metadesc` , `access` , `hits` ) VALUES ('', '". $title ."','". $title_alias ."', '". $introtext ."','". $fulltext ."','". $stat ."','". $sectionid ."','". $mask ."','". $catid ."','". $created ."','". $created_by ."','". $created_by_alias ."', '". $modified ."','". $modified_by ."','". $checked_out_time ."', '". $publish_up ."',,'". $publish_down ."','". 0000-00-00 00:00:00 ."','". '$images ."','". $urls ."','". $attribs ."', '". $version ."','". $parentid ."','". $ordering ."', '". $metakey ."','". $metadesc ."', '". $access ."', '". $hits ."'); Og den kommer mewd denne fejl: Parse error: parse error, unexpected T_LNUMBER in /usr/home/dan12034/public_html/mobil/post.php on line 52
08. marts 2005 - 17:31
#12
Erstat din ) tilsidst med en "
08. marts 2005 - 17:33
#13
'". $hits ."'"; sådanne?
08. marts 2005 - 17:35
#14
Hvorfor ikke bare prøve? Iøvrigt samme fejl som jeg selv gjorde i mit første indlæg! :o)
08. marts 2005 - 17:35
#15
Jeg har forsøgt, men der kommer samme fejl!
08. marts 2005 - 17:39
#16
efter $publish_up har du to kommaer! Og den her '". 0000-00-00 00:00:00 ."' er sgutte holdbar!
08. marts 2005 - 17:42
#17
Jeg har set mig helt blind på det her nu:-D Nu er det rettet tak for det, men nyfejl: Parse error: parse error, unexpected ',' in /usr/home/dan12034/public_html/mobil/post.php on line 52
08. marts 2005 - 17:49
#18
Som PHP selv siger, et uventet , (komma)
08. marts 2005 - 17:53
#19
Hvad med denne: $sql = "INSERT INTO `mos_content`(`id`,`title`,`title_alias`,`introtext`,`fulltext`,`state`,`sectionid`,`mask`,`catid`,`created`,`created_by`,`created_by_alias`,`modified`,`modified_by`,`checked_out`,`checked_out_time`,`publish_up`,`publish_down`,`images`,`urls`,`attribs`,`version`,`parentid`,`ordering`,`metakey`,`metadesc`,`access`,`hits`) VALUES ('', '". $title ."','". $title_alias ."','". $introtext ."','". $fulltext ."','". $stat ."','". $sectionid ."','". $mask ."','". $catid ."','". $created ."','". $created_by ."','". $created_by_alias ."','". $modified ."','". $modified_by ."','". $checked_out_time ."','". $publish_up ."','". $publish_down ."','','". '$images ."','". $urls ."','". $attribs ."','". $version ."','". $parentid ."','". $ordering ."','". $metakey ."','". $metadesc ."','". $access ."', ". $hits ."'"; Her er så ingen tidsangivelse!
08. marts 2005 - 17:54
#20
SHIT! Der mangler en ' før ". $hits $sql = "INSERT INTO `mos_content`(`id`,`title`,`title_alias`,`introtext`,`fulltext`,`state`,`sectionid`,`mask`,`catid`,`created`,`created_by`,`created_by_alias`,`modified`,`modified_by`,`checked_out`,`checked_out_time`,`publish_up`,`publish_down`,`images`,`urls`,`attribs`,`version`,`parentid`,`ordering`,`metakey`,`metadesc`,`access`,`hits`) VALUES ('', '". $title ."','". $title_alias ."','". $introtext ."','". $fulltext ."','". $stat ."','". $sectionid ."','". $mask ."','". $catid ."','". $created ."','". $created_by ."','". $created_by_alias ."','". $modified ."','". $modified_by ."','". $checked_out_time ."','". $publish_up ."','". $publish_down ."','','". '$images ."','". $urls ."','". $attribs ."','". $version ."','". $parentid ."','". $ordering ."','". $metakey ."','". $metadesc ."','". $access ."', '". $hits ."'";
08. marts 2005 - 18:01
#21
Det gave den samme fejl Så jeg tog lige en gennemgang af det og kom frem til dette: $sql = "INSERT INTO `mos_content`( `id` , `title` , `title_alias` , `introtext` , `fulltext` , `state` , `sectionid` , `mask` , `catid` , `created` , `created_by` , `created_by_alias` , `modified` , `modified_by` , `checked_out` , `checked_out_time` , `publish_up` , `publish_down` , `images` , `urls` , `attribs` , `version` , `parentid` , `ordering` , `metakey` , `metadesc` , `access` , `hits` ) VALUES ('', '". $title ."', '". $title_alias ."', '". $introtext ."', '". $fulltext ."', '". $state .", '". $sectionid ."', '". $mask ."', '". $catid ."', '". $created ."', '". $created_by ."', '". $creates_by_alias ."', '". $modified ."', '". $modified_by ."', '". $checked_out ."', '". $checked_out_time ."', '". $publish_up ."', '". $publish_down ."', '". $images ."', '". $urls ."', '". $attribs ."', '". $parentid ."', '". $ordering ."', '". $metakey ."', '". $metadesc ."', '". $access ."', '". $hits ."'); Nu får jeg så denne fejl i linge 55: Parse error: parse error, unexpected T_STRING in /usr/home/dan12034/public_html/mobil/post.php on line 55 Sådan ser linje 55 ud: $result = mysql_query($sql) or print ("Can't insert into the table.<br />" . $sql . "<br />" . mysql_error());
08. marts 2005 - 18:37
#22
Er der slet ikke nogle der kan hjælpe?
08. marts 2005 - 18:37
#23
Du mangler stadig en " som afslutning på $sql, i stedet for en ) Og måske: $result = mysql_query($sql) or die ("Can't insert into the table.<br />" . $sql . "<br />". mysql_error()); eller if(!mysql_query($sql)) { echo"Can't insert into the table.<br />" . $sql . "<br />" . mysql_error(); }else{ echo"Helt fint!"; } Og umiddelbart, får du jo så et felt for meget
08. marts 2005 - 18:38
#24
Felt for meget => tidsangivelse
08. marts 2005 - 18:41
#25
"Felt for meget => tidsangivelse" Den forstod jeg ikke lige. Nu ser min kode sådanne ud: $sql = "INSERT INTO `mos_content`( `id` , `title` , `title_alias` , `introtext` , `fulltext` , `state` , `sectionid` , `mask` , `catid` , `created` , `created_by` , `created_by_alias` , `modified` , `modified_by` , `checked_out` , `checked_out_time` , `publish_up` , `publish_down` , `images` , `urls` , `attribs` , `version` , `parentid` , `ordering` , `metakey` , `metadesc` , `access` , `hits` ) VALUES ('', '". $title ."', '". $title_alias ."', '". $introtext ."', '". $fulltext ."', '". $state .", '". $sectionid ."', '". $mask ."', '". $catid ."', '". $created ."', '". $created_by ."', '". $creates_by_alias ."', '". $modified ."', '". $modified_by ."', '". $checked_out ."', '". $checked_out_time ."', '". $publish_up ."', '". $publish_down ."', '". $images ."', '". $urls ."', '". $attribs ."', '". $parentid ."', '". $ordering ."', '". $metakey ."', '". $metadesc ."', '". $access ."', '". $hits ."')"; if(!mysql_query($sql)) { echo"Can't insert into the table.<br />" . $sql . "<br />" . mysql_error(); }else{ echo"Helt fint!"; } og nu kommer den med denne fejl: Can't insert into the table. INSERT INTO `mos_content`( `id` , `title` , `title_alias` , `introtext` , `fulltext` , `state` , `sectionid` , `mask` , `catid` , `created` , `created_by` , `created_by_alias` , `modified` , `modified_by` , `checked_out` , `checked_out_time` , `publish_up` , `publish_down` , `images` , `urls` , `attribs` , `version` , `parentid` , `ordering` , `metakey` , `metadesc` , `access` , `hits` ) VALUES ('', 'Hej', 'Hej', 'hsadjgh', 'sladhglsdhg', ', '1', '0', '1', '1110303646', 'hsuadf', '', '0000-00-00 00:00:00', '0', '', '0', '1110303646', '0000-00-00 00:00:00', '', '', 'menu_image=-1 item_title=1 pageclass_sfx= back_button= rating= author= createdate= modifydate= pdf= print= email=', '0', '0', '', '', '0', '0') 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 '1', '0', '1', '1110303646', 'hsuadf', '', '0000-00-00 00:00:00'
08. marts 2005 - 18:46
#26
$sql = "INSERT INTO `mos_content`( `id` , `title` , `title_alias` , `introtext` , `fulltext` , `state` , `sectionid` , `mask` , `catid` , `created` , `created_by` , `created_by_alias` , `modified` , `modified_by` , `checked_out` , `checked_out_time` , `publish_up` , `publish_down` , `images` , `urls` , `attribs` , `version` , `parentid` , `ordering` , `metakey` , `metadesc` , `access` , `hits` ) VALUES ('', '". $title ."', '". $title_alias ."', '". $introtext ."', '". $fulltext ."', '". $state .", '". $sectionid ."', '". $mask ."', '". $catid ."', '". $created ."', '". $created_by ."', '". $creates_by_alias ."', '". $modified ."', '". $modified_by ."', '". $checked_out ."', '". $checked_out_time ."', '". $publish_up ."', '". $publish_down ."', '". $images ."', '". $urls ."', '". $attribs ."', '". $parentid ."', '". $ordering ."', '". $metakey ."', '". $metadesc ."', '". $access ."', '". $hits ."'"; Og du vil inserte i 28 kollonner, men har kun 27 værdier!
08. marts 2005 - 18:49
#27
Nej det har jeg ikke det er fordi den første er tom.
08. marts 2005 - 18:50
#28
Mu har jeg lavet den sådanne: $sql = "INSERT INTO `mos_content`( `id` , `title` , `title_alias` , `introtext` , `fulltext` , `state` , `sectionid` , `mask` , `catid` , `created` , `created_by` , `created_by_alias` , `modified` , `modified_by` , `checked_out` , `checked_out_time` , `publish_up` , `publish_down` , `images` , `urls` , `attribs` , `version` , `parentid` , `ordering` , `metakey` , `metadesc` , `access` , `hits` ) VALUES ('". $id ."', '". $title ."', '". $title_alias ."', '". $introtext ."', '". $fulltext ."', '". $state .", '". $sectionid ."', '". $mask ."', '". $catid ."', '". $created ."', '". $created_by ."', '". $creates_by_alias ."', '". $modified ."', '". $modified_by ."', '". $checked_out ."', '". $checked_out_time ."', '". $publish_up ."', '". $publish_down ."', '". $images ."', '". $urls ."', '". $attribs ."', '". $parentid ."', '". $ordering ."', '". $metakey ."', '". $metadesc ."', '". $access ."', '". $hits ."')"; if(!mysql_query($sql)) { echo"Can't insert into the table.<br />" . $sql . "<br />" . mysql_error(); }else{ echo"Helt fint!"; } mysql_close(); Men stadig samme fejl.
08. marts 2005 - 18:56
#29
`id` => '' `title` =>$title `title_alias` => $title_alias `introtext` => $introtext `fulltext` => $fulltext `state` => $state `sectionid` => $sectionid `mask` => $mask `catid` => $catid `created` => $created `created_by` => $created_by `created_by_alias` => $created_by_alias `modified` => $modified `modified_by` => $modified_by `checked_out` => $checked_ou `checked_out_time` => $checked_out_time `publish_up` => $publish_up `publish_down` => $publish_down `images` => $images `urls` => $urls `attribs` => $attribs `version` => $parentid `parentid` => $ordering `ordering` => $metakey `metakey` => $metadesc `metadesc` => $access `access` => $hits `hits` => Altså, det fejler ved $version! Og du glemmer stadig at afslutte med en " og ikke )
08. marts 2005 - 18:58
#30
Sludder: Og du glemmer stadig at afslutte med en " og ikke ) fjern ) til sidst!
08. marts 2005 - 19:15
#31
Bare lige: $sql = "INSERT INTO `mos_content`( `id` , `title` , `title_alias` , `introtext` , `fulltext` , `state` , `sectionid` , `mask` , `catid` , `created` , `created_by` , `created_by_alias` , `modified` , `modified_by` , `checked_out` , `checked_out_time` , `publish_up` , `publish_down` , `images` , `urls` , `attribs` , `version` , `parentid` , `ordering` , `metakey` , `metadesc` , `access` , `hits` ) VALUES ('". $id ."', '". $title ."', '". $title_alias ."', '". $introtext ."', '". $fulltext ."', '". $state .", '". $sectionid ."', '". $mask ."', '". $catid ."', '". $created ."', '". $created_by ."', '". $creates_by_alias ."', '". $modified ."', '". $modified_by ."', '". $checked_out ."', '". $checked_out_time ."', '". $publish_up ."', '". $publish_down ."', '". $images ."', '". $urls ."', '". $attribs ."', 'version', '". $parentid ."', '". $ordering ."', '". $metakey ."', '". $metadesc ."', '". $access ."', '". $hits ."'"; if(!mysql_query($sql)) { echo"Can't insert into the table.<br />" . $sql . "<br />" . mysql_error(); }else{ echo"Helt fint!"; }
09. marts 2005 - 09:17
#32
Jeg kan ikke se hvad fejlen ved $version skulle være. Jeg poster lige hele min kode:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
http://www.w3.org/TR/html4/loose.dtd"> <html>
<head>
<title>Nyt dokument</title>
</head>
<body>
<?php
$id = "";
$title = $_POST[title];
$title_alias = $_POST[title_alias];
$introtext = nl2br($_POST[intro_tekst]);
$fulltext = nl2br($_POST[full_tekst]);
$stat = "0";
$sectionid = $_POST[sectionid];
$mask = "0";
$catid = $_POST[catid];
$created = strtotime("now");
$created_by = $_POST[created_by];
$created_by_alias = $_POST[created_by_alias];
$modified = "0000-00-00 00:00:00";
$modified_by = "0";
$checked_out_time = "0";
$publish_up = strtotime("now");
$publish_down = "0000-00-00 00:00:00";
$images = "";
$urls = "";
$attribs = "menu_image=-1
item_title=1
pageclass_sfx=
back_button=
rating=
author=
createdate=
modifydate=
pdf=
print=
email=";
$version = "1";
$parentid = "0";
$ordering = "0";
$metakey = "";
$metadesc = "";
$access = $_POST[access];
$hits = "0";
mysql_connect ('******', '******', '******');
mysql_select_db ('******');
$sql = "INSERT INTO `mos_content`( `id` , `title` , `title_alias` , `introtext` , `fulltext` , `state` , `sectionid` , `mask` , `catid` , `created` , `created_by` , `created_by_alias` , `modified` , `modified_by` , `checked_out` , `checked_out_time` , `publish_up` , `publish_down` , `images` , `urls` , `attribs` , `version` , `parentid` , `ordering` , `metakey` , `metadesc` , `access` , `hits` )
VALUES ('". $id ."', '". $title ."', '". $title_alias ."', '". $introtext ."', '". $fulltext ."', '". $state .", '". $sectionid ."', '". $mask ."', '". $catid ."', '". $created ."', '". $created_by ."', '". $creates_by_alias ."', '". $modified ."', '". $modified_by ."', '". $checked_out ."', '". $checked_out_time ."', '". $publish_up ."', '". $publish_down ."', '". $images ."', '". $urls ."', '". $attribs ."', 'version', '". $parentid ."', '". $ordering ."', '". $metakey ."', '". $metadesc ."', '". $access ."', '". $hits ."'";
if(!mysql_query($sql)) {
echo"Can't insert into the table.<br />" . $sql . "<br />" . mysql_error();
}else{
echo"Helt fint!";
}
mysql_close();
?>
</body>
</html>
09. marts 2005 - 15:35
#33
Nu har jeg fået det til at virke.sukos kan jeg ikke lige få et svar?
09. marts 2005 - 15:36
#34
Jow da!
Vi tilbyder markedets bedste kurser inden for webudvikling