I would like to send data from my mysql database to a PHP page.
The server were I have this script classify the file that has been uploaded just before this php comes into action, then the server enters the data into the database.
The PHP script should show that data (the column where the interesting data is it's called "cond"). My code is the following:
$uploaddir = '/opt/lampp/htdocs/u';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
$link = mysql_connect("localhost", "pepito", "dominguez");
$nombre=basename($_FILES['userfile']['name']);
$tamany=basename($_FILES['userfile']['size']);
$sql="INSERT INTO `wordpress`.`uploads` (`autoinc`, `nombre`, `tamany`,`fecha`) VALUES (NULL, '$nombre', '$tamany', CURRENT_TIMESTAMP)";
$sqls="SELECT `cond` FROM `cm` WHERE `id`='$numero'";
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
// echo "File is valid and it's fully uploaded";
mysql_select_db('wordpress');
mysql_query($sql);
$numero=mysql_insert_id();
$condicion=0;
sleep(3);
$condicion= mysql_query($sqls);
$a = $condicion + 1;
echo "$a";
echo "$numero";
What I should get in te echo "$a" is a number between 0 to 2, but what I get is a random number that changes everytime a file is uploaded.
I also have tried to get the 'id' column instead the 'cond' column and it does exactly the same.
Extra data: I'm using wordpress, and a plugin which is called "allow-php-in-posts-and-pages". The other echo in the code works properly.