RE: Inserting data at runtime (php,mysql)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



conn denotes a constant where the value you are assigning is to the variable
$conn

[snip]
 >>> $conn=mysql_connect(" ");/*with the required parameters*/
if(!conn) <<<
[/snip]

Depending on your error level this may evaluate to TRUE creating a false
positive

Or am I wrong?

Dan

-----------------------------------------------------
Dan Parry
Senior Developer
Virtua Webtech Ltd
http://www.virtuawebtech.co.uk

-----Original Message-----
From: sathyashrayan [mailto:foraci@xxxxxxxxx] 
Sent: 21 March 2006 12:45
To: Dan Parry; php-general@xxxxxxxxxxxxx
Subject: Re:  Inserting data at runtime (php,mysql)


----- Original Message ----- 
From: "Dan Parry" <dan@xxxxxxxxxxxxxxxxxxx>
To: "'sathyashrayan'" <foraci@xxxxxxxxx>; <php-general@xxxxxxxxxxxxx>
Sent: Tuesday, March 21, 2006 6:12 PM
Subject: RE:  Inserting data at runtime (php,mysql)


> [snip]
> $conn=mysql_connect(" ");/*with the required parameters*/
> if(!conn) <<<
> {
> [/snip]
>
> You are testing conn in your if condition... should that not be $conn?
>
> Dan
>


  No if conn evaluates to false then error.


> -----------------------------------------------------
> Dan Parry
> Senior Developer
> Virtua Webtech Ltd
> http://www.virtuawebtech.co.uk
> -----Original Message-----
> From: sathyashrayan [mailto:foraci@xxxxxxxxx]
> Sent: 21 March 2006 12:20
> To: php-general@xxxxxxxxxxxxx
> Subject:  Inserting data at runtime (php,mysql)
>
>  I have given a task to create a site which is a clone of www.onelook.com.
> As a first stage I have downloaded a list of English words (only words not
> meaning)
> in a text format. I have created a data structure in the mysql database. 
> And
> wrote the
> following code to insert data into the table at the run time.
>
> The code:
>
> <?php
> $counter = 0;
> $conn=mysql_connect(" ");/*with the required parameters*/
> if(!conn)
> {
>  die('could not connect:'.mysql_error());
> }
> echo "connection sucess\n";
>        $file_op = fopen("my_dic.txt","r");
>  while(!feof($file_op) && $file_op != NULL)
>  {
>   $funct_var = fgets($file_op);
>   while($funct_var)
>   {
>
>                                $qure = "INSERT INTO dict VALUES
> ($counter,'$funct_var')";
>                $str =  mysql_query($qure);
>    $counter++;
>    return;
>   }
>   fclose($file_op);
>  }
>
>
> ?>
>
> The connection is successful but the data are not getting inserted into 
> the
> table. I need to insert all the words into the table.
> When I change the insert statement with one insert at a time, I can 
> insert
> values to the database. For exampel:
>
> $qure = "INSERT INTO dict VALUES (1,'apple')";
>
> Do I need to check the formatted data in the file?
>
> Can any one help me in this regard?
>
> I have been working in VC++ for some time.
>
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux