RE: [PHP-DB] Drop down box NOT populated

2004-01-23 Thread Humberto Silva
I confess i didn't read the original post ... 
You're absolutely right ...

Humberto Silva
World Editing
Portugal
 


-Original Message-
From: John W. Holmes [mailto:[EMAIL PROTECTED] 
Sent: sexta-feira, 23 de Janeiro de 2004 16:03
To: Humberto Silva
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Drop down box NOT populated


From: "Humberto Silva" <[EMAIL PROTECTED]>

> Instead of:
> > $row = mysql_fetch_array($sql)
>
> Use:
> $row = mysql_fetch_assoc($sql)

While I'm in the habit of doing that, using fetch_array() isn't going to
cause any problems with regard to the original post. Which one you use
is really a matter of personal opinion and rarely affects the code.

---John Holmes...

-- 
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] Drop down box NOT populated

2004-01-23 Thread Humberto Silva
Instead of:
> $row = mysql_fetch_array($sql)

Use:
$row = mysql_fetch_assoc($sql)


 
Humberto Silva
World Editing
Portugal
 


-Original Message-
From: John W. Holmes [mailto:[EMAIL PROTECTED] 
Sent: sexta-feira, 23 de Janeiro de 2004 15:42
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Drop down box NOT populated


From: <[EMAIL PROTECTED]>

> Jsut a guess...
> Your row has a capital 'A' in the SQL statement, and a lower case 'a' 
> in teh $row[] call..
>
> does that matter?

Yep, that would matter, but not the exact problem. I don't know if this
thread has already been answered or not, so...

The real problem is with this:

> $sql = mysql_query("SELECT distinct(Account) FROM Backlog")or die 
> ("Something bad happened here: " . mysql_error()) ;
>
> echo "\n";
> echo "\n";
>
> while ($row = mysql_fetch_array($sql))
>   {
>   echo '  value="'.$row["account"].'">'.$row["account"]."\n";

because there is no "account" index in $row. You're not selecting
"account", you're selecting "distinct(Account)".

So, you could do it the hard way and use $row['distinct(Account)'] as
your value or change your SQL to:

$sql = mysql_query("SELECT distinct(Account) AS acc FROM Backlog")or die

and use $row['acc']. This is called making an alias. You alias the
distinct(account) column to be called "acc". You can name the alias what
ever you want.

If you developed with your error_reporting() set to E_ALL, you'd have
gotten a notice about "Undefined index 'account' in $row" that may have
tipped you off to all of this.

Hope this helps.

---John Holmes...

-- 
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] i want to unsubscribe

2004-01-19 Thread Humberto Silva
Correction:

Send an email to: 
[EMAIL PROTECTED] 
 
Humberto Silva
World Editing
Portugal
 


-Original Message-
From: Humberto Silva 
Sent: segunda-feira, 19 de Janeiro de 2004 12:49
To: Hutchins, Richard
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] i want to unsubscribe


Send an email to:
[EMAIL PROTECTED] 
 
Humberto Silva
World Editing
Portugal
 


-Original Message-
From: Hutchins, Richard [mailto:[EMAIL PROTECTED] 
Sent: segunda-feira, 19 de Janeiro de 2004 12:43
To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] i want to unsubscribe


Other alternatives here:
http://www.php.net/unsub.php



> -Original Message-
> From: V i s h a l Kashyap @ [Sai Hertz And Control Systems]
> [mailto:[EMAIL PROTECTED]
> Sent: Monday, January 19, 2004 1:53 AM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] i want to unsubscribe
> 
> 
> Dear Thomas J. Rudd ,
> 
> >See
> >To unsubscribe, visit:  http://www.php.net/unsub.php
> >  
> >
> This sucks,  I have tried to unsubscribed 10 times with out any 
> success
> 
> 
> --
> Regards,
> Vishal Kashyap
> 
> ~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
> I Know you believe my words so logon to Jabber.org
> and add [EMAIL PROTECTED] to your roster.
> ~*~*~*~*~*~*~*~*
> I am usually called by the name Vishal Kashyap
> but my Girl friend believes my name should be
> Vishal CASH UP.This is because others love my
> nature and my Girl friend loves my CASH.
> ~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
> 
> --
> 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 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] i want to unsubscribe

2004-01-19 Thread Humberto Silva
Send an email to:
[EMAIL PROTECTED] 
 
Humberto Silva
World Editing
Portugal
 


-Original Message-
From: Hutchins, Richard [mailto:[EMAIL PROTECTED] 
Sent: segunda-feira, 19 de Janeiro de 2004 12:43
To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] i want to unsubscribe


Other alternatives here:
http://www.php.net/unsub.php



> -Original Message-
> From: V i s h a l Kashyap @ [Sai Hertz And Control Systems] 
> [mailto:[EMAIL PROTECTED]
> Sent: Monday, January 19, 2004 1:53 AM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] i want to unsubscribe
> 
> 
> Dear Thomas J. Rudd ,
> 
> >See
> >To unsubscribe, visit:  http://www.php.net/unsub.php
> >  
> >
> This sucks,  I have tried to unsubscribed 10 times with out
> any success
> 
> 
> --
> Regards,
> Vishal Kashyap
> 
> ~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
> I Know you believe my words so logon to Jabber.org
> and add [EMAIL PROTECTED] to your roster.
> ~*~*~*~*~*~*~*~*
> I am usually called by the name Vishal Kashyap
> but my Girl friend believes my name should be
> Vishal CASH UP.This is because others love my
> nature and my Girl friend loves my CASH.
> ~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
> 
> --
> 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 Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] sql query, editing?

2004-01-15 Thread Humberto Silva
Create a form for editing the record
Then on the display funtion just put a link on each record to that form
and pass the id of that record like edit
On the edit form just grab the data of the $id passed on the url and put
those values on the input fields like 
Than just save the form result into the database with an UPDATE
tablename SET filed1='$field1' ... WHERE id='$id'); ...

Dont' forget the bit of code here are just examples and very insecure
... 
Need to work on the validation etc... 
 
Humberto Silva
World Editing
Portugal
 


-Original Message-
From: Louie Miranda [mailto:[EMAIL PROTECTED] 
Sent: quinta-feira, 15 de Janeiro de 2004 8:00
To: [EMAIL PROTECTED]
Subject: [PHP-DB] sql query, editing?


I have this code below, it fetches data on a mysql database. I was
hoping you could give me a code hint on where could, my goal is to
display this data on a browser which i did already and be able to edit
it via a form.

edit? -> table1=value -> table2=value

I dont know where to start. please help me, i hope i can display all the
data and have a button for editing and catch which one to edit.


## code ##
$result = mysql_query("select
product_code,title,language,issue,category,cost from iip_t_cp where
issue = $issue and category = '$category' and language = '$language' and
depleted = '$depleted'", $connect); $num_rows = mysql_num_rows($result);

function display($result)
  {
echo "pricelist records\n";
echo "";
echo "\n\n\n" .
 "\nproduct
codetitlelanguageissuecategory<
th>c
ost" .
 "\n";

  while ($row = @ mysql_fetch_row($result))
{
  echo "\n";
  foreach($row as $data)
  echo "\n\t $data ";
  echo "\n";
}

echo "\n";
}
display($result);
## code ##




-- -
Louie Miranda
http://www.axishift.com

-- 
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] Need help replacing one record

2004-01-09 Thread Humberto Silva

$result=mysql_query("UPDATE tablename SET userpwd='$newpass' WHERE
username='$name'");


-Original Message-
From: Jeroen Wasteels [mailto:[EMAIL PROTECTED] 
Sent: sexta-feira, 9 de Janeiro de 2004 18:24
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Need help replacing one record


Is there a way to change the information in one record of a database,
for example the password, without having to open the entire row, delete
it, and then add it with $row_data[name] and all and the $newpass as
changed password?

-- 
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