Re: values from string query

From: Date: Thu, 26 Feb 2004 19:30:37 +0000
Subject: Re: values from string query
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-178958@lists.php.net to get a copy of this message
Angelo Zanetti wrote:
[snip...] $q="select * from prospects where p_id = '$p_id'"; $result=mysql_query($q, $this->link) or die ("".mysql_error()); while($a_row=mysql_fetch_array($result)) { $c_query="Insert into client (c_name, c_company, c_worktel, c_directtel, c_hometel, c_fax, c_cell, c_email, c_address, c_city, c_pcode, c_country) VALUES ($a_row['p_name'], $a_row['p_company'], $a_row['p_worktel'], $a_row['p_directtel'], $a_row['p_hometel'], $a_row['p_fax'], $a_row['p_cell'], $a_row['c_email'], $a_row['c_address'], $a_row['c_city'], $a_row['c_pcode'], $a_row['c_country'])"; Should you use $a_row->[0], $a_row->[1] ... to refer to each individual value, since $a_row is a reference to an array?
mysql_query($c_query,$this->link) or die ("".mysql_error()); } I echo'd out the values from the Select just to make sure it was getting the correct values. How have you done that?
Best Bao
any help will be appreciated, thanx in advance Angelo --------------------------------------------------------------------


« previous php.general (#178958) next »