siavash2004
کاربر تازه وارد
- تاریخ عضویت
- 27 می 2003
- نوشتهها
- 19
- لایکها
- 0
[left:290628b02b]salam all. I have recently got this problem wiht mysql tabels i can not take the value of one query and save it in to antoher table. Can any one help me wiht t his: the sample codes is as follows:
[code:1]
<?php
$server = "localhost"; // MySQL hostname
$username = "*****"; // MySQL username
$password = "*****"; // MySQL password
$dbname = "*****_db"; // MySQL db name
$db = mysql_connect($server, $username, $password) or die(mysql_error());
mysql_select_db($dbname) or die(mysql_error());
$sql->Query("Select CountryName from Nick order by CountryName ");
$countryName = mysql_result(mysql_query($sql), 0, 0);
//no problem here it displays the country name from table
echo $countryName;
// Problem comes here when i want to insert value of countryName in to
//test tabel
$sql->Insert("insert into test values ( '$ID','$countryName')");
$affected_rows = $sql->a_rows;
?> [/code:1]
thanks[/left:290628b02b]
[code:1]
<?php
$server = "localhost"; // MySQL hostname
$username = "*****"; // MySQL username
$password = "*****"; // MySQL password
$dbname = "*****_db"; // MySQL db name
$db = mysql_connect($server, $username, $password) or die(mysql_error());
mysql_select_db($dbname) or die(mysql_error());
$sql->Query("Select CountryName from Nick order by CountryName ");
$countryName = mysql_result(mysql_query($sql), 0, 0);
//no problem here it displays the country name from table
echo $countryName;
// Problem comes here when i want to insert value of countryName in to
//test tabel
$sql->Insert("insert into test values ( '$ID','$countryName')");
$affected_rows = $sql->a_rows;
?> [/code:1]
thanks[/left:290628b02b]