getting the id from one table, putting it in another

Codes here !

Moderators: egami, macek, gesf

Post Reply
User avatar
WiZARD
Moderator
Moderator
Posts: 1240
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol
Contact:

Wed Jul 03, 2002 11:07 am

Maybe simpy will create array?
"Sex,Drugs and Rock&Roll " replaced at "Sucks,Bugs and Plug&Play";
Image

User avatar
WiZARD
Moderator
Moderator
Posts: 1240
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol
Contact:

Fri Jul 05, 2002 1:17 am

Your welcome Michelle! :)
"Sex,Drugs and Rock&Roll " replaced at "Sucks,Bugs and Plug&Play";
Image

Goober

Sun Jul 07, 2002 5:35 pm

Since your taken care of, I'll go ahead with my problem.

I'm farely new with php, but not stupid.

When I query information that was submitted into a database prior, my result is: Resource id #3

I used to remember what to do in this situation, but I completely forgot somehow. Someone please help me out.

Oleg Butuzov
Last Samuray
Last Samuray
Posts: 824
Joined: Sun Jun 02, 2002 3:09 am

Sun Jul 07, 2002 8:42 pm

Resource id #3 -?????????

HM?!?! You try to put link indefiner into the data base!
like

Code: Select all

<?
$user="flashsoft";
$pass="me";
$host="localhost";
$database="flashsoft";

$link=mysql_connect($host, $user, $pass);
mysql_select_db($database);


mysql_query("INSERT INTO `table` (`link`) VALUES ('$link')"; // here is problem
// just change a var name

?>



regards...

Goober

Sun Jul 07, 2002 9:12 pm

I'm sorry but your going to have to be more specific. :lol:

Oleg Butuzov
Last Samuray
Last Samuray
Posts: 824
Joined: Sun Jun 02, 2002 3:09 am

Mon Jul 08, 2002 3:18 am

I did not undestud you. (BAD ENGLISH =( )

Resource id #3 - this is link of the mysql connection... so can not put it into data base =(.

Goober

Mon Jul 08, 2002 9:14 am

Yes, I know that. I haven't been trying to put that into the database. I previously entered numbers, they entered just like they should, they are there. When I query them I get that: Resource Id #3, and I dont know what to do from there.

Oleg Butuzov
Last Samuray
Last Samuray
Posts: 824
Joined: Sun Jun 02, 2002 3:09 am

Wed Jul 10, 2002 1:46 am

Goober wrote:When I query them I get that: Resource Id #3, and I dont know what to do from there.


Your vars have same names like link indentifier... may be...

Show me please a sours file, i after that I tell you where i mistake...

Goober

Thu Jul 11, 2002 7:03 am

Code: Select all

$link = mysql_connect( "$dbhost","$dbuser","$dbpass" );
 if ( ! $link )
   die( "You did something wrong.  You are very stupid.  Fix it.<br>" );
      
$select = mysql_select_db( $dbname ) or die ( "You did something wrong.  You are very stupid.  Fix it.<br>" );

$result_wins = mysql_query( "SELECT sum(wins) FROM record" );
$var = mysql_fetch_array($result_wins);     
         if ($var == $four) 
        echo $var;


Thus, when I echo $var, I get "Array". :roll:

elitecodex
New php-forum User
New php-forum User
Posts: 67
Joined: Tue Jul 09, 2002 8:45 am
Location: East Coast, USA
Contact:

Thu Jul 11, 2002 7:09 am

Try something like this:

Code: Select all

$result_wins = mysql_query("SELECT SUM(wins) AS wins_total FROM record") or die(mysql_error());
$var = mysql_fetch_array($result_wins)
if ( $var['wins_total'] == $four )
    echo $var['wins_total'];


When you are calling mysql_fetch_array, you are getting an array of all the fields in the current record, you have have to tell it which one. See if this works.

Will

Goober

Thu Jul 11, 2002 7:28 am

OMFG....I love you so much. If I ever meet you in person, I'll molest you... :lol:

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 4 guests