RE: [PHP-DB] Update data problem

2004-06-23 Thread Justin.Baiocchi
Ok, I was trying to keep it simple :), but here goes:
In essence the problem is that (at the end of the script)
income_out is coming out as just $option_close_price and not the
intended $option_close_price*$no_sold, and
profit_loss is coming out as just -$option_close_price and not the
intended $income_in-$option_close_price*$no_sold.

Justin




\n";
print "IDOpen
DateShareCodeShort or Long
TradeExpiryExcerciseOption
PriceNumber PurchasedNumber SoldIncome
InIncome Out";

while ($row = mysql_fetch_array($result))
{
print "";
print "";
print "";
print $row["id"];
print "";
print $row["open_date"];
print "";
print $row["share"];
print "";
print $row["code"];
print "";
print $row["short_long_trade"];
print "";
print $row["expiry"];
print "";
print $row["excercise"];
print "";
print $row["option_price"];
print "";
print $row["no_purchased"];
print "";
print $row["no_sold"];
print "";
print $row["income_in"];
print "";
print $row["income_out"];
print "\n";

}
print "\n";
?>






  Please enter closing details;

  


  
Closed Date:

  
  
Option Close Price

  
  
Notes

  
  
  
  
 


-Original Message-
From: Sam Chill [mailto:[EMAIL PROTECTED] 
Sent: Thursday, 24 June 2004 3:25 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Update data problem


Justin,
Is the code you posted all of the code or just a small snippet? You
don't appear to be setting $C or $G. Could you post a larger code dump
please?
-Sam

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

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



Re: [PHP-DB] Update data problem

2004-06-23 Thread Sam Chill
Justin,
Is the code you posted all of the code or just a small snippet? You
don't appear to be setting $C or $G. Could you post a larger code dump
please?
-Sam

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



RE: [PHP-DB] Update data problem

2004-06-23 Thread Justin.Baiocchi
Sam, 

I have changed it but the result is still the same:

Basically I am getting $E = $C ,  it seems that it is not picking up the
value of $G (and there is a value of 500 in there and it is the only row
of data).

-Original Message-
From: Sam Chill [mailto:[EMAIL PROTECTED] 
Sent: Thursday, 24 June 2004 2:55 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Update data problem


$E= "$C*$G";
Should be:
$E = $C * $G;

Never use quotation marks when doing math. Quotation marks are used
for strings. Hope that helps.

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

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



Re: [PHP-DB] Update data problem

2004-06-23 Thread Sam Chill
$E= "$C*$G";
Should be:
$E = $C * $G;

Never use quotation marks when doing math. Quotation marks are used
for strings. Hope that helps.

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



[PHP-DB] Update data problem

2004-06-23 Thread Justin.Baiocchi
Hi there, I hoped someone might be able to tell me why this is not
working.
 
 
I have a form that updates the table 'media' with the 3 values below,
that and some other variables are the only data in the table. That works
nicely. 
 
I then want to update one of the other columns ($E) based on the data
I've just submitted - that is the multiplication of the two variables. I
then want to input this variable back into the table. What happens is
that the new values are used ($C), but the original value in the table
($G) is ignored. Why is this? I would have thought it was pretty
straight-froward to extract 2 values from a table, multiply them
together and then input it back as a new variable.
 
Thanks
Justin
 
if($update)
   
{

mysql_pconnect("localhost","root","password");
mysql_select_db("options");
 

$query = "UPDATE media SET A='$A', B='$B', C='$C'";
$result = mysql_query($query);
 
$query = "SELECT C, G FROM media";
$result = mysql_query($query);
 
$E= "$C*$G";

 
$query = "UPDATE media SET E='$E'";
$result = mysql_query($query);

}
 


Re: [PHP-DB] value error in PHP form

2004-06-23 Thread Zachary Krakov
The reason for this is due to the variable "$action" not having any relation
to the action. Therefore, you should use the following if/then statement:

if ($submit !== '') {
// STATEMENTS
}

The "submit" name/value pair variable passed via your form is a named
variable that possesses the value of "Submit Query", so you could
essentially make the if/then statement be:

if ($submit == 'Submit Query') {
// STATEMENTS
}

However, you will have to ensure that the "register_globals" directive has a
value of "Yes" in your PHP.ini configuration file.

If you're unsure of the value of your "register_globals" directive, create
and execute the following script:



This function will state all of the environment variables associated with
your install of PHP on your server.

Hope this helps...
-Zak

On 6/20/04 5:18 AM, "Rinku" <[EMAIL PROTECTED]> wrote:

> Actually I want to use the function like
>  if($action="Login")
> {
> Statements;
> }
> But here I am not getting any value in $action even I click on it.
> When I was using Linux at that time I had not this kind of problem.
> 
> Rinku
> Marvin Hechanova <[EMAIL PROTECTED]> wrote:
> You have to assign values to your name and action
> e.g.
> 
>  [input] " value=Rinku>
>  [input] " type=submit value="Submit Query"
> value="Login">
> 
> but why would you want to print the results?
> 
> 
> On Sun, 20 Jun 2004 04:22:59 -0700 (PDT), Rinku wrote:
>> 
>> Dear All,
>> 
>> I have installed PHP on WinXp. I am using MySql as Backend on Apache server.
>> Now the problem is..
>> I am writing this code :
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>  [input] 
>>  [input] 
>>> print $action;
>> print $Name;
>> ?>
>> 
>> 
>> 
>> Here I should get output as LoginRinku
>> But I am getting nothing.
>> 
>> Can any of you guide me on this?
>> 
>> Regards,
>> Rinku
>> 
>> 
>> -
>> Do you Yahoo!?
>> New and Improved Yahoo! Mail - Send 10MB messages!
> 
> 
> -
> Do you Yahoo!?
> Yahoo! Mail - 50x more storage than other providers!

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



Re: [PHP-DB] value error in PHP form

2004-06-23 Thread Zachary Krakov
Hi Rinku,
One problem I see is that the HTML tags appear to be off... Your HTML is
improperly formatted, which could be causing rendering anomalies to occur,
in addition to the register globals issue which I'll mention shortly. Please
correct your HTML code to read:



YOUR_PAGE_TITLE_HERE


HTML_BODY_HERE



Two, Like Kenny said, change the "register_globals = Off" directive in your
PHP.ini file to " register_globals = On" so that variables are carried from
your form values into your post-processing PHP print functions.

Hope this helps,
Best,
-Zak


On 6/20/04 4:34 AM, "Kenny" <[EMAIL PROTECTED]> wrote:

> This could be due to register globals on/off
> 
> Use
> print $_POST['action'];
> print $_POST['Name'];
> 
> Kenny
> 
> -Original Message-
> From: Rinku [mailto:[EMAIL PROTECTED]
> Sent: 20 June 2004 12:23
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] value error in PHP form
> 
> Dear All,
>  
> I have installed PHP on WinXp. I am using MySql as Backend on Apache
> server.
> Now the problem is..
> I am writing this code :
> 
> 
> 
> 
> 
> 
> 
>  
> 
> 
> 
> 
> 
>  print $action;
> print $Name;
> ?>
> 
> 
> 
> Here I should get output as LoginRinku
> But I am getting nothing.
>  
> Can any of you guide me on this?
>  
> Regards,
> Rinku
> 
> 
>  
>  
> 
> 
> -
> Do you Yahoo!?
> New and Improved Yahoo! Mail - Send 10MB messages!

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



Re: [PHP-DB] Re: problem....

2004-06-23 Thread Philip Thompson
I may be incorrect, but I do not think that by "redefining" the 
variable $pic is destroying its old contents. If you are familiar with 
how programming works, you realize that the "stuff" on the right side 
of the "=" sign is evaluated first, and then assigned to the left side 
of the "=" sign. Because $pic is in the mysql_fetch_array($pic) (on the 
right), $pic is evaluated before it ever gets "destroyed" by the 
redefining.

PHP may not be this way, but I think that it is. If I am incorrect, 
please let me know. I hope this helps out (with something).

~Philip
On Jun 23, 2004, at 11:47 AM, Cole S. Ashcraft wrote:
Kim,
Won't redefining the variable destroy the MySQL Resource, resulting in 
a resource invalid error, like he has?

$pic = mysql_query($sql,$connection); //Defines variable
$pic //Redefining variable, dumps old contents = //calling on an 
invalid MySQL Resource, because it doesn't exist 
mysql_fetch_array($pic);
My comments are in green.

Cole
Kim Steinhaug wrote:
Well, your query looked confusing to me, but break it up like this
First :
   select
Then, name your coloumns, seperate with commas, or use wildcard for 
all
   *
Define from what table you need to select
   FROM database_table
Add some select statements with WHERE
   WHERE
and the statements itself
   1=1

What did I just write now? Looking at your example I guess :
1. you need the coloumns : Rune, username
2. your table : RuneRunner
3. your select criteria : UserID=3
I would then write your SQL query as this :
$sql = "SELECT Rune, username FROM RuneRunner WHERE UserID=3";
Then you could do your code,
$pic = mysql_query($sql,$connection);
$pic = mysql_fetch_array($pic);
You would also want to add a database abstraction layer, as for 
debugging
purposes this will make your life much easier.

Your original code looks to correct if you rewrite it abit, like this 
:

SELECT RuneRunner_1.Rune, RuneRunner_1.username FROM RuneRunner 
RuneRunner_1
WHERE (RuneRunner_1.User_ID=3);

Not tested but it should work fine. On the other hand, the 
referencename
after the
table name should be a short one to make the statement much easier to 
read,
somthing like :

SELECT rr.Rune, rr.username FROM RuneRunner rr WHERE (rr.User_ID=3);
Then again, since you only have one table in your statement there is 
no need
for the reference name,
and since your WHERE clause is a single statement there is no need 
for the
paranthese either.
So you are still back to :

SELECT Rune, username FROM RuneRunner WHERE User_ID=3;
--
--
Kim Steinhaug
--
There are 10 types of people when it comes to binary numbers:
those who understand them, and those who don't.
--
www.steinhaug.com - www.easywebshop.no - www.webkitpro.com
--
"Water_foul" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
why doesn't this work:
$pic=mysql_query('SELECT Rune, username FROM RuneRunner
RuneRunner_1 WHERE (User_ID = 3)',$connection);
$pic=mysql_fetch_array($pic);


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is believed to be clean.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] SQL help

2004-06-23 Thread Gabe
I have tried that and I don't get an error, but I don't get any records 
returned either.  And I have lowered the search string like you 
mentioned.  Here's what I tried ( Access syntax ):

SELECT autoQuesID,fldQuesTitle,fldBody
FROM tblFAQ_Question
WHERE LCase(fldBody) LIKE '%$strSearchFor%';

Nicole Swan wrote:
Have you tried lowering the fldBody as well? Like:
SELECT autoQuesID,fldQuesTitle,fldBody
FROM tblFAQ_Question
WHERE LOWER(fldBody) LIKE '%$strSearchFor%';
And $strSearchFor has already been lowered, of course.
--Nicole
---
Nicole Swan
Web Programming Specialist
Carroll College CCIT
(406)447-4310
-Original Message-
From: Gabe [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 23, 2004 8:59 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] SQL help
I'm using PHP with ADOdb ( and an MS Access 2000 db ) to write a simple 
SQL statement but was running into some case sensitivity issues.  Here's 
my SQL currently:

SELECT autoQuesID,fldQuesTitle,fldBody
FROM tblFAQ_Question
WHERE fldBody LIKE '%$strSearchFor%';
All I'm trying to do is have the users search string searched for in the 
"fldBody" field.  However, I'm having problems trying to get it so that 
the search is case-insensitive.  For instance:

If I search on "Airline", I get 1 record.
If I search on "airline", I get 0 records.
I make the value of $strSearchFor lower case ( using strtolower() ), but 
I don't know how to get it so that the contents of the "fldBody" field 
is lower case also.  I can't seem to find any functions or operators 
that remove the case-sensitivity.

Any help would be much appreciated!
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Re: problem....

2004-06-23 Thread Cole S. Ashcraft
Kim,
Won't redefining the variable destroy the MySQL Resource, resulting in a 
resource invalid error, like he has?

$pic = mysql_query($sql,$connection); //Defines variable
$pic //Redefining variable, dumps old contents = //calling on an invalid MySQL Resource, because it doesn't exist mysql_fetch_array($pic); 

My comments are in green.
Cole
Kim Steinhaug wrote:
Well, your query looked confusing to me, but break it up like this
First :
   select
Then, name your coloumns, seperate with commas, or use wildcard for all
   *
Define from what table you need to select
   FROM database_table
Add some select statements with WHERE
   WHERE
and the statements itself
   1=1
What did I just write now? Looking at your example I guess :
1. you need the coloumns : Rune, username
2. your table : RuneRunner
3. your select criteria : UserID=3
I would then write your SQL query as this :
$sql = "SELECT Rune, username FROM RuneRunner WHERE UserID=3";
Then you could do your code,
$pic = mysql_query($sql,$connection);
$pic = mysql_fetch_array($pic);
You would also want to add a database abstraction layer, as for debugging
purposes this will make your life much easier.
Your original code looks to correct if you rewrite it abit, like this :
SELECT RuneRunner_1.Rune, RuneRunner_1.username FROM RuneRunner RuneRunner_1
WHERE (RuneRunner_1.User_ID=3);
Not tested but it should work fine. On the other hand, the referencename
after the
table name should be a short one to make the statement much easier to read,
somthing like :
SELECT rr.Rune, rr.username FROM RuneRunner rr WHERE (rr.User_ID=3);
Then again, since you only have one table in your statement there is no need
for the reference name,
and since your WHERE clause is a single statement there is no need for the
paranthese either.
So you are still back to :
SELECT Rune, username FROM RuneRunner WHERE User_ID=3;
--
--
Kim Steinhaug
--
There are 10 types of people when it comes to binary numbers:
those who understand them, and those who don't.
--
www.steinhaug.com - www.easywebshop.no - www.webkitpro.com
--
"Water_foul" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
 

why doesn't this work:
$pic=mysql_query('SELECT Rune, username FROM RuneRunner
RuneRunner_1 WHERE (User_ID = 3)',$connection);
$pic=mysql_fetch_array($pic);
   

 


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is believed to be clean.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Re: problem....

2004-06-23 Thread Kim Steinhaug
Well, your query looked confusing to me, but break it up like this

First :
select
Then, name your coloumns, seperate with commas, or use wildcard for all
*
Define from what table you need to select
FROM database_table
Add some select statements with WHERE
WHERE
and the statements itself
1=1

What did I just write now? Looking at your example I guess :
1. you need the coloumns : Rune, username
2. your table : RuneRunner
3. your select criteria : UserID=3

I would then write your SQL query as this :

$sql = "SELECT Rune, username FROM RuneRunner WHERE UserID=3";

Then you could do your code,
$pic = mysql_query($sql,$connection);
$pic = mysql_fetch_array($pic);

You would also want to add a database abstraction layer, as for debugging
purposes this will make your life much easier.

Your original code looks to correct if you rewrite it abit, like this :

SELECT RuneRunner_1.Rune, RuneRunner_1.username FROM RuneRunner RuneRunner_1
WHERE (RuneRunner_1.User_ID=3);

Not tested but it should work fine. On the other hand, the referencename
after the
table name should be a short one to make the statement much easier to read,
somthing like :

SELECT rr.Rune, rr.username FROM RuneRunner rr WHERE (rr.User_ID=3);

Then again, since you only have one table in your statement there is no need
for the reference name,
and since your WHERE clause is a single statement there is no need for the
paranthese either.
So you are still back to :

SELECT Rune, username FROM RuneRunner WHERE User_ID=3;

--
--
Kim Steinhaug
--
There are 10 types of people when it comes to binary numbers:
those who understand them, and those who don't.
--
www.steinhaug.com - www.easywebshop.no - www.webkitpro.com
--

"Water_foul" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> why doesn't this work:
> $pic=mysql_query('SELECT Rune, username FROM RuneRunner
> RuneRunner_1 WHERE (User_ID = 3)',$connection);
> $pic=mysql_fetch_array($pic);

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



RE: [PHP-DB] SQL help

2004-06-23 Thread Swan, Nicole
Have you tried lowering the fldBody as well? Like:

SELECT autoQuesID,fldQuesTitle,fldBody
FROM tblFAQ_Question
WHERE LOWER(fldBody) LIKE '%$strSearchFor%';

And $strSearchFor has already been lowered, of course.

--Nicole
---
Nicole Swan
Web Programming Specialist
Carroll College CCIT
(406)447-4310

-Original Message-
From: Gabe [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 23, 2004 8:59 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] SQL help


I'm using PHP with ADOdb ( and an MS Access 2000 db ) to write a simple 
SQL statement but was running into some case sensitivity issues.  Here's 
my SQL currently:

SELECT autoQuesID,fldQuesTitle,fldBody
FROM tblFAQ_Question
WHERE fldBody LIKE '%$strSearchFor%';

All I'm trying to do is have the users search string searched for in the 
"fldBody" field.  However, I'm having problems trying to get it so that 
the search is case-insensitive.  For instance:

If I search on "Airline", I get 1 record.
If I search on "airline", I get 0 records.

I make the value of $strSearchFor lower case ( using strtolower() ), but 
I don't know how to get it so that the contents of the "fldBody" field 
is lower case also.  I can't seem to find any functions or operators 
that remove the case-sensitivity.

Any help would be much appreciated!

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

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



[PHP-DB] SQL help

2004-06-23 Thread Gabe
I'm using PHP with ADOdb ( and an MS Access 2000 db ) to write a simple 
SQL statement but was running into some case sensitivity issues.  Here's 
my SQL currently:

SELECT autoQuesID,fldQuesTitle,fldBody
FROM tblFAQ_Question
WHERE fldBody LIKE '%$strSearchFor%';
All I'm trying to do is have the users search string searched for in the 
"fldBody" field.  However, I'm having problems trying to get it so that 
the search is case-insensitive.  For instance:

If I search on "Airline", I get 1 record.
If I search on "airline", I get 0 records.
I make the value of $strSearchFor lower case ( using strtolower() ), but 
I don't know how to get it so that the contents of the "fldBody" field 
is lower case also.  I can't seem to find any functions or operators 
that remove the case-sensitivity.

Any help would be much appreciated!
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] problem....

2004-06-23 Thread Jonathan Haddad
Please post the table definition to the mailing list so we can help you 
more quickly.  Also, is there a table called RuneRunner_1 or are you 
meaning to use RuneRunner_1 as an alias?

Odds are, your problem is not PHP related, it's an error in your SQL syntax.
Jon
water_foul wrote:
i fixed those things and it didn't fix it :( :( :( :( :( :( :( :( :( is
there a icq chatroom for php?)
"Shahmat Bin Dahlan" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
 

Your SQL statement:
'SELECT Rune, username FROM RuneRunner
RuneRunner_1 WHERE (User_ID = 3)'
What is "RuneRunner" and "RuneRunner_1"? Are these two different tables.
If it is, you might want to separate them with a comma.
Why not try getting rid of the brackets surrounding "User_ID=3"? And
also wrap single quotes around the digit "3".
- Original Message -
From: "water_foul" <[EMAIL PROTECTED]>
Date: Wednesday, June 23, 2004 8:58 am
Subject: Re: [PHP-DB] problem
   

I checked em all they were right
"Daniel Clark" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
 

Sounds like it doesn't like your SQL statement.  Perhaps a field
   

or table
 

name is incorrect?
   

Warning: mysql_fetch_array(): supplied argument is not a valid
 

MySQL> > result
 

resource in ...
"Daniel Clark" <[EMAIL PROTECTED]> wrote in message
 

news:[EMAIL PROTECTED]>
 

What error are you getting?
   

why doesn't this work:
$pic=mysql_query('SELECT Rune, username FROM
 

RuneRunner> >> > RuneRunner_1 WHERE (User_ID = 3)',$connection);
 

$pic=mysql_fetch_array($pic);
 

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

 

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


Re[2]: [PHP-DB] problem....

2004-06-23 Thread Pablo M. Rivas
Hello water_foul,


 what about this?

If you do for the first time: $pic=mysql_fetch_array($pic) it will
work, but the SECOND TIME that you do:
$pic=mysql_fetch_array($pic) it will fail, and thats because $pic
is no longer a resource identificator... and you will get:

> > Warning: mysql_fetch_array(): supplied argument is not a valid MySQL
> > result
>  
try this:

$pic=mysql_query("Select Rune, username FROM runeRunner where
(User_ID=3)0,$connection);

$xx=mysql_fetch_array($pic);



do you follow me?...



> >> > why doesn't this work:
> >> > $pic=mysql_query('SELECT Rune, username FROM RuneRunner
> >> > RuneRunner_1 WHERE (User_ID = 3)',$connection);
> >> > $pic=mysql_fetch_array($pic);


P.S. if you need to trace, you can do  var_dump($pic);

-- 
Best regards,
 Pablo

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



RE: [PHP-DB] problem....

2004-06-23 Thread Hutchins, Richard
Haven't seen that this has been solved yet so I thought I'd throw my two
cents into the fray. First of all, I'd second the earlier suggestion that
you assign your query to a variable. And, second, I'd recommend that you
echo out your query to the browser just before it is submitted to the
database server. That way, you can actually _see_ what's being sent to the
server. I have found this to be an invaluable troubleshooting tactic and it
may help you find the root cause of your invalid MySQL result.


> -Original Message-
> From: David Robley [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, June 23, 2004 2:53 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] problem
> 
> 
> Water_foul wrote:
> 
> > i fixed those things and it didn't fix it :( :( :( :( :( :( 
> :( :( :( is
> > there a icq chatroom for php?)
> > "Shahmat Bin Dahlan" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> >> Your SQL statement:
> >>
> >> 'SELECT Rune, username FROM RuneRunner
> >> RuneRunner_1 WHERE (User_ID = 3)'
> >>
> >> What is "RuneRunner" and "RuneRunner_1"? Are these two 
> different tables.
> >> If it is, you might want to separate them with a comma.
> >>
> >> Why not try getting rid of the brackets surrounding 
> "User_ID=3"? And
> >> also wrap single quotes around the digit "3".
> >>
> >>
> >> - Original Message -
> >> From: "water_foul" <[EMAIL PROTECTED]>
> >> Date: Wednesday, June 23, 2004 8:58 am
> >> Subject: Re: [PHP-DB] problem
> >>
> >> > I checked em all they were right
> >> > "Daniel Clark" <[EMAIL PROTECTED]> wrote in message
> >> > 
> news:[EMAIL PROTECTED]
> >> > > Sounds like it doesn't like your SQL statement.  
> Perhaps a field
> >> > or table
> >> > > name is incorrect?
> >> > >
> >> > > > Warning: mysql_fetch_array(): supplied argument is 
> not a valid
> >> > MySQL> > result
> >> > > > resource in ...
> >> > > > "Daniel Clark" <[EMAIL PROTECTED]> wrote in message
> >> > > >
> >> > 
> news:[EMAIL PROTECTED]>
> >> >> What error are you getting?
> >> > > >>
> >> > > >> > why doesn't this work:
> >> > > >> > $pic=mysql_query('SELECT Rune, username FROM
> >> > RuneRunner> >> > RuneRunner_1 WHERE (User_ID = 
> 3)',$connection);
> >> > > >> > $pic=mysql_fetch_array($pic);
> >> >
> 
> Two suggestions for debugging mysql problems:
> 
> 1) Create your query as a variable so you can echo it and see 
> exactly what
> is being passed to mysql
> 
> $query = "SELECT Rune, username FROM RuneRunner, RuneRunner_1 
> WHERE User_ID
> = 3";
> 
> 2) Use mysql_error() to get the actual error from mysql
> $result = mysql_query($query,$connection);
> echo mysql_error();
> $pic=mysql_fetch_array($result);
> 
> -- 
> David Robley
> 
> "I'd like to learn a new card game," Tom said wistfully.
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



Re: [PHP-DB] Value Error in execution

2004-06-23 Thread jeffrey_n_Dyke




>Dear all,
>Can you aswer for the Query as follow :
>if(isset(_POST['VARIABLE1']$$(_POST['VARIABLE2'])
>{>print "testing";
>STATEMENTS;
>}

I'm not sure how this is not throwing a fatal error.  Why do you have two
$'s in the middle and no $ preceeding variable names?

does this work?
if(isset($_POST['VARIABLE1']) && isset($_POST['VARIABLE2']) ) {
  print "testing";
}

HTH
Jeff


-
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!

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



[PHP-DB] Value Error in execution

2004-06-23 Thread Rinku
Dear all,
 
Can you aswer for the Query as follow :
 
if(isset(_POST['VARIABLE1']$$(_POST['VARIABLE2'])
{
print "testing";
STATEMENTS;
}
 
 Here, even I havent set the value for the variables then even I am getting the output 
like "testing".
 
Can any of you suggest me the sollution for the query ?
 
Thanks,
Rinku


-
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!

[PHP-DB] Re: Multiple Inserts

2004-06-23 Thread Achieve IT
Solved... I needed to find a way to get the latest auto_increment value.
I did this using,

$new_id = mysql_insert_id();

Thanks,
Declan.


Thanks for the suggestions. I have
$TimeSheetID=$_POST['TimeSheetID'];
at the start of the script. However, what I neglected to mention is that
TimeSheetID is auto_increment, in first table, tblTimesheet.

I will try the other suggestions, and respond with my results.

Thanks,
Declan.


---
Good point.  Since it's form data, what about $_POST['TimesheetID'] ?

> Don't see anything obviously wrong with your query string. Are the inserts
> happening in the same block of code, i.e., are you sure that
> _$TimesheetID_ has a value in it when you're performing the second insert?
>
>
> -dave
>
>
>> I am using a form to Insert data into 2 tables in the same database.
>
>> $TimesheetID needs to be in each table. However, it is not being
> inserted
>> into the second table, "tblTimesheetDetails" . Any advise?
>
>> $result_timesheet=mysql_query("INSERT INTO tblTimesheet (TimesheetID,
>> WorkerID, ClientID, TimesheetDate, ProspectiveOrRetrospective) VALUES
>>
>
('$TimeSheetID','$WorkerID','$ClientID','$TimesheetDate','$ProspectiveOrRetr
>> ospective')")or die("Insert Error: ".mysql_error());
>
>> $result_timesheetdetails=mysql_query("INSERT INTO tblTimesheetDetails
>> (TimesheetID, ActivityTypeID, TimeSpentHours, TimeSpentMinutes) VALUES
>>
>
('$TimeSheetID','$ActivityTypeID','$TimeSpentHours','$TimeSpentMinutes')")or
>> die("Insert Error: ".mysql_error());
>

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



Re: [PHP-DB] adding a mysql query as text into a history table... ?

2004-06-23 Thread Gawie Marais
thanx guys.


"Jason Wong" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Wednesday 23 June 2004 17:14, Gawie Marais wrote:
>
> > i would like to add the whole query into a text field in the 'history'
> > table, but i get errors when i try to add it... can anyone help ?
> >
> > this is the error :-
> >
> > Invalid query: You have an error in your SQL syntax near '2004-06-23
> > 11:09:57', date_modified = '-00-00 00:00:00', date_closed =' at line
6
>
> You'll need to escape the string containing the query before you can
insert
> it.
>
> -- 
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> --
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-db
> --
> /*
> If you always postpone pleasure you will never have it.  Quit work and
play
> for once!
> */

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



Re: [PHP-DB] Multiple Inserts

2004-06-23 Thread Achieve IT
Thanks for the suggestions. I have 
$TimeSheetID=$_POST['TimeSheetID'];
at the start of the script. However, what I neglected to mention is that TimeSheetID 
is auto_increment, in first table, tblTimesheet.

I will try the other suggestions, and respond with my results.

Thanks,
Declan.


---
Good point.  Since it's form data, what about $_POST['TimesheetID'] ?

> Don't see anything obviously wrong with your query string. Are the inserts
> happening in the same block of code, i.e., are you sure that
> _$TimesheetID_ has a value in it when you're performing the second insert?
>
>
> -dave
>
>
>> I am using a form to Insert data into 2 tables in the same database.
>
>> $TimesheetID needs to be in each table. However, it is not being
> inserted
>> into the second table, "tblTimesheetDetails" . Any advise?
>
>> $result_timesheet=mysql_query("INSERT INTO tblTimesheet (TimesheetID,
>> WorkerID, ClientID, TimesheetDate, ProspectiveOrRetrospective) VALUES
>>
> ('$TimeSheetID','$WorkerID','$ClientID','$TimesheetDate','$ProspectiveOrRetr
>> ospective')")or die("Insert Error: ".mysql_error());
>
>> $result_timesheetdetails=mysql_query("INSERT INTO tblTimesheetDetails
>> (TimesheetID, ActivityTypeID, TimeSpentHours, TimeSpentMinutes) VALUES
>>
> ('$TimeSheetID','$ActivityTypeID','$TimeSpentHours','$TimeSpentMinutes')")or
>> die("Insert Error: ".mysql_error());
>


Re: [PHP-DB] adding a mysql query as text into a history table... ?

2004-06-23 Thread Jason Wong
On Wednesday 23 June 2004 17:14, Gawie Marais wrote:

> i would like to add the whole query into a text field in the 'history'
> table, but i get errors when i try to add it... can anyone help ?
>
> this is the error :-
>
> Invalid query: You have an error in your SQL syntax near '2004-06-23
> 11:09:57', date_modified = '-00-00 00:00:00', date_closed =' at line 6

You'll need to escape the string containing the query before you can insert 
it.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
If you always postpone pleasure you will never have it.  Quit work and play
for once!
*/

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



[PHP-DB] adding a mysql query as text into a history table... ?

2004-06-23 Thread Gawie Marais
hi guys,

i have created a 'history' table and would like to insert the 'bare' sql
query into that table just to check who did what on the database...

now, i have this :-

$CustUpdate = "INSERT INTO record SET
recid = '',
customer_code = '$varCustomerCode',
id_reg = '$varId_Reg',
date_added = '$getCurrentDate',
  date_modified = '-00-00 00:00:00',
  date_closed = '-00-00 00:00:00',
  technician = '$varConsultant',
  flag = '$flag',
  contact_person = '$varContactPerson',
  contact_number = '$varContactNumber',
  contact_email = '$varContactEmail',
  problem_type = '$varProblemType',
  problem_description = '$varProblemDescription',
  priority = '$varPriority',
  technical_feedback = '',
  customer_name = '$varCustomerName'
  ";

i would like to add the whole query into a text field in the 'history'
table, but i get errors when i try to add it... can anyone help ?

this is the error :-

Invalid query: You have an error in your SQL syntax near '2004-06-23
11:09:57', date_modified = '-00-00 00:00:00', date_closed =' at line 6

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



[PHP-DB] Re: Multiple Inserts

2004-06-23 Thread Rui Cunha
some tips when inserting data: 

instead of inserting  into the the table, do some debugging,echo the insert 
string and check if: 

1- all string fields are between single comma ('field_name').Numéric fields 
do not need single comma;
2- all not null fields are present in the field list;
3- you're respecting the fields order (insert into t (x,y,z) values 
(val_x,val_y,val_z) ); 

hope it helps. 

Rui Cunha 

Daniel Clark writes: 

Any errors?   Is the all the other data inserting into the second table? 

Hello,
I am using a form to Insert data into 2 tables in the same database. 

$TimesheetID needs to be in each table. However, it is not being inserted
into the second table, "tblTimesheetDetails" . Any advise? 

$result_timesheet=mysql_query("INSERT INTO tblTimesheet (TimesheetID,
WorkerID, ClientID, TimesheetDate, ProspectiveOrRetrospective) VALUES
('$TimeSheetID','$WorkerID','$ClientID','$TimesheetDate','$ProspectiveOrRetr
ospective')")or die("Insert Error: ".mysql_error()); 

$result_timesheetdetails=mysql_query("INSERT INTO tblTimesheetDetails
(TimesheetID, ActivityTypeID, TimeSpentHours, TimeSpentMinutes) VALUES
('$TimeSheetID','$ActivityTypeID','$TimeSpentHours','$TimeSpentMinutes')")or
die("Insert Error: ".mysql_error()); 

Thanks,
Declan.

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


Re: [PHP-DB] problem....

2004-06-23 Thread David Robley
Water_foul wrote:

> i fixed those things and it didn't fix it :( :( :( :( :( :( :( :( :( is
> there a icq chatroom for php?)
> "Shahmat Bin Dahlan" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>> Your SQL statement:
>>
>> 'SELECT Rune, username FROM RuneRunner
>> RuneRunner_1 WHERE (User_ID = 3)'
>>
>> What is "RuneRunner" and "RuneRunner_1"? Are these two different tables.
>> If it is, you might want to separate them with a comma.
>>
>> Why not try getting rid of the brackets surrounding "User_ID=3"? And
>> also wrap single quotes around the digit "3".
>>
>>
>> - Original Message -
>> From: "water_foul" <[EMAIL PROTECTED]>
>> Date: Wednesday, June 23, 2004 8:58 am
>> Subject: Re: [PHP-DB] problem
>>
>> > I checked em all they were right
>> > "Daniel Clark" <[EMAIL PROTECTED]> wrote in message
>> > news:[EMAIL PROTECTED]
>> > > Sounds like it doesn't like your SQL statement.  Perhaps a field
>> > or table
>> > > name is incorrect?
>> > >
>> > > > Warning: mysql_fetch_array(): supplied argument is not a valid
>> > MySQL> > result
>> > > > resource in ...
>> > > > "Daniel Clark" <[EMAIL PROTECTED]> wrote in message
>> > > >
>> > news:[EMAIL PROTECTED]>
>> >> What error are you getting?
>> > > >>
>> > > >> > why doesn't this work:
>> > > >> > $pic=mysql_query('SELECT Rune, username FROM
>> > RuneRunner> >> > RuneRunner_1 WHERE (User_ID = 3)',$connection);
>> > > >> > $pic=mysql_fetch_array($pic);
>> >

Two suggestions for debugging mysql problems:

1) Create your query as a variable so you can echo it and see exactly what
is being passed to mysql

$query = "SELECT Rune, username FROM RuneRunner, RuneRunner_1 WHERE User_ID
= 3";

2) Use mysql_error() to get the actual error from mysql
$result = mysql_query($query,$connection);
echo mysql_error();
$pic=mysql_fetch_array($result);

-- 
David Robley

"I'd like to learn a new card game," Tom said wistfully.

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