Forum Moderators: coopster

Message Too Old, No Replies

Expecting a parameter to be a string (PHP Warning)

Followed by 'Incorrect integer value'

         

max4

2:16 am on May 31, 2009 (gmt 0)

10+ Year Member



Hello,

I would like to select a single cell from a parent table in my MySQL database and insert the value of that cell into a child table. The following is the method I am using:

[fixed]
$clean = array();
$mysql = array();
$x = mysql_query("SELECT x FROM table WHERE
email = '{$mysql['loginemail']}' AND
userpass = '{$mysql['loginpass']}'");
$clean['x'] = $x;
$mysql['x'] = mysql_real_escape_string($clean['x']); *Line 103*
$post = "INSERT INTO table (y)
VALUES ('{$mysql['x']}')";
mysql_query($post) or die(MySQL_error());
[/fixed]

That should contain all the relevant information about my method. I am receiving the following error:

[fixed]
Warning: mysql_real_escape_string() expects parameter 1 to be string, resource given in path on line 103
Incorrect integer value: '' for column 'cell' at row 1
[/fixed]

I don't understand why I am getting the incorrect integer value either. My tables are both innoDB and the instance in question are both set to INT as well as properly indexed and referenced. Also, the cell in question is set to NOT NULL and currently contains a value. Any ideas as to why I am receiving this error?

max4

4:14 am on May 31, 2009 (gmt 0)

10+ Year Member



I just solved the problem using mysql_fetch_array().

eelixduppy

2:30 pm on Jun 2, 2009 (gmt 0)



Glad you were able to find your solution. Thanks for sharing. :)

max4

6:39 pm on Jun 8, 2009 (gmt 0)

10+ Year Member



You are welcome, eelixduppy. Thank you for making webmasterworld possible.