473,327 Members | 1,952 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

unexpected T_VARIABLE, expecting '{'

7
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.php 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 2677
ak1dnar
1,584 Expert 1GB
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 Expert 1GB
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 Expert 4TB
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
That did help.. { ??... Thank you very much.
Jul 10 '07 #5
kilo
7
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.php 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 Expert 1GB
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.php 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
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_array(): supplied argument is not a valid MySQL result resource in /customers/test-dig.dk/test-dig.dk/httpd.www/ib/select_audio.php 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 Expert 4TB
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
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_array(): supplied argument is not a valid MySQL result resource in /customers/test-dig.dk/test-dig.dk/httpd.www/ib/select_audio.php 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.php 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
pbmods
5,821 Expert 4TB
Heya, Kilo.

On line 27, right after you mysql_query(), add this code:
Expand|Select|Wrap|Line Numbers
  1. if(! $result)
  2.     exit(mysql_error());
  3.  
Jul 11 '07 #11

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

Similar topics

4
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,...
6
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...
2
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...
5
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')...
1
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...
3
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...
3
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...
5
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...
2
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.