برگزیده های پرشین تولز

help with MYSQL tabels

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]
 

rezavalinezhad

کاربر تازه وارد
تاریخ عضویت
20 دسامبر 2002
نوشته‌ها
122
لایک‌ها
2
اگه قبل و بعد از كد از كليدهاي Code يا English استفاده كني متنت قابل خوندن ميشه (از مزاياي زبان شكر شكن فارسي)
 

knowhow

مدیران قدیمی
تاریخ عضویت
25 دسامبر 2002
نوشته‌ها
3,478
لایک‌ها
22
اگه ميشه بگو چه errorی بهت می ده !

من که متوجه نشدم.
ضمنا فکر کنم این کدها یک تیکه از یک برنامه بزرگ است. درسته!؟
 
بالا