473,787 Members | 2,971 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

unexpected T_VARIABLE, expecting '{'

7 New Member
Someone please see what the problem is.. I have getting an error: Parse error: syntax error, unexpected T_VARIABLE, expecting '{' in /customers/test-dig.dk/test-dig.dk/httpd.www/database.inc.ph p on line 3

my php codes are:

Expand|Select|Wrap|Line Numbers
  1.  <? 
  2. function connectDatabase()
  3.     $connect=mysql_connect("test_dig_dk", "test_dig_dk", "myusercode");
  4.     $select=mysql_select_db("ib",$connect);
  5.     if(!$connect || !$select)
  6.     {
  7.         ?>
  8.         <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  9.         <html xmlns="http://www.w3.org/1999/xhtml">
  10.         <head>
  11.         <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  12.         <title>Fehler beim Verbinden mit der Datenbank</title>
  13.         </head>
  14.         <body>
  15.         <p>Es ist beim Verbinden mit der Datenbank ein Fehler aufgetreten!</p>
  16.         </body>
  17.         </html>
  18.         <?
  19.         exit();
  20.     }
  21. }
  22. ?>
  23.  
Jul 10 '07 #1
10 2710
ak1dnar
1,584 Recognized Expert Top Contributor
Hi kilo,
Welcome to TSDN.

Mr.Php is expecting '{'
So put it there as he said.

Expand|Select|Wrap|Line Numbers
  1. function connectDatabase()
  2. {
  3.  
I have some doubts with your script anyway. Are you trying to connect to mySQL DB?

Thanks,
-Ajaxrand
Jul 10 '07 #2
ak1dnar
1,584 Recognized Expert Top Contributor
This might usefull to you, for your next post.
[code] tags

This time I made the job for you! :)

Thanks!
-Ajaxrand
Jul 10 '07 #3
pbmods
5,821 Recognized Expert Expert
Changed thread title to better describe the problem (did you know that threads whose titles contain phrases such as, 'please help' actually get FEWER responses?).
Jul 10 '07 #4
kilo
7 New Member
That did help.. { ??... Thank you very much.
Jul 10 '07 #5
kilo
7 New Member
Hi kilo,
Welcome to TSDN.

Mr.Php is expecting '{'
So put it there as he said.

Expand|Select|Wrap|Line Numbers
  1. function connectDatabase()
  2. {
  3.  
I have some doubts with your script anyway. Are you trying to connect to mySQL DB?

Thanks,
-Ajaxrand
Hi ajaxrand. Yes?? I think so...
It's a program that I payed for, to help people to read and write Danish. the program should make the dictations and save it to a database, were people can
load them. The main frame of the php is database.inc.ph p were all php tools use to make a connections to DB to save and upload...
If you can make this happen that all my php's are working. I have no problem discuse your payment for your help.
Jul 10 '07 #6
ak1dnar
1,584 Recognized Expert Top Contributor
Hi ajaxrand. Yes?? I think so...
It's a program that I payed for, to help people to read and write Danish. the program should make the dictations and save it to a database, were people can
load them. The main frame of the php is database.inc.ph p were all php tools use to make a connections to DB to save and upload...
If you can make this happen that all my php's are working. I have no problem discuse your payment for your help.
Hi Kilo,

The Scripts Developer Network is a free forum and Community members are ready to help you Free of Charge.

If you paid for the softtware tool you have the rights to fix it up from themselves.

Any way your Problem is still unclear for me.What is not working part of your script.

Thanks :)
Jul 11 '07 #7
kilo
7 New Member
I having small proplems. I think. I've getting some errors 3 at all....

If we can take one at the time.

One of them are: Warning: mysql_fetch_arr ay(): supplied argument is not a valid MySQL result resource in /customers/test-dig.dk/test-dig.dk/httpd.www/ib/select_audio.ph p on line 27

The php code are:

Expand|Select|Wrap|Line Numbers
  1. <?
  2.     require("database.inc.php");
  3. {    connectDatabase();
  4. ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
  5. <html xmlns="http://www.w3.org/1999/xhtml">
  6. <head>
  7. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  8. <title>V&aelig;lg lyd til <?=$_POST['title']?></title>
  9. <link href="style.css" rel="stylesheet" type="text/css" />
  10. </head>
  11.  
  12. <body>
  13. <? if(file_exists("text/".$_POST['title'].".txt")) {
  14. ?>
  15. <h1>V&aelig;lg lyd</h1>
  16. <h3 style="color:#CC3333">Pas p&aring;! Der findes allerede et diktat med denne titel.<br />
  17. Hvis du er ved at lave et nyt diktat, burde du g&aring; <a href="javascript:history.back()">tilbage</a> og v&aelig;lge en anden titel.
  18. G&oslash;r du ikke det, bliver diktatet med titelen &quot;<?=$_POST['title']?>&quot; erstattet med dette diktat her!</h3>
  19. <?
  20. }
  21. ?>
  22. <form enctype="multipart/form-data" action="save_dict.php" method="post">
  23. <input type="hidden" name="MAX_FILE_SIZE" value="500000" />
  24. <table border="0">
  25. <?
  26.     $result=mysql_query("SELECT word FROM repository;");
  27.     while($entry=mysql_fetch_array($result)) {
  28.         $repository[]=$entry[0];
  29.     }
  30.     $word_start=0;
  31.     $word_stop=0;
  32.     $open=false;
  33.     $words=array();
  34.     $content=$_POST['content'];
  35.     for($i=0;$i<strlen($content);$i++) {
  36.         if(substr($content,$i,1)=="<" && !$open) {
  37.             $word_start=$i+1;
  38.             $open=true;
  39.         }
  40.         elseif(substr($content,$i,1)==">" && $open) {
  41.             $word_stop=$i;
  42.             $word=substr($content,$word_start,$word_stop-$word_start);
  43.             if(!in_array($word,$repository)) {
  44.                 $words[]=$word;
  45.                 ?>
  46.                 <tr>
  47.                     <td><?=$word?></td>
  48.                     <td><input type="file" name="<?=$word?>" /></td>
  49.                 </tr>
  50.                 <?
  51.             }
  52.             $open=false;
  53.         }
  54.     }
  55. ?>
  56. </table>
  57. <input type="hidden" name="words" value="<? echo implode(";",$words); ?>" />
  58. <input type="hidden" name="content" value="<?=$_POST['content']?>" />
  59. <input type="hidden" name="title" value="<?=$_POST['title']?>" />
  60. <input type="submit" value="Upload &amp; gem" />
  61. </form>
  62. </body>
  63. </html>
[Please use CODE tags when posting source code. Thanks! --pbmods]
Jul 11 '07 #8
pbmods
5,821 Recognized Expert Expert
kilo, use CODE tags around your code.

Review the REPLY GUIDELINES on the right next time you post.

Thanks!

MODERATOR
Jul 11 '07 #9
kilo
7 New Member
OK. I get it now

I have spoking to the company and it has been shout down. It's only one man sitting there.. what a shame..
I hope so much that you can help me through this..

Can you see what the following error mains:

Warning: mysql_fetch_arr ay(): supplied argument is not a valid MySQL result resource in /customers/test-dig.dk/test-dig.dk/httpd.www/ib/select_audio.ph p on line 27

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /customers/test-dig.dk/test-dig.dk/httpd.www/ib/select_audio.ph p on line 43

PHP code:

Expand|Select|Wrap|Line Numbers
  1. <?
  2.     require("database.inc.php");
  3.     connectDatabase();
  4. ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
  5. <html xmlns="http://www.w3.org/1999/xhtml">
  6. <head>
  7. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  8. <title>V&aelig;lg lyd til <?=$_POST['title']?></title>
  9. <link href="style.css" rel="stylesheet" type="text/css" />
  10. </head>
  11.  
  12. <body>
  13. <? if(file_exists("text/".$_POST['title'].".txt")) {
  14. ?>
  15. <h1>V&aelig;lg lyd</h1>
  16. <h3 style="color:#CC3333">Pas p&aring;! Der findes allerede et diktat med denne titel.<br />
  17. Hvis du er ved at lave et nyt diktat, burde du g&aring; <a href="javascript:history.back()">tilbage</a> og v&aelig;lge en anden titel.
  18. G&oslash;r du ikke det, bliver diktatet med titelen &quot;<?=$_POST['title']?>&quot; erstattet med dette diktat her!</h3>
  19. <?
  20. }
  21. ?>
  22. <form enctype="multipart/form-data" action="save_dict.php" method="post">
  23. <input type="hidden" name="MAX_FILE_SIZE" value="500000" />
  24. <table border="0">
  25. <?
  26.     $result=mysql_query("SELECT word FROM repository;");
  27.     while($entry=mysql_fetch_array($result)) {
  28.         $repository[]=$entry[0];
  29.     }
  30.     $word_start=0;
  31.     $word_stop=0;
  32.     $open=false;
  33.     $words=array();
  34.     $content=$_POST['content'];
  35.     for($i=0;$i<strlen($content);$i++) {
  36.         if(substr($content,$i,1)=="<" && !$open) {
  37.             $word_start=$i+1;
  38.             $open=true;
  39.         }
  40.         elseif(substr($content,$i,1)==">" && $open) {
  41.             $word_stop=$i;
  42.             $word=substr($content,$word_start,$word_stop-$word_start);
  43.             if(!in_array($word,$repository)) {
  44.                 $words[]=$word;
  45.                 ?>
  46.                 <tr>
  47.                     <td><?=$word?></td>
  48.                     <td><input type="file" name="<?=$word?>" /></td>
  49.                 </tr>
  50.                 <?
  51.             }
  52.             $open=false;
  53.         }
  54.     }
  55. ?>
  56. </table>
  57. <input type="hidden" name="words" value="<? echo implode(";",$words); ?>" />
  58. <input type="hidden" name="content" value="<?=$_POST['content']?>" />
  59. <input type="hidden" name="title" value="<?=$_POST['title']?>" />
  60. <input type="submit" value="Upload &amp; gem" />
  61. </form>
  62. </body>
  63. </html>
  64.  
Jul 11 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

4
2966
by: mooneater | last post by:
Hallo, ich bin neu mit dem Umgang mit PHP, und ich habe folgendes (siehe unten) programmiert. Nun erhalte ich bei Aufruf meiner PHP-Datei folgende Fehlermeldung: Parse error: parse error, unexpected T_VARIABLE in C:\php5xampp-dev\htdocs\liteshop\liteshop.php on line "wo 'var $username = $ls_user;' steht"
6
19029
by: Ehartwig | last post by:
I recently created a script for user verification, solved my emailing issues, and then re-created the script in order to work well with the new PHP 5 that I installed on my server. After submitting user information into my creation script, I get the following error from the page that is suppose to insert the user data into the database, create a code, then send an email out for verification. Parse error: parse error, unexpected $end in...
2
1951
by: aamer | last post by:
can anyone please help me, im getting a dumb: Parse error: syntax error, unexpected T_VARIABLE in /home/jeddah/public_html/lomar/cart/remove.php on line 5 in the following file, <?php require_once('../include/top.php');?> <? $urlpara_local="clickmenuid=$clickmenuid&smenuid=$smenuid&pageNum_product_rec=$pageNum_product_rec&totalRows_product_rec=$totalRows_product_rec&totrec=$totrec";...
5
13176
by: Anna MZ | last post by:
I am new to php and have written the following mysql code to enter the details of a new user in the admin subdomain of my website: $sql = "INSERT INTO 'users' ('userid', 'username', 'upassword') VALUES ('$_POST', '$_POST', '$_POST') mysql_query($sql)"; When I view the code in Internet Explorer I get the following error message: Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or...
1
2334
epots9
by: epots9 | last post by:
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /var/www/html/xxx.php on line xxx I get that message when i try to run my script, but if i disable an if statement (code below) then my code functions correctly... if($specs == "DT") { $angle = $specs; $rating = $specs; if($angle == "00" || $angle == "30")
3
2143
crystal2005
by: crystal2005 | last post by:
I found such eror message when i tried to test sending email. Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /www/110mb.com/h/e/a/v/e/n/t/u/heaventure/htdocs/send_contact.php on line 10 Do we have to set something on the hosting server in order to be able to send message?? This is my code that i encountered the problem
3
6949
by: SilvaZodiac | last post by:
Hi everyone, I'm still rather new to PHP code, and I have a syntax error. I've tried several different solutions, but it won't fix. It seems to suggest that I need a new bracket somewhere in the offending line, but being amateur, I don't know where. I've tried putting one in several places, to no avail. Clearly, to solve this in a smaller period than a week I need someone with more skill to help out. Heh heh. The error is: Parse error:...
5
10035
praclarush
by: praclarush | last post by:
I've just started php, and this is a class assignment, but my question is I’m getting this error PHP Parse error: syntax error, unexpected T_IF, expecting T_VARIABLE or '$' in C:\wamp\www\ssp\SSP04\guessingGame.php on line 42. I’ve tried to make sense of it but I’m at a lose, there error is referring to this segment of the code. else{ if(!isset($_GET)){ echo "<p>****</p>"; $guess = "****"; }//end if //declaring some...
2
3245
by: fburn | last post by:
I need some help with an error I'm getting using php 5.2.5 running on linux. I receive an error: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /var/www/html/inventoryControl/supplier.php on line 26 (line number changed to match code tags) The code is as follows: // get a supplier using the supplier id
0
9655
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10363
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10110
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6749
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5398
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4067
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.